Referencing a button on main stage from inside a movieclip

I am banging my head against the wall on this.
On the main stage I have a button that I have made invisible once the file is loaded.  Inside a movieclip I have on frame 15 the following actionscript 3 code
button_mc.visible = true;
I want the button to become visible at the end of this movieclip.  I am not using an external as3 file, I am putting the as3 code in its own layer on the first frame.
I know it has something to do with the path to the button, but I cannot figure it out.  If there is anyone who can point me in the right direction for referencing instances by instance name that reside on the main satge from inside a movieclip I would be very grateful.
Thanks
Thepopguy

Try:
MovieClip(this.parent).button_mc.visible = true;

Similar Messages

  • Accessing buttons on main stage from inside of a movie clip

    Greetings...
          here is the scenario:
                 - I have buttons on main stage, and a swf file which is loaded to scene using a LOADER in AS3
                 - this is a website, so the problem rises when user moves its cursor around the page and now  buttons in main stage,
                    are still active since they are behind the loaded swf file.
                 - i would like to learn, how can i CODE inside the loaded SWF file, to either remove the buttons in main page, or remove
                    the event listeners. not sure if my case has anything to do with .Parent or .roo, (I want to access those main stage
                    buttons from the SWF file which is loaded)
                 - The general case is, i have SWF files loading inside another SWF files, is it possible to access items on each stage from
                    inside of loaded SWF files on that specific stage. Similarly i would be interested to learn about accessing main stage from inside
                    of movieclips running on stage. how can i access something not in present FLA file yet, in FLA file that is loading the page as SWF.
                    Thanks.

    If you load an swf into another using the Loader class, then the Loader itself is the parent of the loaded swf., so MovieClip(parent.parent) might help you to target the timeline that the Loader was born from.  The more proper way to have a loaded file talk to a parent file is thru dispatching events that the parent assigns listeners for after the file has loaded.  Here's a link to a posting that might help explain how to implement this.
    http://forums.adobe.com/thread/470135?tstart=120
    As for the buttons that you want to disable, you could either use the removeEventListener() method to remove the listeners you have assigned, or you could set their mouseEnabled property to false, or you could set their visible property to false.

  • How to access frame lable on main stage from a nested symbol

    All-
    I have two buttons
    btnA on the main stage
    btnB is nested inside btnA
    How do I access a frame lable on the main stage from btnB

    ok i figured this one out.
    i created a button symbol 'BTN-NAV-INTRO' and placed it on the main stage.
    i created a mouse over/out effect on it's timeline with an object on top called 'MC-HIT-AREA' 
    i placed the mouse over graphics inside the button and animated them on their own timelines
    coded the MC-HIT-AREA to play those timelines 'MC-HIT-AREA' is nested inside the button
    then on the main stage (this is what threw me) i set the button ('BTN-NAV-INTRO') to cursor and coded it to call the other button form the main stage.  Nesting it wasn't necessary.  I didn't realize you could have multiple mouse over/out effect below a mouse over effect from the main stage
    Edge rocks when i get it to do my bidding! 

  • Access main stage from a symbol timeline?

    Can I access main stage  from a symbol timeline?
    Eg:
    I have a symbol called "ball" and its own time line. There is a close button at the end of ball's timeline,
    When close button pressed, I want to go back to main timeline.
    Thanks
    Phyle

    Thanks Hemanth.  I will try to explain.
    Open Edge animate. On the main stage I added a label called "home".
    I created circle, converted to symbol, renamed to "ball".
    Inside "ball" , I have a animation, at the end there is a button called "closeBt"
    When "closeBt" pressed, I want to go back to main stage "home"

  • Script to control main timeline from inside MC?

    This is such a newb question and I'm sorry! I have a Movie
    Clip on the main timeline and inside that MovieClip are several
    buttons. I want the buttons to go to specific frames in the main
    timeline. I have:
    on (release) {
    gotoAndPlay("PowerPoint");
    I know there needs to be something in there to tell it the
    main timeline. I searched for this very basic, simple question and
    couldn't find anything.
    Thanks for any help.

    if your buttons are true buttons use:

  • Calling a variable from inside a movieclip AS3 in Flash CS4

    I am trying to trace a variable string from inside a movieclip which is inside another movieclip on the main timeline using:
    trace(VariableString);
    and also
    trace(stage.VariableString);
    Neither work
    The variable is an input textfield and traces fine when it is on the main timeline but will not work from inside the movieclip. I am using Actionscript 3 in Flash CS4.
    I appreciate this has probably been discussed previously on this forum but I cannot find a difinitve answer that seems to work.
    Thanks

    Thanks for the reply. However this did not seem to work.
    I think I had better explain a little better.
    On Keyfrme1 I have a MovieClip1 containing a text input component. I have created a variable on keyframe 1 using:
    var VariableString1:String = new String();
    When clicking on a seperate button this happens:
    VariableString1 = MovieClip1.text;
    I can trace this correctly on the main timeline using:
    trace(VariableString1);
    However, if I try to trace this from  another keyframe inside a movieclip2 which is inside another movieclip3 using:
    trace(MovieClip1(root).VariableString1);
    I just get the error 1180 call to a possibly undefined method MovieClip1
    Sorry if this is not very clear but I am getting very confused with this.
    Thanks again

  • Changing stage timeline from inside a movieclip button

    I create a movieclip button, and I want to change main timeline from it. what should I do ?
    Is it useful to use MovieClip(root).gotoAndPlay(...) ; ?
    Is there any other way to change main timeline?

    Example:
    Add something to trigger the event in the child:
    dispatchEvent(new Event("eventTriggered"));
    In your parent swf, listen for the event using a listener for the child with a corresponding event handler...
    childName.addEventListener("eventTriggered", eventHandler).
    function eventHandler(event:Event):void {
        trace("child dispatched an event");
         // gotoAndPlay(etc);

  • AS3 loading external swf files with buttons from inside a movieclip

    In my main .swf I have labels on the timeline, navs for those btns are on the first frame of the AS layer and each button sends the playhead to a different frame.
    On one frame called fr1 there is an mc called mc_1 that appears on stage when the playhead stops there. Inside mc_1 are a set of navigation buttons that need to call external .swfs.
    Do I add event listeners on the last frame of mc_1 for each button?
    how do I call the loaders for the swfs on the buttons since the swfs will load on the main timeline NOT the mc_1 timeline?
    So label on main timeline called fr1 will load external1 swf , on fr10 external 2.swf will load and so on.
    any help?

    The code for that button's event listener needs to be placed wherever it has direct access to the button.  Not necessarily on the same timeline, but in a place where both the button and the code are present at the same time.
    The code could be placed at the frame in the main timeline where the movieclip with the button(s) is, targeting the buttons via the movieclip (mc.button.addEvemtListener...) , unless the buttons are somewhere down the timeline of that movieclip.
    If they are down the timeline of that movieclip, then you would need to have the event listener also inside the movieclip, down its timeline where the buttons are finally settled in... being sure to assign instance names to the buttons at every keyframe.

  • Going Back to the main frame, from inside a movie clip time line.

    In flash CS5 I want to go back to the main time line, from inside a movie clip button, so when i click the the movie clip it goes to another frame on the main time line..
    Can anyone help me?
    Thanks
    Daniel Derrick

    your can use _root to reference the main timeline from anywhere though that can lead to problems if your swf is loaded by another swf.  because of that eventuality, it would be better to use a relative path back to the main timeline.
    so, from a movieclip's timeline (when the movieclip is on the main timeline), you can use _parent to reference the main timeline.
    but even better would be to use no code on that movieclip's timeline and keep all your code on one timeline (the main one).

  • Button on main stage target frame in mc

    This seems simple, but for some reason it is not working.
    I have a button on the main stage. I want to target my MC
    (McSlidey01) that is placed on the main stage.
    facts:
    McSlidey01 is a MC that is 50 frames long. On the last frame
    it has an action script that takes it back to the root and advances
    to the nextFrame.
    button01 is on the main stage. I want this button to stop
    McSlidey01 on frame 25. This way it will stop the MC and not
    advance to its last frame that has the nextFrame action on
    it.

    :

  • Can't target main stage from dynamically loaded swf...

    A part of the Flash app. I'm working on right now does the following -
    Main stage loads an external swf using the following function:
    function loadAsset(evt:String):void{
    var assetName:String = evt;
    if (assetName != null){
      var assetLdr:Loader = new Loader(); 
      var assetURL:String = assetName; 
      var assetURLReq:URLRequest = new URLRequest(assetURL); 
      assetLdr.load(assetURLReq); 
      assetLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded) 
      assetLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayAssetLoaderProgress);  
      function loaded(event:Event):void { 
       var targetLoader:Loader = Loader(event.target.loader); 
       assetWindow.addChild(targetLoader);
    The externally loaded swf loads another external swf into itself using the following function:
    function loadQuiz(evt:String):void{   
    var quizName:String = evt;
    if (quizName != null){
      var quizLdr:Loader = new Loader();
      var quizURL:String = quizName;
      var quizURLReq:URLRequest = new URLRequest(quizURL);
      quizLdr.load(quizURLReq);
      quizLdr.contentLoaderInfo.addEventListener( Event.INIT , loaded)       
      quizLdr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, displayQuizLoaderProgress); 
      function loaded(event:Event):void {
       var targetLoader:Loader = Loader(event.target.loader);
       quizWindow.assetLoader.addChild(targetLoader);     
    Everything loads fine, but from the quizWindow.assetLoader.addChild(targetLoader) level, I want to send a message/fill in a dynamic text box on the Main Stage. I have been "parenting" my brains out and I'm not sure how to communicate with that level.
    can anyone show me the proper path or method based off the above, or have a suggestion?
    Cheers,
    ~Chipleh

    Andrei1,
    Thanks again for your help. I was finally able to get the solution you posted below to work for me.
    Much appreciation,
    ~Chipleh
    "In your loaded movie write:
    function traceMyself(e:MouseEvent):void{
         dispatchEvent(new Event("I_WANT_TEXT"));
    function writeText(text:String):void {
         xmlFileName1.text = text;
    In the top movie that loads external swfs something like that:
    loadedSwf.addEventListener("I_WANT_TEXT", onTextRequest, true);
    function onTextRequest(e:Event):void {
         Object(e.target).writeText(tQuizXmlFile1.theQuizXmlFile.text);
    This way these two entities are independent and, most importantly, don't care who is the parent or grandparent."

  • Reaching a movie on the stage from inside another movie clip

    I'm trying to reach a body of text which i turned into a movie clip which is on the main stage, and have it scroll up/down whenever it rolls over the designated hot spots. Here's what i have.
    stage.addEventListener(MouseEvent.MOUSE_MOVE,down1,false,0,true);
    function down1(e:MouseEvent):void {
         if (mouseX>=0 && mouseX<=42 && mouseY>111.1 && mouseY<146.1) {
              stage.addEventListener(Event.ENTER_FRAME,scrolldown1);
         } else {
              stage.removeEventListener(Event.ENTER_FRAME, scrolldown1);
    function scrolldown1(e:Event):void {
         if(MovieClip(this.root).resume_txt.y > 219) {
              MovieClip(this.root).resume_txt.y += 5;
         } else {
              this.removeEventListener(Event.ENTER_FRAME, scrolldown1);

    Can you explain the purpose bhind these lines...
         if(MovieClip(this.root).resume_txt.y > 219) {
              MovieClip(this.root).resume_txt.y += 5;
    It seems as though if it is >219, it will move until the mouse moves out of the region.  Is there any specific aspect of it that you can pinpoint as not woking?.

  • 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.

  • How do I recerence Movie Clips on the Main Timeline from inside a class?

    Hey everyone, this might be a stupid question but I thought
    I'd ask cause it's making me nuts. I'm all of 2 days into AS3
    (coming from not using Flash at all in YEARS) so feel free to
    consider me ignorant. I do have plenty of application development
    experience in other areas though.
    I can't seem to create a class that can reference an instance
    of a movie clip on my main timeline. I'd post code of what I've
    tried but I've gone through so many desperate edits & wild
    guesses that it was just garbled junk before I deleted it all.
    Basically here's how I figured Flash could work, though maybe
    it doesn't work this way at all.
    I'm assuming that with AS 3 being so big on being a true
    object oriented environment, I wouldn't need to mix my code and
    interface together. Preferably I'd be using the Flash authoring
    tools just to design my interface. Create a button... place it
    somewhere... give it an instance name. Roughly the equivilant of
    Apple's InterfaceBuilder for those of you that might be familiar
    with Cocoa development. I can see maybe having to put a few lines
    of ActionScript onto frame 1 (though really I'm hoping Flash would
    have a better method of kicking off the application at this point
    that using code tied to frames) to load my classes & such, but
    after that I'd like all of my code to be held in external class
    files.
    So maybe I've got:
    Interface.fla - My interface
    Button_1
    Button_2
    TextField_1
    Main.as - My main controller class using to handle all of my
    applications behavior
    SomeClass.as - Some helper Class
    SomeOtherClass.as - Some helper Class
    Main.as would have instructions in its initialization method
    to go ahead & attach events to buttons & initialize
    anything else that needs to happen when the application starts.
    From there on it would all be objects communicating back &
    forth. Button_1 would get clicked with would fire
    Main.someMethod(). Main.someMethod() would then do it's thing and
    set the value of TextField_1. All very clean & code is very
    separated from interface.
    Unfortunately I can't for the life of me figure out how AS3
    classes reference each other like that. There doesn't seem to be
    any kind of a global 'root' or '_root' I can use to locate any
    movie clips on the stage. I've searched the help & the web for
    any kind of simple tutorial but to no avail. My job has tasked me
    with building a flash app for a project but I'd really rather not
    have a tone of ActionScript just shoved into frame 1. That just
    seems... ugh! (::shudder::)
    Can someone maybe point me in the right direction here? I'm
    really willing to do my homework but I can't seem to locate the
    info I need to get started. Also, is there an ActionScript IRC
    channel or something maybe?
    Thanks,
    Cliff

    I worked with the problem last night and the solution I
    started coming to involved creating my own custom document class
    based off which extends MovieClip. My thought is that way I have
    access to the initialization routine of the timeline itself and
    that all of the elements on the main timeline should be
    "properties" of my custom class.
    Is this correct? Is there a down side to doing this & if
    so what is it & why?
    Also, just for my reference, the last time I did anything
    with ActionScript I think I was using '_root' to target the main
    timeline. WHat are the global variable names in AS 3? Is it just
    'root' & 'stage' or 'Root' & 'Stage' or what?

  • Control the property of an object in main stage from a loaded swf timeline

    please someone help me here, im loosing my mind
    i have a UILoader that loads an image from an xml list when you click its thumbnail ( in its thumbnails mc on mainstage aswell)
    thing is, i have another UILoader on the layer above that loads in a swf ( a slideshow that fades in and out the pictures when they change to the next,
    with all the coding on frame 1, frame 2 only has a stop and some code for when the mouse is idle for 5 secs it goes back to frame 1)
    so when you go to "portraits" it takes you to frame "x" where the slideshow ( loaded external swf ) starts playing automaticly right,
    if i click any thumbnail the slideshow goes to frame 2 ( wich is perfect and the mouse idle thing i wanted works great ) the ONLY THING IS
    after the slideshow runs by default for the first time ( i enter the category portraits )
    and i click any thumbnail ( moving slideshow swf to frame 2 enabling mouse idle event )
    and the mouse is idle ( so it does the event and starts playing the slideshow again ( goes back to frame 1 ) )
    I CANT MAKE THE UILOADER OF THE THUMBS IMAGE TO DISSAPPEAR!!!
    i have tried everything i can think of and everything i have read trying to adapt it with what i know,
    im no guru at this i reeeeally need some help
    THANK YOU  SO VERY MUCH ! 

    and where would i put the remove.simpleScreen ( simpleScreen is the loader i would want to remove )
    would it be on the external swf on frame 1 where the slideshow plays?
    or in the main timeline's category's frame?
    the problem ( that i see ) is that both loaders are on the same frame ( different layers tho )
    so if i put a the remove simplescreen there it wont show me the pictures when i click the thumbs
    or could i make it so that it removes it BECAUSE its playing on frame 1 ?

Maybe you are looking for

  • How to protect the SYS ID?

    Hi All, I have an application that allows a central application administrator - this ID in the application matches to an Oracle ID with no objects, but many rights. Since they need to reset regular user passwords this user gets granted the "ALTER USE

  • Entry Already exists in the follwoing table : Error

    SBO 2007A. System shows error while entering business partner customer or supplier group as " This entry already exists in the following tables 'Card groups' (OCRG) (ODBC -2035) kindly help as clinet is unable to create any of the business partner gr

  • Zen Touch - Unable to scroll

    I know this topic was addressed in an earlier thread, but I was unable to read the entire thread (see "Zen Touch- Can't Scroll Up!?!?). Hoping somebody can help me out My Zen Touch will not allow to scroll up. It even scrolls down when I want to go u

  • PRINTER USER NAME AND PASSWORD

    Pproduct:  HP Photosmart Premium c309a      OS: Windows 7   Error Message: Need printer's User Name and Password Trying to print from my iPhone I am asked for printer User Name and Password.  Where do I find them?

  • Unreachable Agent

    I'm new to the tool and have OEM installed on 1 server. The status of the 1 host I have an agent is "Agent Unreachable". I have ensured that an agent is running on the server. The agent appears to be running on port 1831. When doing emctl status agen