Flash CS4, AS2, beginner. I've got 10 pictures on the timeline named pic1, pic2, pic3... etc. To let a button on the stage switch to a certain picture, let's say pic1, I click the button with the right mouse button, open the action window and choose: on (release) ... gotoAndPlay("Pic1"); Which commands must I select in the action window to make the button switch to one of the 10 pictures at random?
Thank you very much in advance for your help!
Regardless of what the code assist might do, you should not place code "on" objects. Assign an instance name to the button and place the code in the timeline. Use the button's instance name to target it, as in...
btnName.onRelease = pickPic;
Put the frame labels in an array as Strings and use the Math.random()/Math.floor() function to randomly pick one of them...
var labels:Array = new Array("Pic1", "Pic2", etc...
Thank you for your quick reply and detailed advise! I'll try and report later.