random frame actionscript
- Started
- Last post
- 15 Responses
- nebrow
hello
im having troubles with a flash file that i have set to go to a random frame (1 of 3) with an image in it. It seems to work except sometimes the image does not show up. Any help?
in action:
http://nikibrown.com/archworks/h…
here is the actionscript i have in the first frame:
gotoAndStop (int(Random(3)+1));
stop();heres my fla
- joyride0
do those frame numbers exist?
if not, it won't go anywhere.
- nebrow0
yes? Im not sure what you mean by that? I have 3 frames in my FLA and i want it to go to and stop one of those frames.
It works most of the time but if you refresh it sometimes it will go to a frame and the image will not be there. I have no idea why its doing this.
- nebrow0
any help? *bump*
- nebrow0
any help? this is frustrating and i dont know why its doing this! im no actionscripting guru!
- joyride0
so do you have 4 frames or 3?
1st frame has code. frames 2-4 (the other 3) have the images.
Is that correct?
- lvl_130
file not found.
seems like it only works hardly ever and only pulls that one same pic if it does work.
- nebrow0
and i have an image in each of the 3 frames
- orkman0
Something in your image MCs is messing it up. If you delete them from your "bgimages" layer it all works just fine. And then I added just some junk images from my desktop instead of those images and it worked randomly as well.
Just blows up with those images specifically for some reason.
Do you have any sort of actions in those image MCs? Very odd. You might try re-exporting those JPEGs from PS or FW and try them on their own layer.
- nebrow0
so making them images instead of movie clips and putting them in different layers works...
http://nikibrown.com/archworks/h…
http://nikibrown.com/archworks/a…
but for some reason i cant get it to go to a random frame in firefox for mac? It works fine in safari if i keep hitting refresh....
i have no idea if this works in IE...
- orkman0
Sorry. Wouldn't randomize in IE either.
Again it has something to do with the images. Pulling them out and replacing with other images worked for me, but I was able to recreate the error with a veyr large wallpaper JPEG. It wouldn't go to that frame.
- jarredbishop0
it probably isnt this but 'random(#)' is kinda old school. for random(3) it would probably be better to use 'Math.round(1+Math.random()*2)'
- nebrow0
So would it just be something liek this in my first frame:
gotoAndStop (Math.round(1+Math.r andom()*2));
??
- nebrow0
so this works: gotoAndStop (Math.round(1+Math.random()*2))
but it does not go to a random frame in firefox!!! WTF!!! Why does it work in safari? sigh...
i want to kick flash in the balls...
- nebrow0
http://nikibrown.com/archworks/h…
works fine in safari
So in FF when i refresh it will randomly go to frame 1 and frame 2 but not frame 3? it flashes frame 3 but then goes back to frame 2.
I have this in frame 1 on my actions layer:
gotoAndPlay (Math.round(1+Math.random()*2))
stop();here is my .fla:
http://nikibrown.com/archworks/h…
thanks for all the help guys!