Stick Page Forums Archive

AS2 Frame coding

Started by: bl3u | Replies: 2 | Views: 465

bl3u

Posts: 1,434
Joined: Feb 2012
Rep: 10

View Profile
Mar 4, 2014 5:35 AM #1169426
Any way to make it so when a .swf loads. It loads on a random frame in the animation?
Zed
2

Posts: 11,572
Joined: Feb 2009
Rep: 10

View Profile
Mar 4, 2014 11:11 AM #1169649
I don't think so, because it would have to be on a frame before it could look at any code. The best you could do would probably be to put randomising code on the first frame and set the frame rate so high that no one sees it flicker. Don't know whether that'll be good enough; depends what you need it for.
Scarecrow
2

Posts: 9,168
Joined: Oct 2005
Rep: 10

View Profile
Mar 4, 2014 9:06 PM #1170357
it will always load on the first frame before it does anything. you could leave the first frame blank (except for code) and make it go to a random frame almost instantaneously, though. unlikely that anybody would notice.

something like

var randomFrame:int = Math.round(Math.random(_root._totalframes));
onClipEvent(enterFrame){
gotoAndStop(randomFrame);
}

might do the trick (that's pseudocode, you'll need to fix it up yourself. i'm not sure if that's how _totalframes works.)
Website Version: 1.0.4
© 2025 Max Games. All rights reserved.