okay so i finished my first program.. i had a start button n everything.. but to start the movie.. for some reason u have to click the button twice.. n i didn't kno why.. so i need some help.. its just one scene.. n i made one layer just for a stop in the beginning.. n then i made a button layer. .where i placed the button on the stage n had this in the script..
code:
on (release) {
MyButton.onPress = function() {
gotoAndPlay(2);
};
}
It's like this:
when you have on() or onClipEvent() this code is attached to a movie clip and/or button.
This is the way is was done in flash 5.
When you have some_mc.onSomething , for example, MyButton.onPress, you have a method, and this is the preferred way in MX or higher.
So, you have duplicated code!
The problem is that your on (release) does nothing but define a method, the onRelease, so, only when you click the second time, the onRelease is triggered.
For example, if the button is on the stage, you attach the code to the main timeline.
Make sure the instance name of the button is MyButton.
And the gotoAndPlay(2) refers to the timeline you want to control.
If no movie clip is specifyed, it is the timeline the code is attched to (in the example, the main timeline).