A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Buttons open same mc, but link to different layers, can it be done???

  1. #1

    Buttons open same mc, but link to different layers, can it be done???

    I have 2 buttons on an interface, on the root timeline which play the same animation (of the interface disappearing) in a mc. But i would like to have them open they're 2 respective layers at the end of the animation.

    ie one button could be to "Contact us" which would play the closing of the interface animation and then open up a layer on level 2 called contactus.swf

    if you had pressed another button called "Portfolio" it would play the closing of the interface animation and then open up a layer on level 2 called portfolio.swf

    (the reason im asking is because I'll have a lot more than 2 of these buttons happening and was wondering if i could use one animation rather than may duplicated versions of the same aniamtion)

    thx in advance.
    Yourz Trooly,

    PB
    www.twistedpancreas.com

  2. #2
    Senior Member
    Join Date
    Apr 2005
    Location
    FL, USA
    Posts
    442
    You want to use the same animation but load different swfs each time? On each of your buttons, put something like:
    Code:
    on(release) {
    //change this var for each button (to the name of the respective .swf)
    _root.toLoad = "contactus.swf";
    gotoAndPlay("yourAnimation");
    }
    Then when your animation comes to the frame where you need to load the swf, do this:
    Code:
    loadMovie(_root.toLoad , targetMC);

  3. #3
    hmmm, thats not running the animation in the mc, thus not getting to the loadMovie(_root.toLoad , targetMC);
    Yourz Trooly,

    PB
    www.twistedpancreas.com

  4. #4
    Senior Member
    Join Date
    Apr 2005
    Location
    FL, USA
    Posts
    442
    Well don't use the code "gotoAndPlay("yourAnimation");" verbatim. You have to put in the path to the MC that you want to play depending on your MCs' instance names, e.g.
    Code:
    _root.mc1.mc2.gotoAndPlay(2);
    ...or however you have it set up.

  5. #5
    ok i've got

    on(release) {
    _root.toLoad = "contact.swf";
    _root.mc1.gotoAndPlay(2);
    }

    on my button, which is playing the animation now (thx)

    but on the last frame inside the mc1, this code isnt opening the contact.swf on a new level

    loadMovie(_root.toLoad , targetMC);
    stop();
    Yourz Trooly,

    PB
    www.twistedpancreas.com

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