Communicating with main timeline symbols

Hi, i created a movieclip and exported it to Actionscript. I have a few instances of the new symbol(class) on the main time line and i have some
code on the class timeline. im trying to communicate with a movieclip instance that located in the main time line but for some reason im getting
an error. the name of the movieclip instance is mcGalleryWin. im pretty sure that the root keyword worked for me before in a similar situation
but for some reason its not workin now...
I tried to trace (root) from the class and i do get the main timeline.
code:
imageLdr.load(imageReq);
    imageLdr.contentLoaderInfo.addEventListener(Event.COMPLETE, firstImageLoaded);
    function firstImageLoaded(event:Event){
        root.mcGalleryWin.addChild(imageLdr);
error:
1119: Access of possibly undefined property mcGalleryWin through a reference with static type flash.display:DisplayObject.

thanks, it works....
how funny i tried to do that in a different way :
MovieClip(root.mcGalleryWin).addChild(imageLdr); but it didn't work....
anyway, thanks alot !!!

Similar Messages

  • Loaded SWF communicating with Main Timeline

    Let's say I load an external SWF to my main timeline. In that
    loaded SWF, I'd like to have a button that when clicked, removes a
    Movie Clip from the main timeline.
    How do I do that? Should be simple, right?

    Sorry I misunderstood your question, but here is the code.
    The second part is original swf altering a movie clip in the
    external (mov2.swf), just making an mc 50% transparent....
    circle_btn.addEventListener(MouseEvent.CLICK, printButton);
    function printButton(myevent:MouseEvent){
    var portLoader:Loader=new Loader();
    var printThumbRequest:URLRequest=new URLRequest("mov2.swf");
    portLoader.load(printThumbRequest);
    stage.addChild(portLoader);
    portLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loaded);
    function loaded(event:Event) {
    circle2_btn.addEventListener(MouseEvent.CLICK,
    talkToExternal);
    function talkToExternal(myevent:MouseEvent){
    event.target.content.green_mc.alpha=.5;
    }

  • Embedded symbol communicate with main timeline.

    hello one and all,
    i am creating a survey with say 7 questions.  each question has the same MovieClip symbol each with a different instance name, like q1, q2, ... q7.
    the MovieClip symbol has 5 static texts and 5 SimpleButtons.  i have some code in that symbol to make sure that only a single button has the "on" or "checked" state to show that that one is chosen.  this works great.
    my question is, how do i communicate each user choice with the main timeline after the user hits the "submit" button?  or, how do i have code under the "submit" mousedown event that can iterate through the 7 symbols to query each one and see which of the 5 SimpleButtons is "checked" or "on".  this iteration will then create a list of responses for all 7 questions.
    ultimately, i will have flash concatenate a GET POST string that will send the survey results to a web server.
    i am using/learning AS3 under flash cs4 and i know that i am somewhat new to these concepts.  thank you in advance and if you could point me to a tutorial video that will support your guidance, that would be helpful also.  happy new year.

    when using [] does not always mean array contents, but could mean accessor array which is what this is in this case.
    In the rarest form, every sprite or movieClip is an object and any class that is dynamic which in this case movieClip and object are, has enumerable properties.
    Enumerable properties can be accessed via ways of for( var prop:* in obj){} or for each .  This is a way  to traverse properties.  That is because they are in an object.
    If i created an object= new Object()
                            object.name='bob'
    i can access this variable name as thus trace(object.name)  or i could say object['name']  which treats the object as if it were a hash table with a key as a string to a look up table.
    this can not be done for properties that are not public.  and works best on dynamic classes.
    In this case your movieClip is just that and the this, refers to the scope of the object that holds the property name.  you can not use an accessor method without specifying a target.

  • Loaded swf with button , not communicating to main timeline

    my main stage/timeline has a UILoader "UILoaderOne" and
    another one "UIloaderTwo".
    i have some buttons on the main stage which pull up some
    images into the UILoaderOne.
    these work fine and look like this.
    //BEGIN BUTTONCODE\\
    //button to load image into loader "loaderOne" x01_btn and
    x01_ldr, thumb image is "x01.jpg and main image is p01.jpg\\
    //crop thumb image to size 50px tall by whatever wide and
    resize loaderButton if needed, main image will resize
    proportionatly\\
    x01_btn.addEventListener(MouseEvent.CLICK, onClick);
    function onClick(event:MouseEvent):void
    //import fl.containers.UILoader;
    import fl.controls.Label;
    import fl.controls.ProgressBar;
    var url:String = "assets/01.jpg";
    //var myUILoader:UILoader //= new UILoader();
    myUILoader.unload();
    myUILoader.autoLoad = false;
    myUILoader.source = url;
    //myUILoader.move(10, 10);
    myUILoader.scaleContent = true;
    myUILoader.load();
    var myProgressBar:ProgressBar = new ProgressBar();
    myProgressBar.source = myUILoader;
    myProgressBar.setSize(100, 10);
    myProgressBar.move(myUILoader.x+340, myUILoader.y+250)
    myProgressBar.addEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    myProgressBar.addEventListener(Event.COMPLETE,
    completeHandler);
    addChild(myProgressBar)
    var myLabel:Label = new Label();
    myLabel.text = ". . . . . X . . . . . ";
    myLabel.autoSize = TextFieldAutoSize.LEFT;
    myLabel.move(myProgressBar.x, myProgressBar.y +
    myProgressBar.height);
    addChild(myLabel);
    function progressHandler(event:ProgressEvent):void {
    //trace("progress:", event.bytesLoaded, event.bytesTotal,
    int(event.currentTarget.percentComplete) + "%");
    //myLabel.text = event.bytesLoaded + " of " +
    event.bytesTotal + " bytes loaded.";
    myLabel.text = ("progress:", event.bytesLoaded,
    event.bytesTotal, int(event.currentTarget.percentComplete) + "%")
    //myLabel.text =
    Math.round((event.bytesLoaded/event.bytesTotal)*100) +"%";
    function completeHandler(event:Event):void {
    trace("complete:");
    myProgressBar.removeEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    myProgressBar.removeEventListener(Event.COMPLETE,
    completeHandler);
    removeChild(myProgressBar);
    removeChild(myLabel);
    //addChild(myUILoader);
    //trace("typeMe");
    //end BUTTONCODE\\
    //end BUTTONCODE\\
    the second Loader "UILoaderTwo" auto loads another swf file
    with the INTENT to load from buttons, images into the ULLoader
    "UILoaderOne" which is on the main timeline.
    this part is failing
    the error i get in Output window is
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    at sOne_fla::MainTimeline/onClickz()
    the swf that loads is sOne.swf
    and it has code of this
    z01_btn.addEventListener(MouseEvent.CLICK, onClickz);
    function onClickz(event:MouseEvent):void
    import fl.containers.UILoader;
    import fl.controls.Label;
    import fl.controls.ProgressBar;
    var url:String = "assets/xx.jpg";
    var myUILoader:UILoader //= new UILoader();
    myUILoader.unload();
    myUILoader.autoLoad = false;
    myUILoader.source = url;
    //myUILoader.move(10, 10);
    myUILoader.scaleContent = true;
    myUILoader.load();
    var myProgressBar:ProgressBar = new ProgressBar();
    myProgressBar.source = myUILoader;
    myProgressBar.setSize(100, 10);
    myProgressBar.move(myUILoader.x+340, myUILoader.y+250)
    myProgressBar.addEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    myProgressBar.addEventListener(Event.COMPLETE,
    completeHandler);
    addChild(myProgressBar)
    var myLabel:Label = new Label();
    myLabel.text = ". . . . . X . . . . . ";
    myLabel.autoSize = TextFieldAutoSize.LEFT;
    myLabel.move(myProgressBar.x, myProgressBar.y +
    myProgressBar.height);
    addChild(myLabel);
    function progressHandler(event:ProgressEvent):void {
    //trace("progress:", event.bytesLoaded, event.bytesTotal,
    int(event.currentTarget.percentComplete) + "%");
    //myLabel.text = event.bytesLoaded + " of " +
    event.bytesTotal + " bytes loaded.";
    myLabel.text = ("progress:", event.bytesLoaded,
    event.bytesTotal, int(event.currentTarget.percentComplete) + "%")
    //myLabel.text =
    Math.round((event.bytesLoaded/event.bytesTotal)*100) +"%";
    function completeHandler(event:Event):void {
    trace("complete:");
    myProgressBar.removeEventListener(ProgressEvent.PROGRESS,
    progressHandler);
    myProgressBar.removeEventListener(Event.COMPLETE,
    completeHandler);
    removeChild(myProgressBar);
    removeChild(myLabel);
    //addChild(myUILoader);
    //trace("typeMe");
    //end BUTTONCODE\\
    //end BUTTONCODE\\

    well, I'm such a novice to begin with.
    the loader is actually placed on stage manually, and instance
    named manually so a lot of that code is may not be needed,
    i do a lot of trial and error technique
    it is all personal stuff
    one guess i have is to set up a listner as to when the sOne
    is loaded, and then get a way to communicate to each other?
    how?

  • Symbol to call back on the main timeline with Label?

    Hi,
    I have a symbol called Panel_1. When it slides out, I have a button inside to call out to Panel_2.
    I created Panel_2 on a main timeline (only 1 frame) using a Label called "Label_2".
    This code doesn't work with I click.
    sym.getComposition().getStage().sym.play("Label_2").play();
    Any idea how to fix the code?
    Thx.

    You need to remove the second sym in the code.
    On Thu, Jan 8, 2015 at 2:56 PM, iamvichai <[email protected]>

  • How do I set a variable on the main timeline from within a symbol?

    Just getting started with Animate and coming to it from Flash, as may be apparent from my question. How do you set a variable to the main timeline from within a symbol?
    I have 24 pairs of clickable elements, each in their own symbols, and all 24 of those symbols sit inside another symbol. I want all 24 to be able to set the same global variable when clicked. I can't find that this question is addressed anywhere, which makes me think I may be stuck in a Flash mindset and approaching the task in the wrong way. (There are however MANY discussions of how to address objects at different levels in the hierarchy. That's well covered.)
    Relatedly, how do you access a function on the main timeline from within a symbol?
    Adobe should consider putting together a support page (or pages) just for folks migrating form Flash. In the materials I've encountered so far there seems to be a studied effort to refrain from mentioning Flash in any way. I imagine there are a lot of people out there like me who have a deep background in Flash coding, but are just getting started with Animate. We don't need help with most of the basic concepts, but we may still have some pretty basic questions about how to accomplish some things in Animate because our Flash knowledge is getting in the way.

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • How to control the main timeline from within a symbol?

    I have a small world map as a symbol called "verden" and I want the user to click Europe, Asia, or Africa and jump to named labels in the main timeline.
    http://www.dagbladet.no/grafikk/neshorn/neshorn.html
    On the main timeline a have the label "intro" with a Stop action and the label "europa". At label "europa" I have a symbol also called "europa" which has a display of None at label "intro" and On at the label "europa".
    The animation never goes to label "europa"
    I have this code on europa in the symbol "verden" :
    // insert code for mouse click here
    sym.getComposition().getStage().getSymbol("europa").play("europa");
    The files are on Dropbox here
    Update, now it works:
    sym.getComposition().getStage().play("europa");

    Hi Bill,
    There are plenty of threads on here about scope, but here's one way to create a global variable:
    // code on Stage.compositionReady
    sym.myGlobalVar = 1;
    Then, anywhere in your project, you can check/set that var like so:
    sym.getComposition().getStage().myGlobalVar = 2;
    And here's one way to create a global function:
    // code on Stage.compositionReady
    sym.myGlobalFunction = function(){
              console.log('myGlobalFunction');
    Then, anywhere in your project, you can call that function like so:
    sym.getComposition().getStage().myGlobalFunction();

  • 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

  • GotoAndPlay with a _mc on the main timeline

    Hello this is my first post here. Thank you in advance for any help.
    I am trying to use a button on frame 1 to go to a movie clip that is on frame 1018 ( i put the movie clip on the main timeline on frame 1018)
    so main(root) --> 1018 --> shipattack_mc ---> "endtest"
    I have tried using these commands and a few variations of the same thing.
    _parent
    this.
    shipattack.gotoAndPlay('endtest")
    gotoAndPlay("endtest")
    My main timeline ends at 1018 with a stop() and the movieclip "shipattack_mc" plays out its 1000 or so frames.
    I am testing some things towards the end of the shipattack and want a button to skip to the end. Thanks.

    Thankyou for the quick reply, it is working perfectly. Odd that my flash instructor couldn't figure it out though.
    Is this a Formal forum? It seems that you answer most of the questions... I was under the impression that it was random community members that contributed. I'm a bit reluctant to repost futher issues.
    skip_btn.onRelease = function()
        stopAllSounds();
        _root.sevenclans1.start(60,0);
        trace("shipattack_mc").shipattack_mc;
        _root.gotoAndStop("end");
        shipattack_mc.gotoAndPlay(800);

  • 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

  • Symbol graphic won't move in main timeline?

    (I just bought Flash and am a beginner please forgive me.)
    I've made a symbol, a graphic, of a character's eyes blinking a few times, shifting position, then blinking and moving back. It moves fine and looks okay in the symbol's timeline, but when I play it in the main timeline, the blinking works but it refuses to shift places, it just bounces back and forth. I tried making it a motion and classic tween, (instead of having it move through several keyframes as I started with.) Does anyone know why this may be happening? Thanks everyone.

    If you are trying to tween a raw drawn graphic (not a symbol from the library) that might be the problem.  In order to do a motion tween you need to be using a symbol... a graphic, movieclip, or sprite symbol.

  • Control multi symbol on main timeline ???

    0down votefavorite
    Control multi symbol on main timeline for play movie1(symbol1) finish then play movie2(symbol2) finish and loop again on Edge Animation !!!
    My issuse is after movie2 finish movie1 not play again ????
    http://speedy.sh/BdTAx/edgeBanner442.zip
    MY Code
    //======= State ===================//
    //===== CompisitionReady
    sym.$("mv2").hide();
    sym.getSymbol("mv1").play();
    //======= Movie1 ===================//
    //====== Trigger 0 ms
    sym.stop();
    //====== Timeline.compleate
    sym.getComposition().getStage().$("mv1").hide();
    sym.getComposition().getStage().$("mv2").show();
    sym.getComposition().getStage().getSymbol("mv2").play();
    //======= Movie2 ===================//
    //======= Trigger 0 ms
    sym.stop();
    //======= Timeline.compleate
    sym.getComposition().getStage().$("mv2").hide();
    sym.getComposition().getStage().$("mv1").show();
    sym.getComposition().getStage().getSymbol("mv1").play();

    Thank for you help.
    Also If  I want to create my custom  function with paramiter  where   I  can create ??
    //======= Below is normal code generate from edge animation in empty file
    (function($, Edge, compId){
    var Composition = Edge.Composition, Symbol = Edge.Symbol; // aliases for commonly used Edge classes
       //Edge symbol: 'stage'
       (function(symbolName) {
       })("stage");
       //Edge symbol end:'stage'
    })(jQuery, AdobeEdge, "EDGE-401683841");
    ps.  if  I have more movie...I want to creat function to command show& hide Symbol when it not play .
            can you giveme sample ?

  • My movie symbol not working in main timeline

    The symbol works in its own movie timeline, the keyframe length is the same length on both the movie symbol timeline and the main timeline.
    But movie symbol refuses to play on the main timeline.
    Any ideas?

    If it is a movieclip symbol, it doesn't need to have any more than one frame in whatever timeline you place it in to be able to play in its entirety.  What controls are you using to make it play?  Does the movieclip have any stop() command in its first frame(s)?

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

  • Problem with nested button controlling main timeline...

    I am new with as3, i like it, but I am suffering
    After I looked on google for trying to figure out my problem I attempt to post here...
    to make it simple, I have a loader that is loading some swf(a scrolling content), with some content, in those swf I am trying to put a "close" button and some other like  next/prev. But no way... normally I thought that the MovieClip(root) would make it but it's seems not to be enough.
    code of the swf:
    var btnclose1:btnclose = new btnclose();
    this.addChild(btnclose1);
    btnclose1.x = 770
    btnclose1.y = 55;
    btnclose.addEventListener(MouseEvent.CLICK, closearchi)
    function closearchi (e:MouseEvent):void {
    MovieClip(root).gotoAndStop(1);
    Thanks by advance...

    Hi Ned,
    Actually, I just saw than the problem come from the timeline itself, but I don't see what to do...
    on the frame 1 of the main timeline, it is loading an empty swf into my container"box":
    var myLoader:Loader = new Loader();
    var myURL:URLRequest = new URLRequest("empty.swf");
    myLoader.load(myURL);
    box.addChild(myLoader);
    on frame 2 I have the first content and so on:
    function loadarchi():void
    var myURL:URLRequest = new URLRequest("archi.swf");
    myLoader.load(myURL);
    loadarchi();
    I did a simple button on the main just for testing purpose, telling him to go to frame 1, it doesn't unlod the content ! there is the problem!
    what is wrong with that? it shoul load the empty swf instead of archi...
    thanks again

Maybe you are looking for