Forum Topic: duplicateMovieCli p

(47 views • 2 replies)

This topic is 1 page long.

<< < > >>
Resigned

InnerChild548

Reply To Post Reply & Quote

Posted at: 6/24/09 06:43 AM

InnerChild548 FAB LEVEL 23

Sign-Up: 08/10/07

Posts: 2,442

This is the present code:
var count:Number = 0;
var i:Number = 0;
function onEnterFrame() {
count++;
if (count == 120) {
i++;
duplicateMovieClip(_root.orig, "MC"+i, 1000+i);
_root["MC"+i]._x = random(550);
_root["MC"+i]._y = random(400);
}
count = 0;
}

I have a movieclip on the stage with the instance name of "orig".

That's all the code in the fla so this should be simple.

The count variable is basically a timer, since the swf runs at 30fps. So every 3 seconds, I duplicate movieclip should be made and placed randomly. But it's not working.

Any help? Please.

Languages I know: AS2, AS3, Javascript, Python, HTML, CSS
Languages I am learning: C++, PHP, SQL, BASIC
Languages I plan to learn: XML, ASP

BBS Signature

None

KaynSlamdyke

Reply To Post Reply & Quote

Posted at: 6/24/09 06:46 AM

KaynSlamdyke LIGHT LEVEL 16

Sign-Up: 06/25/04

Posts: 4,922

At 6/24/09 06:43 AM, InnerChild548 wrote: Any help? Please.

You're resetting count to 0 every frame. Move the count = 0 line to inside the if(count == 120) block.
Also, make it so that it's count>=120. Flash might one day decide to add 0.99999999 instead of 1, and then your exact check fails...

Current build for ThreedeeTiles : Mountain Goat
Previous: Lamprey, Kookaburra


Blushing

InnerChild548

Reply To Post Reply & Quote

Posted at: 6/24/09 06:50 AM

InnerChild548 FAB LEVEL 23

Sign-Up: 08/10/07

Posts: 2,442

At 6/24/09 06:46 AM, KaynSlamdyke wrote:
At 6/24/09 06:43 AM, InnerChild548 wrote: Any help? Please.
You're resetting count to 0 every frame. Move the count = 0 line to inside the if(count == 120) block.

Oh, silly me. I'm so embarrassed. This won't happen again, sorry.

Also, make it so that it's count>=120. Flash might one day decide to add 0.99999999 instead of 1, and then your exact check fails...

Oh, thanks for the tip (And help)!

Languages I know: AS2, AS3, Javascript, Python, HTML, CSS
Languages I am learning: C++, PHP, SQL, BASIC
Languages I plan to learn: XML, ASP

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 02:15 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!