Buttons inside symbol to activate action on main timeline

Hello I currently have a scrollable symbol placed on my stage. Inside that symbol are buttons which when clicked I want to use to hide and show different images on my stage. I can currently get the roll over images to work but when clicked they do nothing. Each button has an action of when clicked show"name of image" hide"all other images"
Any help would be greatly appreciated.
Thanks

Hi, Tim Jaramillo
I have an identical problem I hope you can help. I have been puzzling with the parameters and set-up of the piece of code for a “slider” Left/Right you published here 3 days ago.
With the code available in Edge script panel, I try to address the main stage from de images in the “slider” symbol. When you click a thumbnail in the “slider” you see the right picture on the stage. Is it possible for you to explain how to do that?
Thanks
Santos
File_sliderLR

Similar Messages

  • In actionscript 3.0 how do i make a nested movie clip button go to a frame on the main timeline

    I am making a website based in flash actionscript 3.0 i have a button nested in its own movie clip, because I have the button expanding to be able to read it i have figured out the only way to do this is by creating it as a movie clipa nd inside the movie clip creating it as a button
    I added an event listener to the blog button by saying,
    blog.addEventListener(MouseEvent.ROLL_OVER,gotoblog);
    function gotoblog(evtobj:MouseEvent){
         gotoAndStop(2)
    this part of the code works it goes to the 2nd frame of the timeline it is in and stops wich is a blown up version of the origanal symbol
    i added on frame 2 a second command
    blog.addEventListener(MouseEvent.CLICK.gotoblogpage);
    function gotoblogpage(evtobj:MouseEvent){
    gotoAndStop("blogframe")
    trace("the blog button was clicked")
    i have named the symbol blog and have name the frame of where the blog page is going to be "blogframe" this line of code at the bottom is where i run into trouble the output window in Flash is saying "The blog button was clicked" just like i want it to. no errors are accouring why than is the playhead not going to frame "blogframe"? if the button is working when i click it the code is right i belive the problem here is it does not want the playhead to go to the frame i want it to. So i gues my question is, how can i make a button withing a movie clip interact with the main timeline?

    I have a similar problem if could please help me i'd really apreciate it!!
    So i have a looping animation of some thumbnails, the hierarchy goes like this
    Scene1(main timeline) -> imgBar(MC)->imgBarB(MC within the imgBar MC)
    My buttons symbols are in the last MC "imgBarB" where i have this code:
    ss1.addEventListener(MouseEvent.CLICK, OneButtonClicked);
      function OneButtonClicked(event:MouseEvent):void{
      MovieClip(root).gotoAndStop("ssbox1");
    I want to control the Btns in my "imgBarB" MC to play a labeled frame(named "ssbox1") on another MC on the main timeline,this other MC goes like this:
    Scene1(main timeline)->ssbox_mc(MC where my labeled frame is)

  • Button in mc to display image on main timeline

    I have a movie clip (mc_menu) that sits on the main timeline. Inside mc_menu I have several buttons that display items inside the mc. I also need to display an image on the main timeline. I have converted the image to a movie clip (mc_01). I am using AS2.

    My knowledge with AS is essentially non-existant. I added the following code on an actions layer in the movie clip (mc_menu):
    _root.attachMovie(mc_forecaster2_test);
    I do not have any code in the main timeline for this interaction.
    I tried to place the mc_forecaster2_test on the main timeline stage, and put in code to make the visible false, and code in mc_menu to make the visible true, but so far, nothing has worked.

  • Use button on mc  to perfrom function on main timeline

    I Was wondering how (or if it is posiible) to use a button I
    have in a movie clip to perform a function on the main timeline.
    Specifically, I want the button in the movie clip to gotoAndStop on
    a frame in the main timeline. Any suggestions?

    Hi,
    Then you would target the movie clip.
    So you would give the mc an instance name (like myClip_mc )
    then just add this into your code ....
    button1.onRelease = function() {
    _root.myClip_mc.gotoAndStop(20);
    This would tell the myClip_mc to stop on frame 20. Providing
    the mc is located in the main timeline that is.
    You can see from the code that we are going to the _root and
    looking for the myClip_mc. If it is held within another mc (say
    Holder_mc) then the code would change to
    _root.Holder_mc.myClip_mc.gotoAndStop(20;
    for cs3 (actionscript 3) it would be this
    button1.addEventListener(MouseEvent.CLICK,clickHandler);
    function clickHandler(event:MouseEvent):void{
    _root.myClip_mc.gotoAndStop(20);
    Hope this helps
    Alan

  • XprtHelp: buttons in mc linked to labels on main timeline?

    I am making a very simple site with one timeline. This seems
    so simple but it isn't working: i created a mc that contains
    several buttons with over states. I placed the mc in my navigation
    menu with an invisible button to close it when user's mouse moves
    off. Where do I link the buttons in this movie clip to labels on
    the main timeline? It seems like I should select them in the mc,
    and use gotoandStop on that label. But when I click them in testing
    the movie, they don't work. I posted the (very) unfinished swf to
    my url:
    jkbeasley.com
    Can anyone help? I am sitting here alone with no experienced
    flashies to ask, and I hate when something so easy just will. not.
    come. to. me!!! THANKS!!!!!!!
    K

    Hi
    Seems straight forward enough - but it would be helpful if
    you could post the .fla as well.
    Thanx

  • As3 button inside imported swf

    Hi all,
    I have a site where an .swf is loaded into frame 11 of the main timeline using newLoader().
    In this .swf there is an titlebuttons_mc with seven buttons in, images_mc etc.
    How do i navigate back to, background_mc, frame 40, which is on frame 1 of the main timeline.
    Thanks for any help
    s1976h

    if the code for the buttons is on the external swf's main timeline, you would use:
    titlebuttons_mc.buttonwhatever.addEventListener(MouseEvent.CLICK,f):
    function f(e:MouseEvent){
    MovieClip(e.currentTarget.parent.parent).background_mc.gotoAndStop(40);
    if the code for the buttons is on the timeline of titlebuttons_mc's timeline, you would use:
    buttonwhatever.addEventListener(MouseEvent.CLICK,f);
    function f(e:MouseEvent){
    MovieClip(parent.parent.parent).background_mc.gotoAndStop(40);

  • Export SWF to have all animation in main timeline?

    I have an animated logo (LOGO.SWF) and I have many instances of the same symbol that play outside the main timeline. I would like to export this SWF (LOGO.SWF) so that I can import it into another FLA (BANNERAD.FLA). But when I import it now into (BANNERAD.FLA) it does not play these symbols as they are not played in the Main Timeline of the original (LOGO.SWF). Is there a way to export the movie (LOGO.SWF) so that you can in a sense have all the animation be in the scene? Does that make sense?
    This will be a flash banner ad, so I cannot have it linked through AS.

    You should be able to make all the animations play the way you want by just switching from MC's to graphic symbols. Just make sure the parent timeline has enough frames to play all the frames in the graphic symbol.
    You could also probably load the swf into a Loader and it should play just fine.

  • Activate a button inside a symbol

    First let me just say that edge is great tool, and makes our life much easier.
    well.. i'm trying to get familiar with the program and I run into some obstacles.
    on the stage i have a symbol, inside that symbol i have a button, which i need it to run an animation on the timeline inside that same symbol.
    i used-  sym.play("label name on timeline"); --- not working
    i have noticed another problem, when i change the cursor it also dosen't appear when i export (CTRL+ENTER).
    i tried to activate the symbol on the main timeline of the stage but it didnt solved the problem either.

    YES.
    Button is in mySymbol
    you need to get back to the stage:
    sym.getComposition().getStage().
    you need to get the symbol
    getSymbol("mySymbol")
    you need to get the button:
    $('btn')
    sym.getComposition().getStage().getSymbol("mySymbol").$('btn').click(function(){
         // you code here
         sym.getSymbol("mySymbol").play('symbolLabel');
    Here is a sample file:
    https://www.box.com/s/lu9o0w0oqtex3fodti4x

  • Button inside a symbols

    Hello
    I have a button inside a symbol and I would when you click to play this symbol.
    The symbol is "Anim_Perso".
    https://creative.adobe.com/file/47b82617-3124-4eab-9482-ac94b30674c4
    https://creative.adobe.com/file/47b82617-3124-4eab-9482-ac94b30674c4
    Thank you
    Stephane

    Hi there.
    Inside your symbol, uncheck Autoplay and, on the button's actions panel, select click and add this line of code:
    sym.getComposition().getStage().getSymbol("Anim_Perso").play();
    pmfr

  • Targeting main timeline from a button symbol

    I have been using Edge since it's inception. However I have not been using it over the last year as I have not had any contract work for HTML5 animation but I just got a contract to re create animations originally done in Flash. My Edge basics are pretty fresh but I have a hard time doing the following.
    I have a 2 state button up  down which was converted into a symbol with a mouseover to change the state. Now I need to have an onclick event play the main timeline which I cannot seem to grasp.
    Any help coding this?
    Thx
    RD

    Hi, RD-
    Try using sym.getParentSymbol() (if you're only one level down) or sym.getComposition().getStage() to get the main timeline, then call play().
    Hope that helps,
    -Elaine

  • Changes inside a symbol won't show up on main timeline

    So I'm working on the animation of a character, I've set up a main graphic symbol for the whole character and an individual symbol for each part of the character inside the main symbol like each arm, leg, hands, ect. Whenever I click into a specific object and animate it on its own timeline and leave it to the main timeline, the animation I did doesn't show up on the main timeline, if I go back in, it's working just fine. I figure I could animate on the main timeline solely, but I'd like to do it the right way. What's going on?
    Thanks, everyone

    You could also select the movieclip on your timeline and then switch it to graphic (play once/ or loop) in the properties panel.
    This way you can see what happens inside when moving your playhead along in the main timeline.

  • Forcing a symbol within a symbol to play out when a button on the main timeline is clicked?

    I have a buttons that play to symbols on the timeline. Once another button is clicked on the timeline the symbol will playout then start playing the next symbol. This is the code used on the onClick event on the introduction button.
    var current = sym.getVariable("current");
       if (current != "") {
          sym.getSymbol(current).play("out");
          sym.getSymbol("intro").play("in");
       else {
          sym.getSymbol("intro").play("shortIn");
       sym.setVariable("current", "intro");
    The problem I'm having is with the technology symbol. I have buttons within this symbol that link to other symbols. I would like these symbols to playout like the other buttons, but the content of the symbol stays on the stage and does not play out when I select a button on the Stage. Here is the code I have on the click event on the button within the symbol.
    var current2 = sym.getVariable("current2");
       if (current2 != "") {
          sym.getSymbol(current2).play("out");
          sym.getSymbol("optical1").play("in");
       else {
          sym.getSymbol("optical1").play("shortIn");
       sym.setVariable("current2", "optical1");
    Any help would be greatly appreciated. Thank you very much!

    Thank you very much for responding so quickly! When I do this all of the nested timelines play from the out label on their timeline. I want the one that is currently being viewed to be the only one that plays out, not all of the symbols within the symbol. Here is the code I'm using on the buttons on the main timeline:
    var current = sym.getVariable("current");
       if (current != "") {
          sym.getSymbol(current).play("out");
          sym.getSymbol("spec").play("in");
       else {
          sym.getSymbol("spec").play("shortIn");
       sym.setVariable("current", "spec");
       var techSym1 = sym.getSymbol("tech").getSymbol("techSym1")
             if (current = "techSym1") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym1").play("out");
       var techSym2 = sym.getSymbol("tech").getSymbol("techSym2")
             if (current = "techSym2") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym2").play("out");
       var techSym3 = sym.getSymbol("tech").getSymbol("techSym3")
             if (current = "techSym3") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym3").play("out");
       var techSym4 = sym.getSymbol("tech").getSymbol("techSym4")
             if (current = "techSym4") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym4").play("out");
       var techSym5 = sym.getSymbol("tech").getSymbol("techSym5")
             if (current = "techSym5") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym5").play("out");
       var techSym6 = sym.getSymbol("tech").getSymbol("techSym6")
             if (current = "techSym6") {
                sym.getComposition().getStage().getSymbol("tech").getSymbol("techSym6").play("out");
    If just techSym1 is being shown on the screen I don't want techSym2 and all the others to be shown going out at all, just techSym1.
    Thank you,
    Kristin

  • How to add button inside move clip and call it from main timeline?

    Hi,
    On the main timeline I  have a movie clip called clock_mc and playBtn
    playBtn is  placed in the center of clock_mc
    When you press playBtn clock_mc starts playing
    playBtn.addEventListener(MouseEvent.CLICK, playClock);
    function playClock(event:MouseEvent):void
        if (event.target == playBtn)
            clock_mc.play();
            playBtn.visible = false;
            trace ("play button was clicked");
    This is working fine for me.
    But I want to add replayBtn to the last frame of clock_mc and set up the function on main Timeline.
    Another words when the clock_mc rich last frame you see replayBtn.
    code example:
    replayBtn.addEventListener(MouseEvent.CLICK, playClock);
        if (event.target == replayBtn)
            clock_mc.play();
            replayBtn.visible = false;
            trace ("replay button was clicked");
    I've tryed to placed the replayBtn on the stage on the main timeline and I've set it up to replayBtn.visible = false;
    And then I add replayBtn.visible = true; to last AS frame of clock_mc but it wont work
    Even when I put the button physically to the last frame of clock_mc it will not work either.
    Please help

    I've solved the problem:-)
    I've set replayBtn.visible = false; on first frame of clock_mc
    and  replayBtn.visible = true; at the last frame
    and than as you sugested I'v add:
    clock_mc.replayBtn.addEventListener(MouseEvent.CLICK, replayClock);
    function replayClock(event:MouseEvent):void
            clock_mc.play();
            trace ("replay button was clicked");
    I couldn't see replayBtn at the firs stage because I have clockTween assosiated with clock:
    clockTween = new Tween(clock_mc, "x", Regular.easeOut, -469,438, .5, true);
    and I had replyBtn in the wrong place so when clock_mc was coming up on the stage replayBtn was on the left side of the stage :/
    Now I have to solve only one thing.
    Maybe you would have any suggestions please.
    I've set up stop(); in a first frame of clock_mc
    that when you see clock_mc sliding in it has to wait for playBtn to be clicked
    because I have two tween:
            clockTween = new Tween(clock_mc, "x", Regular.easeOut, -469,438, .5, true);
            playTween = new Tween(playBtn, "x", Regular.easeOut, -720,514, .5, true);
            playBtn.visible = true;
    so when you click on playBtn:
    function playClock(event:MouseEvent):void
        if (event.target == playBtn)
            clock_mc.play();
            playBtn.visible = false;
            trace ("play button was clicked");
    everythink is working fine except when I clik on replayBtn it play for I sec because there is stop(); on the first frame of clock_mc

  • Attempt to move main timeline from inside a movie clip breaks menu buttons.

    I am attempting to have the main timeline move from a stopped position over a movie clip to frame 1, where my start menu is.
    The code I'm using does move the timeline but in doing so it somehow breaks the 4 buttons I have in frame 1.
    My code in the movie clip:
    stop()
    function replayMovie(event:MouseEvent):void
    MovieClip(parent).gotoAndStop(1);
    Menu.addEventListener(MouseEvent.CLICK, replayMovie);
    My code in frame 1 of the main timeline:
    stop();
    function bo(event:MouseEvent):void
    gotoAndPlay(21)
    SoundMixer.stopAll()
    espesp.addEventListener(MouseEvent.CLICK, bo);
    function ho(event:MouseEvent):void
    gotoAndPlay(31)
    SoundMixer.stopAll()
    espeng.addEventListener(MouseEvent.CLICK, ho);
    function yo(event:MouseEvent):void
    gotoAndPlay(41)
    SoundMixer.stopAll()
    engesp.addEventListener(MouseEvent.CLICK, yo);
    function go(event:MouseEvent):void
    gotoAndPlay(51)
    SoundMixer.stopAll()
    engeng.addEventListener(MouseEvent.CLICK, go);
    The error output when I use my Menu button at the end of the movie clip.
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at SSubjunctiveProjNewgrounds_fla::MainTimeline/frame1()
    at flash.display::MovieClip/gotoAndStop()
    at SSubjunctiveProjNewgrounds_fla::Esp_5/replayMovie()
    Any help would be greatly appreciated.

    For the sake of space, I'll leave out all the package declarations and class declarations and just talk about the functions.
    First, the Game class, it has two functions.  The first one is the constructor function and it launches at the beginning of the game:  First the Game function:
    public function Game():void
    //Game code goes here
    }//Game
    We want to listen for someone to click the mouse on the MenuPage, so lets create a new MenuPage and add a listener to the button contiained within it.
    public function Game():void
    menuPage = new MenuPage;
    menuPage.startButton.addEventListener(MouseEvent.CLICK, startGame);
    addChild(menuPage);
    }//Game
    You will notice that before I declared a variable var menuPage:MenuPage, but that's all I did was declare it.  I didn't really make a new instance of it, I just set aside space for it.  In the first line within the Game function, I'm actually turning that variable into a new instance of a MenuPage.
    We don't have a picture of this imaginary menuPage instance, but lets' assume that in our MenuPage MovieClip in the library, we created a SimpleButton called startButton.  Here, I'm adding an EventListener that patiently waits for someone to click that button.  Once we receive that event, Flash is told to call the startGame function.
    As you get better at this, you'll get into custom events, and the eventListener for the button will exist in the MenuPage class file, or even in another class file that you create just for the button.  Something like StartButton.as  But for now, we can do it as above.
    Now the startGame function:
              public function startGame(evt:MouseEvent):void
    //Remove the start Page
    //Add the zombie
    //Add the gun
    }//startGame
    And we'll replace those comments with real code.  It follows along with what we just did above.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    And we also want to clean up some by removing the menuPage, and throwing out the eventListener.
    public function startGame(evt:MouseEvent):void
    zombie = new Zombie;
    addChild(zombie);
    gun = new Gun;
    addChild(gun);
    menuPage.startButton.removeEventListener(MouseEvent.Click,startGame);
    removeChild(menuPage);
    }//startGame
    Now our Game class is complete.
    The Zombie Class
    public function zombieWalk(evt:Event):void
    this.addEventListener(Event.ENTER_FRAME,zombieWalk);
    this.x = this.x + 10;
    }//zombieWalk
    Notice we've added a function to the Zombie Class.
    The first function adds an EventListener to the zombie.  We can use the word this and actionScript knows we're talking about the zombie that the class is written for.  This listener fires off every frame.  If our FLA file is set to 12fps, then 12 times every second it will call on the zombieWalk function.
    The zombie walk function moves the zombie 10 pixels to the right every time the function is called.
    On a more advanced level, you'll want to add animation in the MovieClip to move the zombie legs.  You'll also want to use Timer events to space out how often the funtion fires and not ENTER_FRAME events.  And you'll want to use a static constant to establish how far the zombie moves.  We have it now set to 10 pixels, but that can get irritating if we want to change that value later.  But again, baby steps.
    And finally, the Gun class
    public function Gun():void
    this.addEventListener(MouseEvent.CLICK, fireGun);
    }//function
    public function fireGun(evt:MouseEvent):void
    this.gotoAndPlay(2);
    }//fireGun
    First we add an EventListener for when someone clicks on the gun.  Once this happens, the listener calls on the fireGun function.
    The fireGun function takes advantage of the frames within the Gun MovieClip.  Say we have three frames in the Gun MovieClip.  The first is just a picture of the gun.  The second is the gun with a flash coming out of the nozzle.  And the third is the gun at rest again.  The line this.gotoAndPlay(2) sends the gun to the second frame with the flash graphic.
    For this to work, each frame in the Gun MovieClip has to have some stop and play commands.
    But.. you said no code on our timeline!! Liar!
    I know.  This is the exception.  You will need basic stop() commands and gotoAndPlay commands to loop animations.  Any MovieClip that has more than one frame will need something to control it.
    So our Gun MovieCLip has the following:
    Frame 1: stop();
    Frame 2: no actionScript... and I mean nothing, not even the words, "no actionScript"
    Frame 3: gotoAndStop(1);
    This will loop the gun to the beginning and wait for the next time the user clicks the gun.
    Advanced features of the Gun class might include a Bullet.as sub-class that creates a bullet MovieClip to fly across the screen.  Sound to play when the shooting takes place.  Object collision detection to see if the bullet hits the target.  And a means by which a custom event will tell the Game.as class that a zombie has been hit and it should be removed from the stage.
    As you go down the rabbit hole of ActionScript 3, you will find yourself at a point where it's just a matter of getting the syntax right for all the built in functions and classes.  Arrays, Loaders, casting variable types.. all that stuff will come.
    I hope this has been helfpul.  It's been on my to-do list for a long time.  When I first started out, no one could provide me with basic answers for how all these classes and whatnot worked.  After teaching myself AS3 for 2 years and reading a gabillion books, I think I've gotten to a point where I'm pretty comfortable with it all.

  • Menu button inside menu, can you do it?

    I am trying to create a dropdown menu when you rollover a
    menu more menus appear underneath. I have my top menu with this
    code. The menu is a mc symbol. The "on" and "off" activate the
    other menu fade in.
    on(rollOver){
    gotoAndPlay("on");
    on(rollOut){
    gotoAndPlay("off");
    Now here is where I'm having problems. I cannot get the menus
    inside the movieclip (which are also mc's)to work. I want them on
    rollover to change color and on click go to a url. I 've tried
    giving them an instance name, a function, _root., nothing. Can this
    be done?

    yes. If you make your sub-menu a movieClip, and your buttons
    inside it, you should have no problems.
    eg:
    on(rollOver){
    gotoAndStop("on"); //"on" should be a 1 keyframe movieClip
    the "on" timeline should have the animation of the sub-menu
    opening, and a stop() action after the sub-buttons load.
    then I would make each sub-button a 1 keyframe movieClip,
    (but you dont have to) and assign all the functions of the button
    to it's own timeline.
    hope this helps!

Maybe you are looking for