A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Does stage loop?

  1. #1
    Junior Member
    Join Date
    Feb 2010

    Does stage loop?

    Hey people,

    I wrote some AS3 script on the stage, but I found out that this was not 'looped' when a flash movie was played. This is a part the code
    ActionScript 3 Code:

    var RandomVar:int = Math.floor(Math.random()*3);

    When I had this in a symbol, every time the swf was played again, it generated a new value for RandomVar. Now i put it on the first frame of the stage it does not randomize every time the swf is repeated, just only the first run.

    How can I fix this, and can someone explain why this happens so I understand it for the next time I hit it?

    Best regards,


  2. #2
    Join Date
    Dec 2001
    York, UK
    Works for me.

    If i put you code on frame 1 of the stage

    then draw some random boxs on frame 10, 25 ect of the stage, then publish

    your code triggers everytime it loops back round to frame 1.

    where you might be getting mixed up is...
    You have you animation in a movieclip which will loop round (no stop());

    but you have your code on one frame in the parent mc (could be the stage)
    This would only trigger once as its player head will only ever stay on frame 1.
    It basically has no idea about whats going on in the movieclip with the animation loop init.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center