A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Linking to different scenes

  1. #1
    Junior Member
    Join Date
    Dec 2003
    Posts
    18

    Linking to different scenes

    Guys,

    I was just wondering if it was possible to do the following in either MX / MX2004...

    My full-Flash site has 4 scenes:

    1: Preloader
    2: Splash page
    3: Interface transformation
    4: Main site (has a number of "pages" using frame labels to separate them for navigation purposes).

    What I would like to achieve is this: there will be buttons in the splash page (scene 2) linking to various frame labels in scene 4 (Main site), the idea being that scene 3 (the interface transformation) is shown first when the user clicks one of the buttons, and then they are taken to the correct frame label in scene 4.

    Any ideas on the best ways to do this?

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Set a variable on your buttons on the Splash page (_global.selected = a scene 4 label; - for example), and have each button go on to only playing scene 3. At the end of scene, add a check to find out what the _global.selected variable holds, and re-direct to the approprite label in scene 4.

  3. #3
    Junior Member
    Join Date
    Dec 2003
    Posts
    18
    Thanks OldNewbie,

    I had a feeling that variables were the way to go! However, I'm not sure how to set the check up correctly - I'd be very grateful if yourself, or anyone else for that matter, were able to point me in the right direction as regards the necessary AS coding...

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Ok!

    Assuming your buttons set a common variable...
    code:
    //Button 1...
    on(release)
    _global.selected = "my_label1";
    // your present code to go and play scene 3...
    }

    //Button 2...
    on(release)
    _global.selected = "my_label2";
    // your present code to go and play scene 3...
    }

    //Ect... For all your buttons,
    //Just changing the label's name...



    At the end of your scene 3, on a keyframe, simply add the following...

    stop();
    _level0.gotoAndPlay(_global.selected);

    That's it.
    If you want it to go the labeled frame and stop rather than play, just use...
    stop();
    _level0.gotoAndStop(_global.selected);

    This is all assuming that the variable is set with the actual names of your labels in scene 4, but of course, I'm sure you had understood that!

  5. #5
    Junior Member
    Join Date
    Dec 2003
    Posts
    18
    That's great OldNewbie! I'll be sure to try that out - thanks for your help with my query!

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