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

Similar Messages

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

  • How do I play a symbol timeline from the main timeline

    Ive created a box, turned it into a symbol called box,
    Inside box i have a left to right animation with auto play turned off.
    I then went back to the main stage, clicked the box, added action, on click to play, yet it does nothing.
    How do i Play the symbols timeline?

    On click handler for the symbol use
    sym.getComposition().getStage().getSymbol("nameofsymbol").play();
    or
    sym.getSymbol("nameofsymbol").play();
    replace the italics with the literal name of the symbol as it appears in the Elements panel.
    Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
    Darrell

  • Manage the mc timeline from the main

    Hi guys,
    I need to use gotoAndPlay with a timeline situated within a MC. So, how can I identify this timeline from the main one?
    P.S. could anyone advise me a good As 3.0 manual?

    Assign an instance name to the mc via the properties panel.  Let's say you name it "mc"... then to command that timeline from the main timeline you would use: mc.gotoAndPlay(?);

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

  • Attach a movieclip from the main timeline inside another movieclip.

    I need help with the game I am working currently. On the main timeline Actions frame I have a loader class called myLoader. I attached that to a movieclip called currentSWF. I have a movieclip called SpinningCard in the library which I dynamically attached to the stage. Inside the SpinningCard movieclip there is another movieclip Card. In the Card movieclip I have 10 frames and on each frame I want to attach a different instance of the movieclip currentSWF. How can I do achieve that?
    here's what I have till now...
    On the main timeline Actions frame...
    var loader:Loader=new Loader();
    loader.load(new URLRequest("CardGraphics.swf"))
    var currentSWF:MovieClip;
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
       function swfLoaded(e:Event):void {
       currentSWF = MovieClip(loader.contentLoaderInfo.content);
       addChild(currentSWF);
    Inside the Card movieclip on the first frame I have this code...
    var a1:MovieClip = MovieClip(parent.parent.getChildByName('currentSWF'));
    CardFrame1.addChild(a1);
    //CardFrame1 is an empty movieclip which is there on the frame 1 of Card Moveiclip.
    I am getting error : Parameter must be non-null. How can I solve. Can anyone please help me.

    Hi Nabren
    I'm also looking to load a library based movie-clip into a stage based movie-clip, so that I can inturn swap it with other movie clips to act as different pages (page2_mc etc) which will be used in different sections of the application to give chapters as such.
    I've had a go at the above but can't get a result, though it did not throw an error. I also had a trace() on each side and both of those triggered.
    The stage based mc I called pageMC and the content mc I called content the same as your example
    trace('loader - cx');
    var loader:Loader=new Loader();
    var pageMC:MovieClip;
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
    function swfLoaded(e:Event):void {
    pageMC = MovieClip(loader.contentLoaderInfo.content);
    pageMC.name = "pageMC";
    addChild(pageMC);
    trace("Menu 4");
    I'd appreciate some assistance. I would like to use internal MC's as I want to put the application to iOS and Android and believe by using movieclips I should be able to have some code with them whereas importing swf's I can't.
    Thanks

  • Targeting a nested mc timeline from a main timeline

    I have a main.fla which has 3 movieclips inside it. All 3 mc's have timelines that run 40 frames. The main.fla timeline has each mc instance on a frame.
    mc_1 is on frame 1
    mc_2 is on frame 40
    mc_3 is on frame 81
    as the main timeline plays the clips each one fades to the other.
    I need to know how to target this scenerio
    after mc_3 plays I need to have a goToAndplay (20) set up so the animation inside mc_1 starts playing (frame 20) of mc_1.
    the action needs to happen when the playhead reaches the last frame of the main timeline in main.fla
    any help?
    rdefr

    you want to play frame 20 of the main timeline and frame 20 of mc_1?  if so, on the last frame of your main timeline you can use:
    stage.invalidate();
    stage.addEventListener(Event.RENDER,f);
    gotoAndPlay(20);
    function f(e:Event){
    mc_1.gotoAndPlay(20);

  • Access a nested symbol timeline from the main stage

    Hi all,
    Would love some help on accessing a nested symbol from the main stage please.
    To set the scene.....
    "Its an autumn day..
    no sorry...just joking...
    So i have a symbol called "NormalAnatomy" - its not on the main stage, but when a button is clicked it appears in the 'content' box which is just a rectangle on the main stage.
    Inside "NormalAnatomy" symbol is another symbol called "Scrub_all" which is an animation
    For users to view the animation they use a scrub bar like this lovely lady has invented:
    Create Click and Touch Draggable Scrubbers with Edge Animate CC | sarahjustine.com
    So for Sarah Justines scrubber to work - the main stage has a lot of actions added to it. Also the "timelinePlay" symbol is on the main stage
    Its starts:
    var symDur = sym.getSymbol("timelinePlay").getDuration();
    var mySymbol = sym.getSymbol("timelinePlay");
    var scrubber = sym.$("scrubber");
    var bar = sym.$("bar");
    sym.$("mobileHit").hide();
    var dragme = false;
    So I put my "NormalAnatomy" symbol on my main stage to see if the code would work and changed all the relevant details.. and indeed it worked!
    var symDur = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all").getDuration();
    var mySymbol = sym.getSymbol("NormalAnatomy").getSymbol("Scrub_all");
    var scrubber = sym.getSymbol("NormalAnatomy").$("scrubber");
    var bar = sym.getSymbol("NormalAnatomy").$("bar");
    sym.getSymbol("NormalAnatomy").$("mobileHit").hide();
    var dragme = false;
    But i don't want the "NormalAnatomy" symbol to be on the main stage as I want it to appear in the 'content' box only when i hit a btn
    So as soon as I took this symbol off the main stage, the scrubber doesn't work. So I click a btn, and the symbol appears in the content box but the scrubber doesn't work.
    so I tried in front of the "NormalAnatomy"
    getStage().
    getStage("content").
    getComposition().getStage().
    getSymbol("content").
    but nothing works
    The main problem must be the fact that the NormalAnatomy symbol appears inside a content box so the MainStage actions doesn't know how to find it??
    So my question is... what should I put in the main stage actions to make it access the "NormalAnatomy" symbol?
    Thanks for your help in advance!

    On click handler for the symbol use
    sym.getComposition().getStage().getSymbol("nameofsymbol").play();
    or
    sym.getSymbol("nameofsymbol").play();
    replace the italics with the literal name of the symbol as it appears in the Elements panel.
    Some API details found here (http://www.adobe.com/devnet-docs/edgeanimate/api/current/index.html) in the Work With Symbols section.
    Darrell

  • Converting a layer on the main timeline into a movieclip

    I'm not really sure how to properly describe this so please
    bear with me.
    Say you create an animated action on your main timeline with
    a symbol. Then you decide you want to take that action and put it
    into a movie clip so that it migrates across the screen. Since it
    is already on your main timeline, how do you take that layer, and
    convert it into a movie clip?
    I hope I've described this clearly enough.

    Select all the frames on the layer, right-click on them and
    select copy frames. Create a new symbol. Right-click on the first
    frame of this new movieclip and select paste frames. Go back to the
    main timeline and delete the layer.

  • Convert a movie clip back to the main timeline? Help!

    I hope you guys can help me with this because this is a work project. Here's the situation:
    The entire .fla animation consists of nothing but two really long movie clips. Which are placed on frames 1 and 2 of the main timeline. Now for reasons that are too deep for me to go into explaination about my boss is telling me that I have to have everything main timeline -no movie clips. I've tried copypasting all of the frames but they all paste wayyy to large on the main timeline and they wind up in different places on the stage.
    How can I move all of the frames from my two movie clips onto the main timeline without everything breaking? Better yet - is there any way to just convert a movie clip into an .fla?

    you're on the right track.  note the x,y of your movieclip in frame 1.  create a new layer and paste all the frame 1 movieclip's frames into that new layer.  click the edit multiple frames icon below your timeline.  select all the frames, click an on-stage object.  in the properties panel, change the x,y of the all the selected objects to the previously noted values

  • Accessing the main timeline

    Hello,
    I have multiple instances of a movieclip (a1) within the main timeline.  These instances move around via tweening within the main timeline.  The instances also appear (are added) and disappear (are removed) while the main timeline is playing.
    Within the movieclip is this actionscript:
    (code)
    addEventListener(Event.ENTER_FRAME, ef);
    function ef(evt:Event):void
         trace(MovieClip(parent).currentFrame);
    (end code)
    As soon as an instance disappears... I get this typeError:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at test13_fla::a1_1/ef()
    The question then is - How can I access the main timeline from each instance (even when it is not currently on stage)?  Is this possible?  Any suggestions on how I can keep all of my code within the movieclip?
    Thanks in advance!
    -Jake

    Throughout the timeline the instances are in a motiontween followed by a blank keyframe. 
    To remove the event listener when it does dissappear I could do a addEventListener(Event.Removed, removeEventListenerFn);.... but I need a way to keep it.
    In my real project, each instance draws itself via drawRect and then put into a sprite and added to the main timeline.  Then within the event function (where it traces the maintimelines current frame)  I need all of the sprites to be removed when the main timeline gets to a certain frame#.  I know... confusing...
    I just need to find a way to access the main timeline while the instance is removed from the stage.
    If, for example, I did this...
    (code)
    addEventListener(Event.REMOVED, ef);
    var ccc:Number = 1;
    function ef(evt:Event):void
         trace("First Removed: " + MovieClip(root).currentFrame);
         addEventListener(Event.ENTER_FRAME, eg);
    function eg(evt:Event):void
         if(ccc < 10)
              trace("I am now removed");
         ccc++;
    (end code)
    ... I do not get any errors and I would get this in the output window:
    First Removed: 59
    I am now removed
    I am now removed
    I am now removed
    I am now removed
    I am now removed
    I am now removed
    I am now removed
    I am now removed
    I am now removed

  • Play a movieclip once, then go to the next frame on the main timeline

    Hello, I'm sorry for the long topic's title.
    I have an animation I'd like to use as an INTRO in my flash
    movie. I will joint it inside a movieclip, giving it the istance
    name "INTRO". And I position it in the first frame of the main
    timeline.
    How can I make possible that played once my intro (my
    movieclip) the player jumps to the second frame of the timeline,
    named by the istance "HOME".
    Is it possible?
    Thankyou very much for your help,
    and great things.
    Stebianchi

    on intro's first frame place:
    if(!this.played){
    _level0.gotoAndStop(2);
    and on its last frame place:
    this.stop();
    this.played=true;
    _level0.gotoAndStop(2);
    // or this.removeMovieClip(), if this is no longer ever used.
    and if you use this, you don't need the frame 1 code.

  • How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?

    on this link          http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
    I found this script, but I can not use it can anyone help me
    // create a variable to reference swf1's main timeline
    var swf1Main_mc:MovieClip;  // this assumes that swf1 is a movieclip.
    // create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a
    // reference to its main timeline (which is always the main timeline of the loading swf).
    this.addEventListener(Event.ADDED_TO_STAGE, initF);
    function initF(e:Event):void{
        swf1Main_mc = MovieClip(this.root);

    You don't make it clear what event finish is for. But let's assume that your MC is being loaded from the clip that you're referring to as root. In the main Document Class of that swf, you'd have
    protected var customSwf:CustomSwf;//customSwf is the Class that defines your functionInSwf1protected function someFunction():void {
         var loader:Loader = new loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE onLoaderLoaded);
         //rest of your loader loading code here
    protected function onLoaderLoaded(e:Event):void {
          //add to display list (you already know how to do, so I'm not writing the code)
         EventDispatcher(e.target).removeEventListener(Event.Complete, onLoaderLoaded);
         //if you had a legitimate need for path (which you don't) in mcExternal, you'd set it like this:
         this.mcExternal.path = LoaderInfo(e.target).content as MovieClip;
          //this is what you actually need to care about to do this correctly
          customSwf = LoaderInfo(e.target).content as CustomSwf;
    Now, the Class that you apply to the library symbol you're using for mcExternal should have code similar to this:
    protected function fEvent(e:Event):void {
         dispatchEvent(new Event('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', true));
    back in your main document Class:
    //should probably call from the constructor or somewhere early in the process
    protected function init():void {
         //use your real event name--your code isn't expressive enough I could guess a good name
         addEventListener('giveYourEventADescriptiveNameBasedOnWhatYoureReallyDoingHere', onEventHappened);
    protected function onEventHappened(e:Event):void {
         customSwf.customFunctioninSwf1();
         customSwf.changeVisualState();//let custom swf change alpha and change the frame #
    To the untrained I, this looks like about the same amount of code and slightly more trouble, but changing the design like this will make it much more tolerant of the changes that nearly all clients will want after you've built version 1. mcExternal's code doesn't have to change at all if swf1 changes, and your root Class already knows abotu swf1 anyway, since it's doing the loading, so having it work with it a little more doesn't hurt.
    Moving the change of visual state into your custom swf means that changes in that swf won't affect your main document Class, though you will probably have to recompile the main document unless you go to using an Interface (a topic for another day).

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

  • 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

Maybe you are looking for

  • HELP! My hard drive crashed, can I copy my iTunes library files to a new PC

    My hard drive crashed, but I attached it as a slave drive using an older PC and I can see all of my files but I can't start any programs (iTunes) from this slave drive. How can I copy iTunes music files and library to a removable drive, and then use

  • Encrypt/decrypt using update

    Hi, can someone give me an encrypt/decrypt pair of code samples that use the cipher.update() call. i am trying it like that but apparently it doesn't work byte[] temp = new byte[message.length/2]; byte[] temp2 = new byte[message.length/2]; System.arr

  • Hyperlinks in word containing spaces are cut off in pdf generation

    We are using a mix of MS Word 2003, 2007 and 2010. All are experiencing the same problem when using Adobe products (Abobe Acrobat Pro 9, Adobe X, Adobe Elements) for the generation of a pdf document with respect to hyperlinks. When we have hyperlinks

  • Don't know what to put in the "name" spot on login

    I was attempting to change my login settings so when the computer boots up, it shows my name and all I have to do is enter my password to gain access. However, I accidentally selected the option that says: Display login as: Name and Password instead

  • Moved Files "Not Authorized"

    Is there a step I am missing when copying new files to machines that are authorized to play my iTunes content? Currently my iTunes libraries are located on external drives. I have one for my desktop (G-Tech 2TB) and one for my MacBook Pro (iOmega Min