Targeting the main timeline of in a MC

Hello all, I have this project that basically works like a slide show. I'm doing things common sense and avoid scenes so I am building each slide as a separate and then mc placing them on the main timeline. What I'm trying to do is get the playhead to move forward on the main timeline to the next image once the mc reached its last picture. I found code that works, but it looks pretty ghetto:

var _root:MovieClip = MovieClip (root)

stage.addEventListener (Event.ENTER_FRAME, Text2);
function Text2 (myevent:Event): void {}
_root.gotoAndStop ("slide2");
}

I guess I have two questions:

1. What is the right way to target a frame on the main timeline of in a mc in as3?

2. the way I do build does make sense, or is there a better solution?

Thanks for reading!

This code is an accident waiting to happen.  An ENTER_FRAME event is raised repeatedly, at the rate of the file.  This does not mean that it looks like... such As... When something enters a ' framework' everything you need instead of this code is to put the following line in the last image of the mc...

MovieClip (root) .gotoAndStop ("slide2");

Since you asked on 'clean'... children should not talk back to their parents and tell them what to do.  The good news is that they should be independent and care only for doing what they do. It is the parent to keep an eye on the kids if they are so trend.  The only thing they should do is to know when they are made to the world the fact.  This is done by sending an event.

If what you're doing are implemented the child to dispatch an event to indicate that they are doing what they are doing (in the last image in your case).

dispatchEvent (new Event ("imDone"));

and set up a listener for this child object in the parent of the parent timeline to listen to this event...

childName.addEventListener ("imDone", eventHandler);

function eventHandler(event:Event):void {}
gotoAndStop ("slide2");
}

Tags: Adobe Animate

Similar Questions

  • Targeting of evil to a button on the main timeline for a VideoEventComplete at work

    I have a .fla file that has buttons on the main timeline that target frames in a mc named 'pages' in a table.  The 'pages' are implemented in the form of frames each five images or as a slide show where the buttons advance or return to the previous page.  I want to make invisible buttons until frame 30 video is complete (page 4).  When I insert the code below in the main timeline, the button becomes invisible, but there is no event that will finish to come back only to show the button so it sits right there with no way to advance as the buton is invisible,

    Then... How to target the button to only be invisible when it has an event video complete but not not start before 30 (page 4) image of the mc and then do it again in the 35 framework etc.

    I tried to put it in the main timeline and on the frame of the first video.  If I'm on it within the pages don't need to point the code on the main timeline to get code know where are the buttons? Something like main_timeline.nextbtn etc... ?

    The code in the settings:

    Stop()

    Import fl.video.VideoEvent;

    THIS BUTTON IS LOCATED IN THE MAINTIMELINE\\
    nextBtn.visible = false;
    addEventListener (VideoEvent.COMPLETE, doNextFrame);

    function doNextFrame(e:VideoEvent):void {}
    nextBtn.visible = true;

    pages.nextFrame)
    }

    All the code is:

    THE CODE of the MAIN SCENARIO is:

    Listeners of button

    import of flash.media.SoundMixer;// it comes to the


    nextBtn.addEventListener (MouseEvent.CLICK, nextSection);
    prevBtn.addEventListener (MouseEvent.CLICK, prevSection);

    ///////////////////////////////////////////////////////////////////////////

    function nextSection(event:MouseEvent):void {}

    var thisLabel:String = pages.currentLabel; Gets the current image under chain tag
    var thisLabelNum:String = thisLabel.replace ("sct", ""); cut the main letters off the number
    var curNumber:Number = Number (thisLabelNum); Converts this string to a real number number
    If (curNumber < 18)

    {

    var nextNum:Number = curNumber + 1;
    pages.gotoAndStop ("sct" + nextNum);

    }

    SoundMixer.stopAll (); Place it inside your functions

    }
    ///////////////////////////////////////////////////////////////////////////
    function prevSection(event:MouseEvent):void {}

    var thisLabel:String = pages.currentLabel; Gets the current image under chain tag
    var thisLabelNum:String = thisLabel.replace ("sct", ""); cut the main letters off the number
    var curNumber:Number = Number (thisLabelNum); Converts this string to a real number number
    var prevNum:Number = curNumber - 1; subtract 1 from the number, so we can go to the next image tag
    pages.gotoAndStop ("sct" + prevNum); This allows us to go to the previous image tag

    SoundMixer.stopAll (); Place it inside your functions


    }

    Please Note: it started in a previous discussion, but I think that I was confused that the question so go fresh here, thank you so much for the time on this

    I can't say I'm immune to be confused by the story you tell, but I'll take a stab to offer what could be a solution.  If the buttons are in the main scenario and the code that you want to make visible with in a movieclip which lives on the main timeline, then you can target the buttons from inside and using movie...

    MovieClip (parent).nextBtn.visible = true;

    MovieClip (parent).prevBtn.visible = true;

  • How to target button in movieclip on the main timeline

    Hello!

    I have a few buttons of submenu in a movieclip in the mainline. My first level of navigation in the main timeline. The submenus are grouped into movieclips on the main timeline. I basically used the same code on the main navigation for the navigation sub except the code for the submenus is located in this movie clip. My instruction trace bed button is clicked (which was a quantum leap for me) but I know that I need some kind of code _parent in there so that he knows to go to the label back on the main timeline. Can anyone help? I feel like I'm so close.

    Also is this a correct way to set-up? I couldn't figure out how do it in an image. Any help would be so appreciated. I didn't know that this basic framework would be so difficult.

    Here is the link:

    http://www.sandraschmitt.com/Coclico/index2.html

    Thank you!!
    Sandra

    Here is my code which is on the movieclip submenu:

    Code:
    stop();

    fall.addEventListener(MouseEvent.CLICK, clickSection);
    spring.addEventListener(MouseEvent.CLICK, clickSection);

    function clickSection(evtObj:MouseEvent){
         //trace shows what's happening... in the output window
         trace ("The "+evtObj.target.name+" button was clicked!")
         //go to the section clicked on...
         gotoAndStop(evtObj.target.name);
    }

    One of the reasons that I never won any price for my vision of the design are because I am often... If it works, use it.  There are many ways to approach a design and yours is very good if you understand.  If she was going to smash something, it would have happened now.  Some people don't go to the extreme of having absolutely no code in a file, some even no content library, he wrote everything in files and class not by necessity, but to simply believe that it is the best way, or a challenge to prove their skills...  They have the it.  He participates a practicality with design that allows to make Judgment calls and if you feel that your approach to design is convenient for what you understand or which meets the needs of the project, then you have the right to follow your own path.

    That said... in the case where a person must inherit from your work somewhere down the road, that's when your approach can be victim of judgment... If someone can not follow, either found it difficult to put all the pieces together, or find them, then you become the contact person for the moans fall that follows.  But you're not likely to have to hear about it.  Yet, one day, if you are in a position where you inherit a person guestroom... and start whining about how they did it, you will come to appreciate the reasons to consider how approach you your designs.

  • Access a MovieClip in the main timeline of an external class

    Hello


    I've been struggling with the same question for a few days now, and I don't know it can be easily solved - I have just found a way that works for my case


    Basically I have a series of clips on the main timeline, the name "S1B1' to 'S5B8' as a result. I would like to add to a table in a separate category called "BeatArray".


    For the moment, I found no referencing the MovieClips from the separate class file that works, and I tried many different methods (including adding MovieClip (root). before each one and various other things).

    It's probably worth noting that the external class has already extends MovieClip.


    Any help is greatly appreciated!


    See you soon

    When you instantiate the outer class passes a reference to the main timeline and assign it within the class and use it in your targeting.

  • in actionscript 3.0 how do a nested movie clip button go to a section on the main timeline

    I do a site based in flash actionscript 3.0, I have a button nested in its own clip, because I have the button bigger to be able to read what I realized the only way to do it is by creating it as a film clipa nd inside the clip in a button

    I've added an event listener for the button of blog, saying:

    blog.addEventListener (MouseEvent.ROLL_OVER, gotoblog);

    function gotoblog(evtobj:MouseEvent) {}

    gotoAndStop (2)

    }

    This part of the code it goes to 2nd part of the scenario that it is and stop wich is a version of the origanal symbol breath

    I added a second order on structure 2

    blog.addEventListener (MouseEvent.CLICK.gotoblogpage);

    function gotoblogpage(evtobj:MouseEvent) {}

    gotoAndStop ("blogframe")

    trace ("the blog button has been clicked")

    }

    I have named the blog of symbol and use the name from where will the blog page to be "blogframe" this line of code at the bottom is where I run trouble the window output in Flash says "blog button has been clicked" I like it. no errors are accouring why that which is at the playhead does not attend the image "blogframe"? If the button does not work when I click on it the code is correct, I think the problem here is he does not want the read head go to the section I want it. So I gues, my question is, how can we make a button less, a clip interact with the main timeline?

    One way to do this is to target the root timeline...

    MovieClip (root) .gotoAndStop ("blogframe");

  • Problem with Play Pause AS3 button on the main timeline

    I was wondering if someone can help with this? Have tried to create a play/pause for the main timeline button in my flash movie.

    Created a clip with 1 frame - a chart of the break, and then on the 2nd frame - game graphics, labeled 'pause' and executives 'play' consecutively and put a stop action on the first frame of the movieclip.

    Then put the following code in the layer actions on the main timeline (and gave the name of "ppBtn" instance of movieclip):

    var pp:Boolean = true;


    function ppState(event:MouseEvent) {}

    {if (pp)}

    Stop();

    event.target.gotoAndStop ('pause');

    pp = false;

    } else {}

    Play();

    event.target.gotoAndStop ('play');

    pp = true;

    }

    }

    ppBtn.addEventListener (MouseEvent.CLICK, ppState);

    He works at the stopping and starting of the film but the real movieclip is not switch between the break and the game graphics (a few stays on the framework - 1st of 'pause' State). Any help in this very appreciated!

    Thank you

    What answer was helpful (correct)?  Could mark you?

  • Control the main timeline and chronology of built-in movie clip

    Good afternoon folks,

    I am trying to solve this problem.  I have a main scenario with an animation. (animation is not a clip).  I also have a clip film embedded in the main timeline. I want to control the actions of the main timeline AND the embedded animation at the same time.

    For example, when a user clicks on a button "pause", I want to stop the animation of the main timeline as well as the integrated clip. I figured out how to stop the main timeline using the stop(); command.  I also understood how to stop the film incorporated using the command _root.embeddedclipinstancename.stop ();  Problem is that I don't know the commands to stop the two things at the same time.

    I tried to find that an instance name for the main timeline, but there is no (I think). I know I could do the animation in the timeline in a clip, but I don't want to go that route.  Any ideas on how to control two things?
    Also, if possible, I would prefer not to use the _root command since I know that this can cause a conflict in Captivate.

    Thank you.

    Include the two commands that worked in your pause button code.  If your [ause button is on the main timeline, you don't need to use a reference of _root.  It is only really useful if you target some of child level object distance back to the main timeline.  You can _parent (and string them if necessary) instead of using _root.  As you will get in trouble unless you're on the _root timeline when using it.

  • How to call a function within a movieclip on the main timeline in CC animate canvas?

    Hello world...

    In AS3: Function (fnc name: myFunction) inside a Movieclip (mc1). I'll call you timeline mc1.myFunction ();

    But how to call AnimateCC canvas?

    If you have an instance of MovieClip named "mc" with the following code in to:

    This.Fun = function() {}

    Alert ("Hey!");

    }

    You can call this function (increased to 'this' within the MC) using the oon following the main timeline:

    var root = this;

    this.mc.addEventListener ("click", function() {}

    Console.log (root.mc.fun ());

    });

  • Close button in an interpolation that takes back you to the main timeline

    I have a HTML5 canvas document that has 5 separate click to open the motion tweens.  Within each tween, I have a "close" button that I want to return at the beginning of the main timeline.  Right now he's just at the beginning of the timeline to tween movement in an infinite loop.  How can I get to go back to the main scenario for each of the interpolations of?  (For reference, I am a beginner with Animate and JS code and have not been able to find this answer in my many searches on the web).

    you want that code in the main timeline to lead the scenario primary back to its first image and stop, or you want to code on the timeline of a movieclip lead the main timeline at its first image and stop or something else?

    If you want the code on the timeline of a movieclip to lead the main timeline, use:

    this.parent.gotoAndStop (0);  assuming that the parent of the movieclip is the main timeline.

  • What is the relationship between the main timeline and timelines of symbol in Adobe Flash Professional CC?

    I am new to Adobe flash and tried to create an E-card for a class. My teacher said that it is better just to have a keyframe for each layer in the main timeline and do all the clips of animation and film on the deadlines of each symbol. I'm having a hard time to understand how it works. To illustrate my confusion, let's start with an example.  I have a kite I want to start flying to frame 20. The kite is a symbol, so I create movement to 20 image interpolation in chronology of the wing. 20 on the symbol Timeline frame occurs at the same time as frame 20 of the MAIN scenario, or are they completely separate instances of time?

    Part of my mission, is should I use code snippets to add an element of interactivity to the Ecard. My confusion about the timeline affects my ability to do so. My teacher said that you need a stop on the first keyframe code to make sure that things will not start before you click the play button. Can I put the stop action on the main timeline or in the timeline of each symbol, or both?  Let's say I want to create a button that makes the kite flies when I click it. Where to play action 'go to and play', in the Assembly of the wing?

    I would greatly appreciate any help from the community. I'm the kind of person who needs to understand how things work. I searched for days, watch videos and read articles, but I still need to find a resource that effectively dissolved my confusion on this subject. So if anyone knows of any tutorials that explain how the main timeline and symbol timelines coincide, please share them with me. Thank you very much for your time.

    (P.S. are CC Animate Adobe and Adobe Flash Professional CC the same?)

    Thank you both for responding. Yes, your answers were useful, but a bit Advanced. I hope that you don't mind me asking a few follow-up questions.

    For Pete47-

    So I put my stop() in the main timeline. How the actionscript in the main timeline code works on the chronology of the wing if the two are separate?  Why not put the ActionScript on chronology of the wing? Clearly, there must be an interaction between the main timeline and symbols, right?  When you say "you can drag the symbol on the main timeline and it will run when you start", what do you mean by that? Like GETTING started, in the main timeline or in the scenario of the symbol? As you can see I am very confused by there!

    For Colin.

    I thought that Pete said you want to only have a keyframe in the main timeline. Then, when you said... "you can do it with an interpolation of the main timeline... from the beginning to the final position," why would you animate the motion on the main timeline? Why not in the chronology of the wing, can create another symbol of the tail in this period?

    And if the schedules of chronology and main symbol are separated, how SYNCHRONIZE you together different symbols to their movement to work together? And why should it be like that anyway?

    I am new to the community here, the last thing I want to say because you two sounds very knowledgeable on the Flash. How did you get your start? Did you start by watching the tutorials, read the manual, or something else?

    Once more, you have my abundant thanks for taking the time to help.

  • How can I access a variable on the main timeline of a movie nested in HTML5 Canvas

    Hello

    This should be pretty simple, but for some reason, it does not work if I have the wrong syntax.

    But I have a movie clip with a bit of code in it.

    It is a timer.

    I want to be able to program the wait time: since the main scenario and that the timer read this variable on the main timeline.

    I implemented the delay var = 1000 on the main timeline, but then I do not seem able or knows how to get this variable in my code in the nested MC. It is quite difficult to find the reference of the paradigm flash timelines on H5 support pages, so I really appreciate the help.

    tl2 var = this;

    TL2. Stop();

    var delay = delayMain;

    var startTime is createjs. Ticker.getTime ();

    createjs. Ticker.addEventListener ("tick", f);

    {function equation

    If (createjs. Ticker.getTime () - startTime > delay) {}

    TL2. Play();

    createjs. Ticker.removeEventListener ("tick", f);

    }

    }

    If you want to get to a variable defined by a feature any at any depth, you can use the window. As:

    Window.Delay = value;

    in a deeply buried movieclip, can be read in any other level of the project.

  • Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    Using CS4 Flach and action script 2.0 how to move a specific frame in the main timeline when a movie clip instance come at the end of his chronology?

    code on the last frame of your movieclip instance:

    _root.gotoAndStop ('whatever_frame');  will work unless this swf is loaded into another swf.  in this case, you must use a relative path to the main timeline (for example, _parent or _parent._parent etc.).

  • Go to a function on the main timeline of the timeline of the object

    Hello

    I have an object on the stage, MovieClip, with an animation inside.

    The animation is called from a class file.

    I would like to call for a function, addBubbles, when the animation of the MovieClip is completed.

    The function, addBubbles, is described in the main timeline, in the first picture.

    But I would like to call from inside this MovieClip, and write the code in the last image.

    How should I reference, so it would work?

    Both ways would be to use just...

    MovieClip (root) .addBubbles ();   OR MovieClip (parent) .addBubbles ();

    Another way would be to have the MovieClip to dispatch a custom event for which you have a listener assigned in the main timeline.  This listener in the main storyline would have an event handler function that calls the addBubbles function.

  • Symbol animation does not play on the main timeline

    I created a ŒIL on the main stage and then transformed into a symbol of Clip and in that nested some cover eye movements and pupil. If setting it up like this:

    ŒIL

    -top cover

    -bottom cover

    -mask

    -student (student is also a symbol)

    -White

    Once the playback cursor reaches the image where the symbol of the ŒIL begins, the playhead moves through the timeline but any animation nested in a symbol is read. All I see is the static image of the first frame in the nested symbol. I thought that maybe I needed to extend the size of the layer of the EYE on the main stage and add more pictures. I added more pictures that the nested animation had actually and still no animation showed on the main timeline...

    Any thoughts?

    It is expected your wash / play timeline in the ide.  If you test, you should see the animation of your movieclip.

  • Control loaded swf on the main timeline

    Hello

    I'm working on loading external swf files for ios. I am able to load swf files and assembled visible or invisible in different settings. I have trouble controlling the swf files loaded on the main timeline. Specifically, I would like to have a button on the main timeline, that when you click on will move a swf loaded to frame 1.

    Here is a code that loads a swf file:

    var myLoader1:Loader;

    var loaderContext1:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

    if(myLoader1 == null)

    {

    myLoader1 = new Loader();

    addChild (myLoader1);

    }

    myLoader1.load (new URLRequest("folder/file1.swf"), loaderContext1);

    myLoader1.visible = true;

    backbutton.addEventListener (MouseEvent.MOUSE_DOWN, backbutton1);

    function backbutton1(myEvent:MouseEvent):void {? myLoader1.gotoAndStop (1) ;}}  (this line does not work)

    (Once I load file1.swf, in the file1.swf I click a next button to move on to different periods.) My question is: hHow do I code the "backbutton" on the main timeline so that it causes the file1.swf to go to frame 1?)

    Thank you for your help.

    After loading is complete (and assuming that you load an as3 swf), you can use:

    MovieClip (myLoader1.content) .gotoAndStop (1);

Maybe you are looking for

  • Portege M400 - where the memory?

    Hello Can someone tell me where on a Portege M400, the memories are hidden? However, normally live an elevation using a flap, the memory and good exchanges.But anyway I can't find this flap.Please, help around. THXHans Meiser

  • Can I transfer podcasts to my iPhone, back to iTunes?

    I have more than 50 comedy podcasts on my iPhone 5, but a few months ago I accidentally deleted from my iTunes account.  They are no longer available for download on the web.  I tried a few programs that claim to be able to REList them on my iTunes a

  • 17 - e100sh

    Hello HP Pavilion model 17-e100sh product G1N11EA #AKC OS Windows 7 Professional 32-bit sp1 HUN Problem: cannot find the correct drivers 1. Ethernet controller PCI\VEN_10EC & DEV_8136 & SUBSYS_213B103C & REV_07 PCI\VEN_10EC & DEV_8136 & SUBSYS_213B10

  • something missing on the use tab under System Properties remotely

    In the Properties window system, on the Remote tab, I don't see a remote desktop section, I have windows 7 Home Edition premium, could someone help me, please? Thank you!

  • My HP photosmate printer is connected to my network as it is my laptop but I can't print wireless

    My HP photosmate printer is connected to my network as it is my laptop but I can't print wireless, if the usb port is located. How to print wireless or do I just remove printer and reinstall? Thanks for the help in advance: o))