-
Skipping scenes with buttons...?
My script doesnt work, which was
code:
on(release) {
gotoAndPlay(5, 1);
}
And I got an error, which i have no idea how to fix, again :P
code:
**Error** Scene=Scene 3, layer=Instructions, frame=1:Line 2: Scene name must be quoted string
gotoAndPlay(5, 1);
Total ActionScript Errors: 1 Reported Errors: 1
Help would be appreciated, thanks~!
-
Are you trying to target frame 1 of a scene named 5?
-
-
Well, as the error reports, you need double quotes on the scene's name...
code:
on(release) {
gotoAndPlay("5", 1);
}
But, it's a bad idea to use a number only as a scene's name. Furthermore, since targeting scene names only works if everything is on the main timeline, you should NEVER target scene names, but labeled frames instead.
Thus label frame 1 of your scene "5", with an unique label (once again no number only labels or at least not starting off with a number, and don't use special characters other than the underscore!) such as mystart5 or whatever suits you, add _root to your path, and target that labeled frame in your button's script...
code:
on(release) {
_root.gotoAndPlay("mystart5");
}
Works like a charm!
-
It all makes sense to me, but (this might sound stupid x_x)
How do i label frames?
-
You select the frame on the timeline and in the property inspector you'll see a box with < frame label >... That's where you would type it in. No doubles quotes here, just in the gotoAndPlay action on the button.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|