A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Skipping scenes with buttons...?

  1. #1
    Junior Member
    Join Date
    Apr 2004
    Posts
    23

    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~!

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Are you trying to target frame 1 of a scene named 5?

  3. #3
    Junior Member
    Join Date
    Apr 2004
    Posts
    23
    Yeah. o_o;

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    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!

  5. #5
    Junior Member
    Join Date
    Apr 2004
    Posts
    23
    It all makes sense to me, but (this might sound stupid x_x)
    How do i label frames?

  6. #6
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center