A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Buttons in moviclips. Can they control the main timeline?

  1. #1
    Member
    Join Date
    Mar 2005
    Location
    Study Bristol UK. Live Southampton UK
    Posts
    43

    Buttons in moviclips. Can they control the main timeline?

    does anyone know of any actionscript that can be applied to a button that is
    IN a movieclip so it can navigate the main timeline INSTEAD of just the mov
    ieclip's timeline?

    I've tried applying this script to a button in a movieclip:


    on (press) {gotoAndPlay("scene1","1");

    }


    this doesn't seem to navigate the maintimeline at all though.

    I would really appreciate any help

  2. #2
    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:
    code:

    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(MX), 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
    NTD

  3. #3
    Pedro
    Join Date
    Nov 2003
    Location
    UK
    Posts
    69
    Here's a tip, use the little target/crosshair icon above the input box on the actionscript panel. It helps!
    "I feel like a king!"

  4. #4
    Member
    Join Date
    Mar 2005
    Location
    Study Bristol UK. Live Southampton UK
    Posts
    43
    Thanks a bunch people. You've made someone very happy!!!!!!!!

  5. #5
    Senior Member
    Join Date
    Mar 2001
    Location
    New York City
    Posts
    190
    hey I was just going to ask this question but did a search b/f hand. glad I did. this is exactly what I need.

    Thanks!

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