Your actionScript code tells flash to go to a different frame number when the user clicks each of the buttons. However, if you decide to edit your Timeline and add or delete a few frames, you will need to go back into your ActionScript and change your code so the frame numbers match.
An easy way to avoid this problem is to use frame labels instead of fixed frame numbers. Frame labels are names that you give to keyframes. Instead of referring to keyframes by their frame number, you refer to them by their label. So, even if you move your destination keyframes as you edit, the labels remain with their keyframes.
To reference frame labels in ActionScript, you must enclode them in quotation marks.
The command gotoAndStop("label1") makes the playhead go to the keyframe with the label called label1.
(to label a frame: in the Proerties inspector, enter label1 in the Label Name field.)
** excerpted from "Adobe Flash cs5 Classroom in a Book" **
No comments:
Post a Comment