Using an mc to control the main timeline with multiple scenes

OK, I have a main timeline that has 27 different scenes.  I have a movie clip that is an "on call" navigation menu for the main timeline.  I can call the menu once, and it will go to the first place I want it to go.  However, I cannot seem to figure out how to get it to go away to be able to call it again.  I get the "must be child of caller" error.  Any thoughts on how to get rid of it each time I use it?

A button is clicked which calls the following AS3 code:
MovieClip(this.root).addChild(myMenu);

Similar Messages

  • Toolkit for CreateJS: How to control the main timeline from outside the canvas.

    Hey Everyone,
    I'm currently trying to do something simple, but my animation breaks whenever I attempt to change my code. I have created a basic animation in Flash where an object moves from the left side of the canvas, to the right, and then loops from the last frame to the first frame. Nothing else. The animation is simply put on the main timeline. I exported the animation with Toolkit for CreateJS through Flash's extension and the animation runs as it should. I am trying to start and stop (restarting from the first frame) the animation with mouse over and mouse off events. I want the events to fire when moused over/off a div OUTSIDE the animation's canvas tag. Is this possible with CreateJS? I'm trying to figure out how to control the main timeline without being inside the canvas tag.
    Example HTML:
    http://www.thephotoncore.com/testing/example_test.html
    Example Code:
    <section id="container">
      <canvas id="canvas" width="550" height="400" style="background-color:#cccccc"></canvas>
      <section id="animation_control">
        <p>Roll over to start and stop animation.</p>
      </section>
    </section>
    Thanks again for the help!
    -DJ

    Hi DjPhantasy5,
    All movieclips on the stage are children of the stage,
    So on the "mouseover" all movieclips on the stage could be stopped with stop and on the "mouseout" all children could be restarted with gotoAndPlay like this:
    function Stop()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("stop" in child)
                                            child.stop();
    function Restart()
              if (stage && stage.children)
                        var i, l = stage.children.length;
                        for (i = 0; i < l; i++)
                                  var child = stage.children[i];
                                  if ("gotoAndPlay" in child)
                                            child.gotoAndPlay(0);
    See http://www.liauw.nl/forums/adobe/djfantasy5/index.html
    But it is also possible to expose "ball1", for example, by adding it to the document.
    This can be done by adding code to "ball1" like so:
    /* js
    document.ball1 = this;
    Then the stopping of the animation would look like:
    function Stop()
         if ("ball1" in document)
              document.ball1.stop();
    etc.
    Have fun!
    Ronald

  • 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();

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

  • Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    Using Flach CS4 and action script 2.0 how do I advance to a specific frame of the main timeline when a movie clip instance come to the end of its timeline?

    code on the last frame of your movieclip instance:
    _root.gotoAndStop('whatever_frame');  // will work unless this swf is loaded into another swf.  in that situation, you should use a relative path to the main timeline (eg,  _parent or _parent._parent etc).

  • How can I reference the main timeline on a swf once it was loaded into another?

    I have an swf with some custon animation functions using actionscript 3. I'm refering to the main timeline with Movieclip(root) and it works just fine.
    However, this swf is going to be loaded inside another (a custom player), and when that happends, everything stops working.
    I think it's because the Movieclip(root) is now referencing to the loader swf and not the loaded anymore, but I just can't find any information on how to fix that.

    This is basically what I´m doing here:
    I'm placing this code on frame 1, and calling the function textAnimate() whenever I need to insert some text.
    // This is a variable I created for tracking the timeline
    var base:MovieClip = MovieClip(root);
    function textAnimate(movieName:String, espera:Number):void {
              //var espera:Number = 1; //Waiting time
              var objeto:MovieClip = base[movieName]; //Variable to select the object
              var posFinal:Number = objeto.x; // Object position
              var posEnter:String = "-160"; // Animation start (relative)
              var posExit:String = "+160"; // Animation end (relative)
              // enter animation
              TweenMax.from(objeto, 1, {x:posEnter, alpha:0, blurFilter:{blurX:40}, ease:Back.easeOut});
              //call exitAnimation() after X seconds
              TweenMax.delayedCall(espera,exitAnimation);
              //exit animation
              function exitAnimation() {
                        TweenMax.to(objeto, 1, {x:posExit, alpha:0, blurFilter:{blurX:40}, ease:Back.easeIn});
    The swf works fine, but once it´s loaded into the player, nothing works anymore. Unfortunately, I don't have the code for the player, and can't change anything about it... :/

  • Targeting the main timeline

    Trying to make the switch from AS2 to AS3 and like many
    before me, becoming confused.
    I've laid out three movieClips on my main timeline (named,
    "main") and spaced them five frames apart, nice and tidy, like I
    like to do. Each frame on the main timeline containing a movieClip
    has been given a unique frame label. My problem is, I want to have
    the movieClips jump to the next targeted movieClip on the main
    timeline after clicking a button, or upon entering the last frame
    of its predecessor, in some cases. In AS2 the was easy to do this
    was by using the gotoAndPlay function and targeting to the_root
    timeline. Now I can't figure out what to do. I can make any button
    inside a movieClip target a specific frame within that same mc, but
    cannot make a jump to the main timeline to play the next movieClip.
    What am I missing here? I'm a noobie at AS3 and fumbling my
    way forward. (should be obvious now) Is there a simple way to refer
    back to the main timeline, which is only one level up? What am I
    missing?
    Here's as far as I got with the AS3 code within the mcs:
    stop();
    cont5_mc.addEventListener(MouseEvent.CLICK, onClick2);
    function onClick2(event:MouseEvent):void
    trace("test");
    cont5_mc.buttonMode = true;
    The trace function runs true so it's a matter of telling the
    player how to get to the main timeline and frame label.
    TIA for your help, all you flashy genius . . . Speak to me
    like I am a three year old. -grin-
    thokitts

    kglad:
    Thank you for your instant reply. I see you sent it out last
    night. Really appreciated. Got my button in movieClip1 to refer
    back to movieClip2 on the main timeline with your help but now am
    presented with the issue of having the last frame of movieClip2
    automatically taking the viewer back to the main timeline to begin
    playing movieClip3, located on frame label "gsm".
    Again, I know this should be easy, but conceptually I am
    having a problem with how to do this. I don't have a button to
    attach the AS3 to and this new syntax is confusing to me. Nor do I
    want this to be a button based decision on the viewer's part. How
    do I attach this automatic jump back to the main timeline, frame
    label "gsm"? By an enterFrame event, which seems old school AS2? or
    stage.addEventListener? Is enterFrame even the way to do it
    anymore?
    Lynda.com tutorials are great but I'm struggling with this.
    TIA
    Thomas

  • Controlling a Movie Clip on the Main Timeline from a loaded SWF?

    Is it possible to control a MovieClip on the main timelne from another loaded clip?
    I see posts that control loaded clips, but most are all from the loader in the main timeline.  I have a moviclip on the main timeline that I want to make visible or invisible depending on what keyframe is playing in another loaded swf.
    If I try to call the movieClip from the loaded SWF I get "error #1119.  Access of possibly undefined property...." because it doesn't exist in the loaded SWF, just the main timeline. 
    The old AS2 way just used "_root".  Since "_root" doesn't exist any more, how do you control items on the main TimeLine from a loaded SWF?

    I am not clear what you mean because you are saying you are trying to target a movieclip that does not exist where you are trying to target it.
    Try using a trace to see what you are targeting when you you target the MovieClip(parent.parent)....
    trace(MovieClip(parent.parent));
    The other approach I mentioned earlier is the more OOP-correct approach if you would rather try that way.  Here's a rough outline of it...
    AS3 - Dispatch Event
    http://forums.adobe.com/thread/470135?tstart=120
    Example:
    Add something to trigger the event in the child (your loaded swf):
    dispatchEvent(new Event("eventTriggered")); (
    if dispatchEvent problem, see: http://www.kirupa.com/forum/showthread.php?p=1899603#post1899603)
    In your loading/parent swf, listen for the complete event on the Loader.contentLoaderInfo.  In the complete event handler, add a listener for the event on the loaded swf.
    // event handler triggered when external swf is loaded
    function loaderCompleteHandler(event:Event) {
        MovieClip(event.currentTarget.content).addEventListener("eventTriggered", eventHandler);
    function eventHandler(event:Event):void {
        trace("event dispatched in loaded swf");
       // this is where your main file can set the visible property of your movieclip

  • Using cue points to trigger events on the main timeline...

    Hi--
    I have successfully placed an flv (video) file (progressive
    download) on the main timeline of my movie with controls to play
    and pause (Flash 8 Professional). So far, so good!
    NOW TWO PROBLEMS: Does anyone know how to set it up so that
    when a specific cue point is reached in the video, it triggers an
    action on the main timeline? In this case, once the video is over,
    I want the main timeline to gotoAndPlay frame 3. Specific script to
    do this would be great!
    The other action I'd like to happen is that when the video
    begins, it targets a scrolling text mc ("text") in the main
    timeline and tells it to gotoAndPlay frame 2.
    Any advice would be GREATLY appreciated!!! Many
    thanks!!!

    I usually start off solving problems with the livedocs, as I
    recommend for anyone. The following link will take you to the
    NetStream.onCuePoint handler. This is what you need.
    http://livedocs.macromedia.com/flash/8/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context= LiveDocs_Parts&file=00002561.html
    You can have this code on the main timeline. When the
    cuepoint is hit, it will invoke this event handler and inside is
    where your gotoAndPlay( ) should go.
    Your other question about the text will get activated by the
    same handler. Just have a conditional statement (if, switch, etc.)
    to differentiate between the two events. The text itself can be
    mask inside a movieclip.
    Does this help?

  • Control a mc timeline from the main timeline

    Hi there,
    On my main timeline, I load a mc from the library with:
    text_content.attachMovie("text_content", "text_content", 10);
    There is a marker inside this mc called "news". I need a script in the main timeline that will gotoandStop "news" within the "text_content" mc.
    I have tried, amongst others unsuccesfully:
    text_content.gotoAndStop("news", 10);
    _level10.gotoAndStop("news");
    Can anyone tell me how to fix this?
    Many thanks

    Hi, thanks for your help. To describe the scenario a bit better...
    I have an empty mc on the stage called "text_content_mc".
    On the first frame of the main timeline, I load a library mc 'text_content' (identifier name: text_content) into "text_content_mc" using:
    text_content_mc.attachMovie("text_content", "text_content", 10);
    From the main timeline, I have attempted to navigate to marker "news" within the library mc, now inside "text_content_mc" using:
    text_content_mc.text_content.gotoAndStop("news");
    It is not working. What I am doing wrong?
    Hope this makes sense. Thanks.

  • Use timeline of a nested mc to affect the main timeline

    Hi I have a magic cloud effect. On frame 30 of the nested effect I would like an mc on the main timeline to become visible.
    Not too sure how to code with frame numbers,
    a) Do I put AS on the timeline of the nested clip OR
    b) Write code on the main timeline to listen for when the nested mc gets to frame 30
    Cheers

    Hi
    I got to the bottom of it.
    As you say really bad practise to bury code - had enough of that in AS2 and template monster.
    Realised that you could do all this from the main time line and therefore have everything visible.
    import flash.events.*;
    hero.visible = false;
    cloud.addEventListener(Event.ENTER_FRAME, handler);
    function handler (e:Event) {
    if (cloud.currentFrame == 21) {
    hero.visible = true;
    THANKS

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

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

  • How to call a function in a class from the main timeline?

    Hey Guys
    I have a project in Flash with four external AS files, which are linked to items in the library using AS linkage.
    What I want to do is call a function in one of these files from the main timeline, how would I go about doing this? I'm not currently using a document class, most of the code is in Frame 1 of the main timeline.
    Thanks

    // change type to the class name from the instance
    ClassNameHere(this.getChildByName('instance_name')).SomeFunction();

  • Moving to a frame in Movieclip timeline from the main timeline

    I am in the learning process. Working with FlashCS5 and AS3.
    Please bear with me if the issue appears to be too simple for you. Placed a movieclip(mcassessJohn) on the main timeline and moved to the frame labelled "johnFeedback" in the movieclip timeline using the following actionscript code.
    mcassessJohn.addEventListener(MouseEvent.CLICK, onJohnClick);
    function onJohnClick(evt:MouseEvent):void {
       mcassessJohn.gotoAndPlay("johnFeedback");
    This works fine. However problem starts when I place a button "questionJohn" in the movieclip(mcassessJohn) time line at frame "johnFeedback" and try to move to another frame by clicking the button and using the following actionscript code;
    questionJohn.addEventListener(MouseEventClick,onClick);
    function onClick(evt:MouseEvent):void {
      gotoAnd Play("johnFeedback");
    Placed the above code in actions layer in the movieclip timeline at frame "johnFeedback". I had placed the button also in the movieclip timeline at Frame "johnFeedback in layer buttons. No compiler error.No runtime error. Just nothing happens when I click on the button "questionJohn".
    Would appreciate if you can let me know where I am going wrong.

    Thats because if u assign the listeners to a parent movieclip it will not pickup listener assigned to its child.
    A work around is put a invisible btn inside mcassessJohn movieclip on frame 1 and assign onJohnClick function to that.
    And one more thing, i think u r trying to perform same operation on both the btns
    http://www.darshanrane.com

Maybe you are looking for

  • Distributing multiple versions of an app within a single Windows Store app

    The company I work for creates Point Of Sale (POS) software using Software As A Service (SAAS), so we host our clients' databases.  We do not force all of our clients to all be on the same version of our software; i.e. some clients are on version 3,

  • Shift+scroll no longer scrolls left and right!!

    I have a logitech mouse w/ a scroll wheel I have always been able to hold down shift to get the scroll wheel to scroll left and right instead of up and down and it's suddenly stopped working and I have no idea why can anyone help?

  • XI Mail Adapter TXT file as attachment

    Hi, I am using Mail Receiver adapter to receive data from Sender ABAP Proxy.The attachment file contains data with all Labels, i used in the Target Message Type. <?xml version="1.0" encoding="UTF-8"?> <ns0:XogisticsOB_MT1 xmlns:ns0="http://selectcomf

  • PDF PRINTING using Apache FOP and Oracle Containers for J2EE

    Hi, I am having major confusion about the pdf printing in Oracle XE and Apex 3.1.2.00.02 It clearly states that this is an available option on the Oracle website. According to Apex there are two options for printing report regions. Standard - which i

  • I can't install a extension.

    I can't install a script(extansion) because it sayis it seems corrupt, but i know it's not. How do i install it ? please help