FiqStudios's Banner

FiqStudios

Reviews News Main
FiqStudios

Age/Gender: n/a, Male
Location: New Mexico
Job: Student

Rusty Air.

Contact Info

Newgrounds Stats

Sign-Up Date:
12/23/07

Level: 8
Aura: Dark

Rank: Scout
Blams: 56
Saves: 154
Rank #: 36,853

Whistle Status: Garbage

Exp. Points: 590 / 710
Exp. Rank #: 64,712
Voting Pow.: 5.00 votes

BBS Posts: 671 (0.92 per day)
Flash Reviews: 2
Music Reviews: 0
Trophies: 0
Stickers: 0

Entry #3

Jump to Entry: [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ]


FiqStudios

Experimental Flash!

Posted by FiqStudios Jan. 18, 2008 @ 2:15 AM EST

As a nice little side project, I have decided I'm going to post my Experimental flash on my user page, along with the script and a brief explanation. I will provide a link to download the source and hotlink to the .swf. I'll start by posting a little engine I came up with in school.

I cannot Hotlink to the .swf at this time, sorry. (SwfUp is down and ImageShack hates me.)

Source.

Setting up the .fla:

Create a MovieClip, and remove it from the Stage so that it only exists in the library. Right click the MovieClip in the library and select "Linkage". Check "Export for ActionScript" and in "Identifier" type "dot". Change the Frame Rate from 12 so that it will run smoothly ( I used 40), and add this script to the Main Frame Panel:

var nd:Number = 0;
var lm:Number = 7;
function onMouseDown():Void {
if (nd<=lm) {
var dot:MovieClip = attachMovie("dot", "dot"+nd, getNextHighestDepth());
dot._x = _xmouse;
dot._y = _ymouse;
nd++;
}
}
function onEnterFrame():Void {
clear();
for (var i:Number = 0; i<nd; i++) {
var dot:MovieClip = this["dot"+i];
dot._x += Math.random()*2-1;
dot._y += Math.random()*2-1;
for (var j:Number = i+1; j<nd; j++) {
var ndot:MovieClip = this["dot"+j];
lineStyle(1, 0x000000, 100);
moveTo(dot._x, dot._y);
lineTo(ndot._x, ndot._y);
}
}
}

Now test the flash. What should appear is a blank screen. Start clicking around what should begin to appear is lines that connect the MovieClip you created. The result will be a very cool effect.

Explanation:

var nd:Number = 0;
var lm:Number = 7;

This initiates the variables that will be used later. "lm" limits the amount of dots allowed to be created. It can be changed from 7 to any other number, and I have recorded the script running smoothly at low quality with 30 dots on the stage. Just be cautious, as performance decreases at a geometric rate.

function onMouseDown():Void {

When you click....

if (nd<=lm) {

Check to see if you have not reached the limit.

var dot:MovieClip = attachMovie("dot", "dot"+nd, getNextHighestDepth());
dot._x = _xmouse;
dot._y = _ymouse;
nd++;

Attaches the MovieClip you created to the stage, gives it custom instance name (dot0,dot1,dot2....), and sets its position to the place you clicked,.

}
}

function onEnterFrame():Void {

Runs every frame.

clear();
for (var i:Number = 0; i<nd; i++) {
var dot:MovieClip = this["dot"+i];

Runs a for loop and specifies all the dots that have been created.

dot._x += Math.random()*2-1;
dot._y += Math.random()*2-1;

Moves the dots randomly for that "jiggle" effect

for (var j:Number = i+1; j<nd; j++) {
var ndot:MovieClip = this["dot"+j];
lineStyle(1, 0x000000, 100);
moveTo(dot._x, dot._y);
lineTo(ndot._x, ndot._y);

Within the previous for() loop, specifies the other dots created with instance names higher than the one before, and draws a line between them. This results in every single dot being connected by a line.

}
}
}

I will post more later.

EDIT EDIT EDIT EDIT EDIT EDIT

I re-wrote this script. Now you don't have to make a MovieClip, just add the script and done!!!

var nd:Number = 0;
var lm:Number = 100;
function onMouseDown():Void {
if (nd<lm) {
_root["x"+nd] = _xmouse;
_root["y"+nd] = _ymouse;
nd++;
}
}
function onEnterFrame():Void {
clear();
for (var i:Number = 0; i<nd; i++) {
if (Key.isDown(Key.SPACE)) {
_root["x"+i] += Math.random()*4-2;
_root["y"+i] += Math.random()*4-2;
}
for (var j:Number = i+1; j<nd; j++) {
lineStyle(1, 0xFADFAD, 100);
moveTo(_root["x"+i], _root["y"+i]);
lineTo(_root["x"+j], _root["y"+j]);
}
}
}

The difference is instead of making a MC it makes variables X0,Y0, X1, Y1...... It also only jiggles when you hold space, allowing you to draw really cool designs first.

Updated Swf.
Updated Source.

Updated: 01/20/08 2:17 PM Log in to comment! | Share this!

The People Have Spoken

1 Comment

Jan. 20, 2008 | 12:18 PM UnknownFury says:

You could always upload it to spamtheweb.com (the swf)
Or the fla for that matter :)

Pretty cool but i had to copy and paste it into a new file or it tried to compile it on your computer, <i>Error opening URL "file:///C|/Documents%20and%20Setting s/Ryan/My%20Documents/OMGDOTZ.swf"</i >

And yeah, the dot thing was pretty pointless.

Jan. 20, 2008 | 2:20 PM FiqStudios responds:

Yeah, thanks. I just uploaded the updated version. I've been really optimization heavy recently, so I just had to remove the MovieClips.

Jump to Entry: [ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ]