dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: gotoAndPlay will not change scenes..

  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    6

    gotoAndPlay will not change scenes..

    Ok, heres the deal:

    I have a movie with 5-6 scenes.
    I've got a menu system in each one, that is an instance of a movie clip.

    Inside the movie clip is my navigation buttons.

    on each button i have..

    on(press){
    _root.gotoAndPlay("myscenename",1);
    }

    for some reason, this will NOT change scenes? Im using MX. any ideas? thanks

  2. #2
    Senior Member
    Join Date
    Nov 2000
    Location
    London - UK
    Posts
    191
    did you try on(release) instead of 'press'...?

    I knwo it might sound too simple but a friend of mine had a similar problem recently, loading movies - an by using 'release' instead of 'press' it owrked - no idea why? bug? luck?

    might be worth a go...

    ANother thing youcould try would be using labels. Stick a label into the first frame - with the name of your scene even - and target that... just a thought...
    ___carpe_diem___

  3. #3
    Banned NTD's Avatar
    Join Date
    Feb 2004
    Posts
    3,438
    Hi

    Button in a Movie Clip explained.

    This seems to be one of the most frequent questions at the Flashkit forums and many others.
    Hopefully, this will explain the mysterious non working buttons inside movie clips.

    Once you put a button in a movieClip the typical gotoAndPlay("Scene2",1) will not work...

    That is a global function that works on the main timeline only...

    So what you need to do is use the MovieClip Method by the same name...it differs in the fact that it only takes only one argument....and that is frameNumber or a frameLabel. FrameLabels when you're dealing with scenes make life a lot easier...so,here's how you do it...

    Go to the first frame of the scene and put a "label". To assign a "label" to a frame... Select your frame. Then just go to Window>Panels>Frame and type your label in the Label box.

    Then on your button in your movieClip, put this:

    on (release) {
    _root.gotoAndStop("yourLabel");
    }

    Of course, replace "yourLabel" with the actual label you put on your frame...

    You can enter this in the Expert Mode in the Actions Panel...or to enter this in the Normal Mode in the Actions Panel, scroll down to Objects>MovieClip>gotoAndStop (or gotoAndPlay)......... DoubleClick and it automatically puts the on(release) part of the code.

    Then in the Expression box, type the path in front of the dot (in this case, _root). Where it asks for the frame, put in your "label".............be sure to put quotes around it.

    Hope it helps

    Regards
    NTD

  4. #4
    Junior Member
    Join Date
    Feb 2004
    Posts
    6
    AWSOME! thank you so much!
    Cheers to everyone at Flash kit!

  5. #5
    Junior Member
    Join Date
    Feb 2004
    Location
    Bucharest
    Posts
    2
    Or you can make a global funtion in first frame of you main scene and in this function to check what button are pressed or relesed and call function gotoAndPlay ("Scene",1); .. .somethisng like that ....

    main scene - frame 1

    _global.PressButton=function(x){
    if(x==1){
    gotoAndPlay("Scene3",1);
    }
    if(x==2){
    gotoAndPlay("Scene4",1);
    }
    ....
    }

    and on button MC at onpress ar onrelease event enter

    on button1

    on(release){
    PressButton(1);
    }

    on button2

    on(release){
    PressButton(2);
    }


    I hope you undestand ....



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