Hi,
Feel really dumb here but I recently purchased a mac computer (used) that had Flash professional cs3 installed and so I thought I would give it a go seeing as I have been using Director for sometime. I seem to be having quite the struggle scripting the buttons in my project. here is what I have and what I would like to accomplish. It is rather simple:
I have a movie that is 30 frames long.
I have 6 buttons on the first frame that will take the viewer to 6 different frames in the movie.
The buttons were pulled from the components window.
Here is what I want to do:
I want to click on button 1 throughout the movie and have it take me to frame 5
I want to click on button 2 throughout the movie and have it take me to frame 10
I want to click on button 3 throughout the movie and have it take me to frame 15
I want to click on button 4 throughout the movie and have it take me to frame 20
I want to click on button 5 throughout the movie and have it take me to frame 25
I want to click on button 6 throughout the movie and have it take me to frame 1 (main menu)
Seems simple enough, but when I drag the button from the components window onto the stage, I dont know where to get the script from? When I go to the library and insert the GoToandStop script, it doesnt work.
Lingo is different then actionscripting and so I dont understand it.
Can someone offer some insight/advise with the scripting of the component buttons?
Thanks
first click each button to select it and then in the properties panel (window/properties), assign an instance name (eg, btn1, btn2 etc) for your buttons.
then open the actions panel (window/actions) with nothing on-stage selected enter:
for(var i:Number=1;i<=6;i++){
this["btn"+i].ivar=i;
this["btn"+i].onRelease=function(){
if(this.ivar==6){
gotoAndStop(1);
} else {
gotoAndStop(this.ivar*5);
}
}
}
Kglad,
Didnt work. Im finding it very strange that there arent built in behaviors for buttons. Simple on press go the frame and stop scripts. Am i missing something? This is a simple a function as you can get and to have to write all this code for a simple command such as this is crazy. Again, am I missing something?
North America
Europe, Middle East and Africa
Asia Pacific