dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: gotoAndPlay("scene",frame); problem

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Posts
    254
    hi

    I have a movie clip with a button in it... I am trying to get that movie clip on release to go to the scene... But dosent do anything here is what i am using



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


    note... the scene name is 1

    any help thank you in advance,

    Le james

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    From within movie clips or from loaded movies on other levels and once the movie is compiled, scene names are useless.
    You either have to use a cumulative frame number of all frames in all scenes (including a preloader if you have one!), preceding the targeted frame or the labeled frame method.
    Thus if you're targeting frame 1 of scene 3, and your preload holds 4 frames, your scene 1 100 frames, and your scene 2 50 frames, you would have to target frame (4+100+50+1)=155.

    on (release) {
    _root.gotoAndPlay(155);
    }

    But if you edit any scene afterwards, you will have to re-calculate that exact cumulative frame number and correct all of your gotos. A lot of work!

    Thus, it would be better to use the labeled frame method. In the above example, you would label frame 1 of scene 3 with start3 or whatever, and use:

    on (release) {
    _root.gotoAndPlay("start3"); //Notice the double quotes in case of a label!
    }

    Unless you delete it, an unique label will allways remain attached to that particular frame, no matter how many edits you do in previous scenes. Much easier and safer!
    Try it, you'll like it!

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    254
    great!! That's pretty useful info. Thank you, just what i needed to know.

    le james

  4. #4
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    hey nice one guys i've had the same problem, unfortunately this hasn't worked for me, the frame I'm going to is frame 25 in scene 1. i have it labelled as Photos and whichever method I use it goes to frame 34!!! i've even tried subtracting the difference and _root.gotoAndPlay(16);!!! this time it goes to frame 20! i can't get my head round it.
    the button that i am using is however a movie clip within a movie clip so perhaps this is the issue? does the _root. still apply in this case or should it be something different? any help would be hot!

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