Controlling an instantiated MovieClip's animation from it's Class

Hi all
Say if I have a MovieClip, that gets instantiated on a Class like this:
var myMC:MyMC = new MyMC();
addChild(myMC);
And that MovieClip has a class that looks something like this:
package{
  import flash.display.MovieClip;
  public class MyMC extends MovieClip{
    public function MyMC(){
      stop();
This myMC is an animation, which has a series of Labels in the timeline. However, there aren't any actions in the timeline, because in MovieClips that have custom classes that get added to the stage, I find that the actions in the timeline get ignored.
So if I want to play the animation for a sequence, and stop it when it reaches a label, the only way I've ever got this to work is to add a bunch of listeners to the MovieClip's class, like this:
public function playAnimation():void{
  gotoAndPlay("animateIn");
  addEventListener(Event.ENTER_FRAME, animateInHandler);
private function animateInHandler(e:Event):void{
  if(currentLabel=="stopAnimateIn"){
    stop();
  removeEventListener(Event.ENTER_FRAME, animateInHandler);
This seems like a giant pain to do, especially when you start talking about more than 10 animation sequences in 1 MovieClip, and dozens of hese MovieClips on screen.
Is there an easier way to do this? Any help is always appreciated.
Thanks
Chris

I find that stop scripts in a movieclip work fine. I literally copied and pasted your scripts into a test movie/AS file, and put in a tween in the movieclip in the library, and could play from anywhere, and teh stop action would stop it from continuing.
If that doesn't work out for you, you might search for addFrameScript in Google. With that you can add a frame script to a movieclip at runtime.

Similar Messages

  • Access movieclip on stage from class?

    Hi all,
    Is it possible to access a movieclip which has been dragged onto the main stage in my FLA from an external class that i've written? Can i create a variable that refers to the object on the stage? Or does it have to be added dynamically to be accessible?
    Many Thanks
    Matt

    Hi Ned, i'm not instantiating it as such i'm just using it to store quite a large method which is being called from the document class.
    I'm trying to break all my code down into chuncks stored in .as files so that i dont have 2,000 lines of code all in frame one of the main timeline : S
    So this is my document class:
    package  {
              import flash.display.MovieClip;
              import loadXML;
              public class mainClass extends MovieClip {
                        public function mainClass () {
                              loadXML.importXML();
    then this is the class being called from the mainClass:
    package  {
              import flash.display.Stage;
              import flash.net.*;
              import flash.events.ProgressEvent
              import flash.events.Event;
              import flash.text.*;
              public class loadXML {
                        private static var myXML:XML;
                        private static var myLoader:URLLoader = new URLLoader();
                        public function loadXML() {
                        public static function importXML():void{
                                       myLoader.load(new URLRequest("pipeLineData.xml"));
                                       myLoader.addEventListener(Event.COMPLETE, processXML);
                        private static function processXML(e:Event):void {
                                       myXML = new XML(e.target.data);
                                       objectOnStage.text = myXML.TEXT[0];
                                       //etc...
                                       //etc...
    Many thanks
    Matt

  • How to control the speed of an animation in Flash Catalyst

    I had created a simple slide show  in Flash and published as a .swf file. The slide show contains few  images and the animation takes about 45 seconds to run at 8 frames per  second. When i imported it into Flash Catalyst, the animationa runs very  fast, taking only about 15 seconds to get through the whole slide show.  I re-adjusted the animation in Flash to make it run slower but when i  imported the new version into flash catalyst, it runs at the same speed,  --still very fast.
    Is there any way for me to control the speed of my animation and make it runs the same speed as I set up in Flash?
    Thanks,

    Take a look at this forum post to see one solution:
    http://forums.adobe.com/message/3402367#3402367
    It takes a little effort in Flash Builder. but it should work. I am assuming your custom component goes from state 1 to state 2, and all the effects occur in the timeline?
    The other option is to go back to Flash Profession and have it do the looping.
    Chris

  • Slow gif animations from photoshop

    Hi all. I have to create two small gif animations. Each one is only 10 frames and the file size of my animations is under 40k when exported. But no matter what timing setting I use, they seem sluggish when viewed in any browser (FF, IE, Safari). I've tried 0.5, 0.2, 0.1, 0.05, and even 0.0 between frames. The animation should really only take half a second to complete but they seem to take up to two seconds to complete when view in a browser.
    Yet I can view other gif animation on the web that are much larger in size and they seem to animate quickly and smoothly (compared to my slow and choppy ones).
    is there a trick to getting fast, smooth animations from photoshop?
    Thanks!

    > via the gif animation import
    There is no such feature in DW. DW knows nothing about GIF
    images other than
    the fact that they are images. I'm guessing that you did not
    properly
    export the animated GIF from Photoshop. When you open that
    image in the
    browser, does it animate?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "sammydyer" <[email protected]> wrote in
    message
    news:fqhqc0$nuj$[email protected]..
    >i have made a gif animation in photoshop (it is set to
    forever), which
    >plays
    > fine, but when its imported into dreamweaver via the gif
    animation import
    > in
    > dreamweaver, it wont play when viewed in a browser
    > thanks
    >

  • How do I create an animation from stills (100's of stills!)

    I have a load of still images that I want to make a straightforward animation from. Current I have to for each frame:
    click still image to get it in the 'viewer'
    select duration box and enter 1 frame
    Drag from viewer to canvas 'insert' box
    With hundreds and by the time I have finished thousands of images this is very slow and labour intensive. Is there a simpler way to do this? I am sure in my distant memory there was a free third party program I used where you could select all the stills and it would string them together but ideally I would like to do it in FCE.
    Thanks
    Ed
    Only other points to note are;
    Images are 1504 x 1000
    Version 3.5 of FCE
    Still on OSX 10.4

    Put your stills in a folder numbered sequentially in the order in which you want them with leading zeros. Set the still import preference in the second panel of user preferences to one frame. Import the folder. Drag the folder to the timeline.
    You can also open the image sequence in the QT pro player, set the frame rate you want, and convert it to a QuickTime movie.
    Message was edited by: Tom Wolsky

  • Target movieclip from an AS3 class file - remove/add Child

    Halo.
    I have a very simple question  (for those who use external class files).
    Assuming that I have a MovieClip manually added to Stage and I want to access it from inside my class definiton.
    So the code would be:
    MovieClip(root).MyMovieClip
    But I can't figure out how to use remove/add Child in that kind of situation.
    I will appreciate any advice.
    Thanks

    if you can reference using that, you can remove using:
    MovieClip(root).MyMovieClip.parent.removeChild(MovieClip(root).MyMovieClip);
    and you can add to any displayobjectcontainer.

  • About Animation from EDGE on Windows 8 apps?

    Hi, My name is Michel.
    So. I'm wonder if I could put some animation into a app made on Visual Studio Epress. Creating an aplication in Javascript with HTML5, just importing the files created/exported from Adobe Edge animate.
    I think could be a nice work in apps put some animations from EDGE AN.
    Thanks for any information.

    Hi, I'm trying the same thing and just figured out how to get this working. When you publish your Edge Animate composition do the following:
    Publish for Web and make sure all three checkbox options are deselected.
    When you move your published files into your VS solution, make sure you copy over the "edge_includes" folder along with all other assets.
    Open your Edge composition's HTML file and copy the Adobe Edge Runtime script and the <div id="" class=""> codes into the VS project's HTML file between the head and body tags respectively.
    That should do it!
    -Sam

  • Facebook like & twitter tweet buttons disable my animation from starting

    Hi,
    I have just added social media buttons (G+, tweet, like) to my web page and they seam to interfereing with my animation. I am using the HTML method for facebook like, however if I use IFRAME method everything works fine in Firefox and Chrome BUT NOT Safari. Also I don't wish to use the IFRAME as when the user clicks like the post popup does not display.
    Predominently Safari seams to be most problematic. I have tried moving the JS to the end of the file etc but nothing works. Also my html for the buttons is after the edge animation html.
    Is there a way to get these buttons to work whilst not interfering with my animation from loading and playing.
    Here is my page http://goo.gl/d948f
    P.S If you reload the page a couple of times it fixes itself.

    First, I would eject whatever it is that you downloaded. Go to Finder and eject it that way or depending how you have your system set up, do the two finger tap and Eject it. Download the link above. Once it downloads, double click it to install it. It should work. If it doesn't you need to use your Disk Utility to check for errors. Click your Finder again and then Applications. Scroll down to Utilities and then Disk Utility. Click on your hard drive and you will get a menu of items on the right side. Towards the bottom, you will see a button to Verify Disk Permissions. Click that and let it run. It may take a few minutes to finish. Once it's finished there may be a list of things wrong with your system. Click the Repair Permissions and let the computer do it's thing. Use Disk Utility at least once a month to make sure everything is in order on your system. If this doesn't fix it, I don't have any other suggestions. I'd hate to say do a fresh install but that might be the next step if this doesn't work.
    Something else to consider is that is if you use Time Machine and the system did work at one point, you could go back to the last known good point and reinstall that back-up. You would lose anything you have saved since that point (obviously). If you take steps to back up your information, that should not be an issue. (For me), Time Machine works as advertised. If you are not backing system up regularly, shame on you. You need to start ASAP backing up. It's an easy process and it's times like you are having now, that make the small preventive maintenance, worth extra time and effort.
    Good luck.

  • How can I combine animation from Flash with a video from Photoshop to make a movie?

    I have a project that's due tomorrow. I had to create a motion tween and animation and record a video to put in it, which I have done both already. My question here is, how can I combine my animation from flash and my video from Photoshop to make it into one movie?

    No, I am saying that this isn't the forum for help with that. This forum is for Firefox user support, and the helpers in this forum aren't versed in development issues like that - we're volunteers, not Mozilla developers and don't work for Mozilla. You are better off asking about that in a forum where other web site developers do support.

  • Next button in symbol, start animation from the timeline and after 3 sec playReverse

    Hello,
    I have a next button in a symbol. When I click on the button I would like to start the animation from the timeline.
    It wil starts at one second. But if the timeline is after 3 seconds I would like to play the animation backwards (if you click on the same button).
    I tried it with the code below but it starts always at 1 second.
    var pos = sym.getPosition() //
    if (pos <= '1000'){
             sym.getComposition().getStage().play(1001);
    else if (pos <= '3000'){
              sym.getComposition().getStage().playReverse(2999);
    Can anybody help me with the code?
    Thanks!

    Hello,
    Thanks for the demo file, I checked it, tried it in my project and it works.
    But I think I have to explain better.
    I have a button in the symbol. When I am between 0 and 1 second on the stage timeline
    and I click on the button. The stage timeline (slider) will start from 1 second till 2.
    But when I'm in the timeline after 3 seconds (doesn't matter if its at 10 sec) and I click on the button,
    I would like to play the stage timeline from 3 seconds till 2.
    Is this possible and how do I do that?
    Thanks

  • HT5858 In control centre some how facebook app is getting displayed I dont want any app to be clickable from control centre how to remove it from control centre panel

    In control centre some how facebook app is getting displayed I dont want any app to be clickable from control centre how to remove it from control centre panel

    .

  • Trouble Exporting Google Sketchup Animations from iMovie

    I am having trouble with animations and imovie. I have successfully exported about 5 animations from Sketchup to imovie. Everything works fine until I try to export the imovie video. When I open my exported imovie video in quicktime or any other program, my animations are replaced by other pictures already in the movie. Basically, I am having trouble exporting Sketchup animations from imovie.
    Any suggestions?
    manny

    Welcome to the  Discussion Forums.
    Unfortunately imovie has issues with animation (shouldn't have but does). Try converting your animations to another editable format (DV, AIC, MJPEG) before importing them into imovie.

  • Animate 1.5 Can you trigger animation from elsewhere on the html page (ie outside Adobe Div)?

    I would like to use a button and jquery to trigger the animation from elsewhere on my web page (outside the Adobe Div) on  Adobe Animate 1.5.
    Is this possible?
    (I looked here but my javacript is only beginner level. http://www.adobe.com/devnet-docs/edgeanimate/api/old/1.5.0/EdgeAPI.1.5.0.html)

    <!DOCTYPE html>
    <html>
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
      <title>Africa</title>
    <!--Adobe Edge Runtime-->
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <script type="text/javascript" charset="utf-8" src="edge_includes/edge.5.0.0.min.js"></script>
        <style>
            .edgeLoad-EDGE-Africa { visibility:hidden; }
        </style>
    <script>
       AdobeEdge.loadComposition('Africa', 'EDGE-Africa', {
        scaleToFit: "none",
        centerStage: "none",
        minW: "0",
        maxW: "undefined",
        width: "100%",
        height: "3000px"
    }, {dom: [ ]}, {dom: [ ]});
    </script>
    <!--Adobe Edge Runtime End-->
    <!--Adobe Edge Runtime-->
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <script type="text/javascript" charset="utf-8" src="edge_includes/edge.5.0.0.min.js"></script>
        <style>
            .edgeLoad-EDGE-America { visibility:hidden; }
        </style>
    <script>
       AdobeEdge.loadComposition('America', 'EDGE-America', {
        scaleToFit: "none",
        centerStage: "none",
        minW: "0px",
        maxW: "undefined",
        width: "100%",
        height: "2108px"
    }, {dom: [ ]}, {dom: [ ]});
    </script>
    <!--Adobe Edge Runtime End-->
    </head>
    <body style="margin:0;padding:0;">
      <div id="Stage-Africa" class="EDGE-Africa">
      </div>
        <div id="Stage-America" class="EDGE-America">
      </div>
    </body>
    </html>

  • Animation from layers

    I'm tying to make an animation from layers in Photoshop 6, but when I use the timeline window, the "convert frames' options as well as other options are greyed.  It doesn't grey when I open a video file.
    I'm tried using JPEG and GIF files as the layers, but am unsure what I'm to do at this point. 

    RDOnishi wrote:
    I'm tying to make an animation from layers in Photoshop 6, but when I use the timeline window, the "convert frames' options as well as other options are greyed.  It doesn't grey when I open a video file.
    I'm tried using JPEG and GIF files as the layers, but am unsure what I'm to do at this point. 
    The timeline palette handles two type of animations. Frame Animations and Video Timeline.  Each mode has different option and option will gray out when they are not current available for some required condition or state does not exists. Some examples:
    Frame Animation with a single layer document.  note Frame animation options does not have a "convert frames" option that a video timeline option. Note however other option like make frames from layer are grayed out.  The because the are no additional layers to make  frames with.
    Converted to Video timeline you can see there is a "convert frames" but other options are grayed out for they are not available for this document in its current state.
    Here a layered single in this case document in Photoshop video timeline  option "convert frames" grayed out for there is nothing in the video timeline but a button to create a frame animation.
    Video Timeline with no document open looks like the above options however you can see there is nothing in the video timeline. The create frame animation button does not hide the video timeline contents.

  • How can I to control any element of my GUI from another class?

    How can I to control any element of my GUI from another class?

    For that, you need the external class to have the reference to your element.. If your idea is to change basic properties like width, height etc.. then you can have the constructor of the external class to take the object of the parent of your class as the parameter and modify ..
    However, if the properties to be altered/accessed are custom to your element, then you will have to have the class accept an object of your class as the parameter. No other option..
    What exactly is your requirement?

Maybe you are looking for

  • Windows 2008 and Tiger SMB Issues

    I've been pulling hair out all morning over this one. We have a new Windows 2008 server for file sharing. We are trying to connect to it via SMB on our network (with AD domain). Works great on PC, works on Leopard, does not work on Tiger. From connec

  • Inserting Strings in XML elements

    I have an xml file that describes the content of an OpenOffice document (content.xml). A node in the file contains a bookmark named 'DateWritten' where data, in this case a date in string format "YYYY-MM-DD" , is to be entered. The node looks like th

  • Analyzer connectivity to Oracle table

    I'm running into some problems and can't seem to figure out what's going on. I'm working with Essbase 6.5.3 and Analyzer 6.5. I've got a relational table stored in Oracle with transaction level detail. I'm trying to access the table through Analyzer

  • Can't get G5 to boot directly into Linux

    Hi, I have an Xserve G5, and am trying to install Debian on it.  The problem is, I can boot the system my entering Open Firmware and typing "boot hd:,yaboot", but I'd rather not do that.  How do I get the system to boot directly, without having to en

  • Trying to setup home network

    I just bought a Linksys WRT54GL wireless router. I have never setup wireless before. Here is my current wired setup. I have a cable modem connected to a netscreen firewall. Off that netscreen firewall I have two laptops that currently plug directly i