MovieClip Finished Event

Hi All!
Thanks in advance for any help, as usual...
So, I'm a bit stunned to learn that there isn't an Event
which specifically broadcasts that a MovieClip has finished
playing; seems like kind of a no-brainer to me...
I was wondering if people had a preference between
-Check to see if currentFrame == totalFrames
-dispatchEvent(new Event()) plus listener
Or, if they have a different preferred method.
Thank you!
Be Well
Graham (using AS3)

your on the right track Graham - either of those are valid
methods. often a simpler solution though is to call a stop on the
final frame, and then call to a method directly as needed. there
'are' some event notifications for certain classes however, such as
Tween, Motion, and Animation classes. another work around might
also be to 'remove' the instance through code at the end of the
timeline's play - then use the 'removedFromStage' event of the
DisplayObject class - might be a few other tricky ways :)

Similar Messages

  • Is it right that GCs returned from GC start/finish events are not Full GC i

    We have noticed that all those GCs returned from GC start/finish events are not only Full GCs (which are stop world GC specified as in JVMTI spec if I understand it correctly) in JVMTI. It is not like in JVMPI. Is it a right behavior? Should only stop world GCs be reported by GC start/finish events per JVMTI spec?
    For example:
    GarbageCollectionStart...
    [GC 1719K->1304K(1984K), 0.0003732 secs]
    GarbageCollectionFinish...
    post-GarbageCollectionFinish actions...
    GarbageCollectionStart...
    [GC 1771K->1351K(1984K), 0.0003081 secs]
    GarbageCollectionFinish...
    post-GarbageCollectionFinish actions...
    GarbageCollectionStart...
    [GC 1823K->1446K(1984K), 0.0003593 secs]
    [Full GC 1446K->277K(1984K), 0.0127902 secs]
    GarbageCollectionFinish...
    GarbageCollectionStart...
    [GC 754K->420K(1984K), 0.0003827 secs]
    GarbageCollectionFinish...........
    Thanks,
    Chong

    Use the trackpad to scroll, thats what it was designed for. The scroll bars automatically disappear when not being used and will appear if you scroll up or down using the trackpad.
    This is a user-to-user forum and most people will post on here if they have problems. You very rarely get people posting to say there update went smooth. The fact is the vast majority of Mountain Lion users will not be experiencing any major problems with the OS, or maybe with apps which are not compatible, but thats hardly Apple's fault if developers don't update their apps.

  • Detecting when the movieClip finished playing

    Hi...
    Does anyone know how to detect when the movieclip is finish playing?
    i want to play an animation that is converted into a movieclip and indicate success of that level and then after the movieclip is finished playing then i want to run a function which will bring user to the next level.
    any suggestion?
    THanksss

    stage.addChild(play_mc);
    play_mc.gotoAndPlay("startPlay");
    play_mc.addEventListener( Event.ENTER_FRAME, onfrm);
    function onfrm( evnt: Event ): void
                    if (play_mc.currenFrame == play_mc.totalFrames )
                        play_mc.removeEventListener( Event.ENTER_FRAME, onfrm);
                        alpCount++;
                        splitWord(alpCount);
                        underlines();

  • How to generate SCS=FINISHED event and skip phase STOP_SCS_INITIAL_ADDIN

    Hi all,
    My SapEhpi 'upgrade' from ERP 6.0 to ERP 6.04 EHP4 is stuck in phase STOP_SCS_INITIAL_ADDIN
    This phase stops the SCS with a wrong parsing of the OS stopsap command
    So this phase is stuck, and the ABAP part stops in PHASE GETSYNC_SCS_FINISHED and waits for this Java part to finish and generate an SAPJup SCS event
    My questions:
    1:
    How can I change / override the behaviour / creation of this errourness OS command so it will return without errors?
    2:
    How can I skip this Java phase, since I did its work directly at OS-level?
    i.e. how can I fool the SAPJup that this phase is finished?
    3:
    How can I generate the SAPJup SCS event, so that the ABAP part will continue?
    Kind regards,
    Paul Hoogendoorn

    Hi Sunny,
    The error is caused bij a wrong parsing of the OS command:
    It creates the command: stopsap .. INSTHOST(AMPL-AS01)..
    But it should create stopsap .. INSTHOST('AMPL-AS01')..
    This is an small error in the sapjup, wich will be solved soon by sap on i developer.
    In the meantime: don't use host names wich include a '-' hypen during EHPi upgrade, alltough that are valid host names.
    Kind regards,
    Paul Hoogendoorn

  • CrystalReportViewer refresh finished event?

    Hi,
    I'm try to figure out a way to automatically export (using a user configured set of options) a report when the report is finished processing. 
    I'm currently subscribing to the RefreshEventHandler, however, this is only fired at the start of the report refresh.  What I actually need is an event that is fired when the report has finished. 
    Is there anyone who can help me please?
    Thanks in advance,
    Rory.

    Again, thanks for the swift reply Ludek.  The preview makes the code look ugly.  Hopefully you can decipher it.
    Rory.
    void CCrystalContainerView2008::OnTest1()
         CCrystalContainerDoc* pDoc = GetDocument();
         String ^str = gcnew String(pDoc->m_strReportPath);               // convert the CString to a system string
         CrystalDecisions::Windows::Forms::CrystalReportViewer ^viewer = gcnew CrystalDecisions::Windows::Forms::CrystalReportViewer();
       CrystalDecisions::CrystalReports::Engine::ReportDocument ^report = gcnew CrystalDecisions::CrystalReports::Engine::ReportDocument();
         // Get embedded Crystal report viewer control
         viewer = GetControl()->ReportViewer;
         // Load the Crystal Report file
         // This should have the same effect as opening the report in the CR 2008 Application
         report->Load(str);
         if(report->IsLoaded == true)
              if(report->HasSavedData == true)
                   // Discard saved data here !
                   report->Refresh();
              // Now I assign the opened report to the crystal viewer control
              viewer->ReportSource = report;
              // Here I expect the program to only continue when the parameters
              // have been entered by the user.  However, the parameter screen only get presented
              // to the user when my application yields control back to the main message loop, after this function ends
              // Export the report based on user configured settings
              // This function fails as the parameters for the report have not yet been parsed by Crystal
              this->ExportReport();
    void CCrystalContainerView2008::OnTest2()
         CCrystalContainerDoc* pDoc = GetDocument();
         String ^str = gcnew String(pDoc->m_strReportPath);               // convert the CString to a system string
         CrystalDecisions::Windows::Forms::CrystalReportViewer ^viewer = gcnew CrystalDecisions::Windows::Forms::CrystalReportViewer();
       CrystalDecisions::CrystalReports::Engine::ReportDocument ^report = gcnew CrystalDecisions::CrystalReports::Engine::ReportDocument();
         // Get embedded Crystal report viewer control
         viewer = GetControl()->ReportViewer;
         // Load the Crystal Report file
         // This should have the same effect as opening the report in the CR 2008 Application
         report->Load(str);
         if(report->IsLoaded == true)
              if(report->HasSavedData == true)
                   // Discard saved data here !
                   report->Refresh();
              // Now I assign the opened report to the crystal viewer control
              viewer->ReportSource = report;
              // Now I force the parameter screen to be presented to the user
              viewer->RefreshReport();
              // Now that the parameters have been accepted by Crystal and everything "appears" ok
              // However, the parameter for the ReportDocument "report" gets presented the user again
              // when my application yields control back to the main message loop.
              // Export the report based on user configured settings
              // This works successfully, however, there is still a parameter screen awaiting user intput
              this->ExportReport();
    Edited by: Rory O Donnell on Apr 29, 2010 1:38 PM

  • Remove MovieClip with event.target.content

    Hi every one please i need your help i have this code and i want to remove baresClip but i cante removeit please helpme
    var loaderBares:Loader = new Loader();
        loaderBares.unload();
        loaderBares.load(new URLRequest("negocio/bares.swf"));
    loaderBares.contentLoaderInfo.addEventListener(Event.COMPLETE,loadBares);
    function loadBares(event:Event){
              var baresClip:MovieClip = event.target.content;
              baresClip.x= -474;
              baresClip.y= -135;
              addChild(baresClip);
    baresClip.over1.receta1.addEventListener(MouseEvent.CLICK, prueba);
              function prueba(event:MouseEvent):void{
                                  gotoAndStop("receta1");
                                  removeChild(baresClip); /*Here is working*/
    MovieClip(root).mc_negocio.menu_negocio.btn_botanas.addEventListener(MouseEvent.CLICK, goToBotanas);
    function goToBotanas(event:MouseEvent):void
      removeChild(baresClip);   /*Here is not working*/
              gotoAndPlay("botanas");

    oh, i see what you're doing.  you made baresClip local to loadBares.
    to remedy, use:
    var baresClip:MovieClip
    var loaderBares:Loader = new Loader();
        loaderBares.unload();
        loaderBares.load(new URLRequest("negocio/bares.swf"));
    loaderBares.contentLoaderInfo.addEventListener(Event.COMPLETE,loadBare s);
    function loadBares(event:Event){
              baresClip = event.target.content;
              baresClip.x= -474;
              baresClip.y= -135;
              addChild(baresClip);
    baresClip.over1.receta1.addEventListener(MouseEvent.CLICK, prueba);
              function prueba(event:MouseEvent):void{
                                  gotoAndStop("receta1");
                                  removeChild(baresClip); /*Here is working*/
    MovieClip(root).mc_negocio.menu_negocio.btn_botanas.addEventListener(M ouseEvent.CLICK, goToBotanas);
    function goToBotanas(event:MouseEvent):void
      removeChild(baresClip);   /*Here is not working*/
              gotoAndPlay("botanas");

  • Locked controls on new tab after finishing event structure

    Greetings All,
    My first question for the forum.  I found a few posts which had similar issues but I still can't seem to figure this one out.
    This program creates a temperature profile and it's within a much larger program where I want the user to be able to cancel, continue, go back a step, etc.  It all works fine until I leave the event structure loop and go to the verify tab.  The user should be able to continue or cancel but the buttons will not press.  I believe the event structure is locking the front panel but I turned off the lock for that case and still no go. 
    I've attached the LLB, please check it out.  Any help will be most appreciated.
    Regards
    Using LabVIEW: 7.1.1, 8.5.1 & 2013
    Attachments:
    TempProfiler2.llb ‏575 KB

    Hi,
    The answer is almost in the question, just go to the event structure and disable the option "lock front panel until event completes"
    Message Edité par TiTou le 06-30-2006 09:18 AM
    When my feet touch the ground each morning the devil thinks "bloody hell... He's up again!"
    Attachments:
    Clipboard01.png ‏435 KB

  • Removing a movieclip from the stage after a set amount of time (or once it's finished its animation)

    I've got a movieclip animation which is added to the stage at the start of the .swf.  Its an introduction to the game, and the user is encouraged to click on the movieclip to start the animation.
    Once the animation is finished I'd like the movieclip to be removed from the stage.
    How do I go about doing this?  Do I need to setup some sort of event handler which listens out if the movieclip has finished then start a function once its finished to remove it from the stage?  Which methods look out for movieclips finishing?
    Cheers

    there is no specific event that's called when a movieclip stops playing,
    what you could do is inside your intro movieclip  dispatch an event as soon as the animation is finished
    something like ... dispatchEvent(new Event("introFinished");
    and all you have to do is add and event listener to the intro movieclip intro.addEventListener("introFinished", onIntroFinished);
    when your onIntroFinished is called you can remove the intro from the stage.

  • MovieClip & Event.FRAME_CONSTRUCTED

    Hi,
    I got a little trouble when I was using Event.FRAME_CONSTRUCTED with MovieClips, I want to know if I was rgiht about: If a movie clip contains only one frame, when MovieClip.goto() function is called, Event.FRAME_CONSTRUCTED is dispatched depends on flash player version.
    I realize it when I was debugging something else, so is that correct, and is there any way that I can know if a movieclip is already "FRAME_CONSTRUCTED" so I don't need to add event listener(such as, mc.isConstructed?).
    Thank you for any information.

    Oh god, I am ashamed, I think I figure it out now.
    First, when I say "I found in different run-time, movieclips dispatchFRAME_CONSTRUCTED event differently",  this is because bug in my own code, event handler is fired, but before I trace() any information, it returns because some logic error. so I thought the event is not dispatched, I was wrong.
    So now I need to do some demos to find out how movieclips dipatch FRAME_CONSTRUCTED(with those movieclips with one single frame, and in different version of flash players).
    But I still what to know the answer to my second quesion " is there any way that I can know if a movieclip is already "FRAME_CONSTRUCTED" so I don't need to add event listener(such as, mc.isConstructed?)". It will be very helpful if there's any way.
    And here I want to ask another quesion, it's a quesion related to the topic, but it's a different one. My quesion is : when I caching movieclips to bitmapData, I find somehow sometimes, the return of method MovieClip.getBounds() is not right EVEN I call it after or when the movieclip dispatches FRAME_CONSTRUCTED event. So what I got is a animation that is "trambling" because I got wrong position of some of the frames of that movieclip(I put bitmapData I cached onto Bitmaps, and set it's position according to what MovieClips.getBounds() tells me).
    So any information or suggestion? Thank you.

  • AS3: Duplicate MovieClips - stop all on start and play only one on MouseEvent

    I have a bunch of copies of the same MovieClip that are dynamically created I want them to be stopped when the swf first starts.  When I click on one of them I want that particular one to play.  I think that I've figured out how to play a single MovieClip with event.currentTarget.play(); but I am stuck on how to stop all the clips from the start.  I thought I could just use a instanceName.stop(); in my for loop, but no go.
    Below is a simplified version of my code:
    //build scroller from xml file
    function buildScroller():void{
         var tl:MovieClip=this;
         for (var i:Number = 0; i < xmlData.sound.loc.length(); i++){
            //create movie clips
            var boxContainer_mc:boxContainer = new boxContainer();
            addChild(boxContainer_mc);
            boxContainer_mc.x = 325 * i;  // set the number here to the width of the movie clip being repeated    
         boxContainer_mc.stop();    
            tl["snd"+i] = new Sound();       
            tl["snd"+i].load(new URLRequest(xmlData.sound.loc[i]));
            boxContainer_mc.snd = tl["snd"+i];
            boxContainer_mc.addEventListener(MouseEvent.CLICK, playSound, false, 0, true);
    function playSound(event:MouseEvent):void {
         event.currentTarget.snd.play();
         event.currentTarget.play();
    I'm an artist working on a piece where I am cataloging sound recordings from people (eventually recorded live from the site... but that's a battle that I'll deal with in phase 2 and after I have a bit more actionScripting under my belt).  I just wanted to explain myself a bit since Kglad, Ned, and dmennenoh have helped me a bunch through the development of the project.  If your interested you can check out some of my works on my website.  I know, I know... I need to update the site, but its more fun to work on new projects.  Oh, and I don't care what you say... I still love animated gifs.

    Ok, I got a most of the issues figured out.  But, I still have one more problem. I have a sound_complete event listener that I want to tell an movieclip to play.  My problem is that I don't know how to reference that movieclip.  Before I was using currentTarget to point directly at the movieclip that was clicked... but this time no movie clip has been clicked.
    Basically all of my questions have been based around the same lack of conceptual understanding.  Could someone explain to me exactly how the different movieclips or instances are referenced once created dynamically?  When they are dynamically created is there an instance name that is created along with it?  The swf file must reference them seperatly in some way... it's just not evident to me.
    Below is the test script that I have that is working.  I want the testing function to play the clip that was originally clicked (right now its just sending out a trace).  In other words: a movieclip is clicked, the movie click plays (until it hits a stop(); in its own action layer), an mp3 file plays, the mp3 finishes, the movieclip continues playing (until it reaches a stop(); at the end of it's own actions script layer).
    for(var i = 0; i < 3; i++){
        var a = new test();
        addChild(a);
        a.x = 20 + (i * 150);
        a.addEventListener(MouseEvent.CLICK, doPlay);
        a.stop();
         a["snd"+i] = new Sound();       
         a["snd"+i].load(new URLRequest("creak128.mp3"));
         a.snd = a["snd"+i];
         a.addEventListener(MouseEvent.CLICK, playSound, false, 0, true);
    function playSound(event:MouseEvent):void {
         var voice = event.currentTarget.snd.play();
         voice.addEventListener(Event.SOUND_COMPLETE, testing);
    var temp:MovieClip;
    function doPlay(e:MouseEvent){
        e.currentTarget.play();
    function testing(e:Event){
        trace("test works");

  • .removeEventListener(Event.ENTER_FRAME  is not working please help

    hey guys... so i have a new problem... basically im trying to load a swf, and for this swf to load properly i need to pass it an id, and when the swf, after using the id gets all the necessary data, sets a variable called loadCompleted to true
    The problem is after my code encounters the loadComplete == true, it adds an image of that swf to my tileList, and it adds a million of these images, indicating that my event never got removed.... any ideas??
    i have the following code
    private function swfLoaded(event:Event):void{
         trace("-------------> in function swfloader");
         childSwf = new MovieClip();
         childSwf = event.target.content;
         childSwf.init(name[1]);
         childSwf.addEventListener(Event.ENTER_FRAME, compFrameEntered);
    private function compFrameEntered(event:Event):void{
         if(childSwf.currentFrame == childSwf.totalFrames){
              if(event.target.loadComplete == true){
                   trace("<<<<< load complete: " + event.target.loadComplete);
                   childSwf.removeEventListener(Event.ENTER_FRAME, compFrameEntered);
                   var myClip:MovieClip = event.target as MovieClip;
                   var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(myClip);
                   var imgData:Bitmap = new Bitmap(imageBitmapData);
                   slideImages.addItem(imgData);
                   trace("load complete company ");
    it not only adds a million same images, but it also displays "load complete company" a million times....
    any ideas?? any help is greatly appretiated! ive been having this problem for a couple of days now

    hi,
    It seems they have changed how it works,
    https://acrobat.com/    when I go here it is automatically logged me in to a page that allowed me to start a meeting
    David

  • Terminating event -- No active receiver found

    Hi -- on an Integration project I just need a workitem that stays active until explicitly closed via an event..
    It's easy enough to create a triggering event which starts a process.
    I've followed all the rules (as far as I can see) to create a terminating event but it doesn't work.
    I've created a test Bus Obj ZZJIMBO which simply has a key of the SAP user ID.
    I've defined 3 events
    STARTSYN  ====> Synchronous
    STARTASY  =====> Asynchronous
    FINISHED ======>  terminating
    Using SAP_WAPI_CREATE_EVENT the STARTSYN and STARTASY  are triggered and the relevant processes start - both for the synchronous and asynchronous tasks.
    However on raising the FINISHED event the system just errors with NO Active receiver found.
    All the binding etc is fine and SWU0 doesn't find any problems.
    Looking at the instance table (transaction SWE3)
    I see that the eventid is the same as the current workitem but the object key is empty
    object key  <empty> 
    eventid    000000250100
    The only possibility I can see is that my Business object doesn't really have "instances" like say a sales order as it only exists at run time.
    Would I have to say trigger the event finished using something like the Work item itself which does have a valid individual instance -- I can extend the WORKITEM bus obj and add an event FINISHED to it instead.
    I can get the workitem id via the container so that shouldn't in theory be a problem to "instantiate"  the Workitem (or ZWORKITEM) business object.
    I really hoped to have all the events in the SAME business object however.
    Any ideas
    Cheers
    jimbo

    Hi James.
    1. Yes, I think the workitem in runtime would expect the triggering event should be from the instance of the object either from
            a. standard workitem relevant obejct instances like _WORKITEM, ATTACHOBJECTS, RULERESULT
           b. or the associated BO in the task i.e WIOBJECT_ID
    2. However as you say >>I really hoped to have all the events in the SAME business object however>>. I can suggest the following
           a. create a parallel fork to the step which is creating your workitem
           b. In this parallel branch create step 'Wait for Event; and refer it to your ZZJIMBO.FINISHED.
          c. define necessary branches required to complete the fork as 1. meaning, if any one of the branch ends flow will continue to next step in main workflow.
    So, when the event ZZJIMBO.FINISHED is raised with the correct instance which was used in workflow. 'Wait for event' will receive it and this branch will end and eventually other branch will get logically deleted. You can put some flag in the 'Wait for event' branch using which u can understand whether the workitem is completed in normal way or through exeption.
    Hope this helps !!
    Regards
    Krishna Mohan

  • Attached corresponding image in mouse without using event.target.name in actionscript 3

    Hi,
    AS3:
    How to get general id (or) name from xml loaded images. bcoz, i want to drag and drop that images in generic method. Now, i currently used the event.target.name for each one.
    So, code length was too large. See my code below.
    /*********loading images through xml********/
    var bg_container_mc:MovieClip
    var bg_bg_myXMLLoader:URLLoader = new URLLoader();
    bg_bg_myXMLLoader.load(new URLRequest("xml/backgroundimages.xml"));
    bg_bg_myXMLLoader.addEventListener(Event.COMPLETE, processXML_bg);
    function processXML_bg(e:Event):void {
              var bg_myXML:XML=new XML(e.target.data);
              columns_bg=bg_myXML.@COLUMNS;
              bg_my_x=bg_myXML.@XPOSITION;
              bg_my_y=bg_myXML.@YPOSITION;
              bg_my_thumb_width=bg_myXML.@WIDTH;
              bg_my_thumb_height=bg_myXML.@HEIGHT;
              bg_my_images=bg_myXML.IMAGE;
              bg_my_total=bg_my_images.length();
              bg_container_mc = new MovieClip();
              bg_container_mc.x=bg_my_x;
              bg_container_mc.y=bg_my_y;
              ContentHead.addChild(bg_container_mc);
              for (var i:Number = 0; i < bg_my_total; i++) {
                       var bg_thumb_url=bg_my_images[i].@THUMB;
                        var bg_thumb_loader = new Loader();
                       bg_thumb_loader.load(new URLRequest(bg_thumb_url));
                       bg_thumb_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded_bg);
                       bg_thumb_loader.name="bg_load"+i;
                       bg_thumb_loader.addEventListener(MouseEvent.MOUSE_DOWN, bg_down)
                       bg_thumb_loader.x = (bg_my_thumb_width-18)*bg_x_counter;
                       bg_thumb_loader.y = (bg_my_thumb_height-45)*bg_y_counter;
                       if (bg_x_counter+1<columns_bg) {
                                 bg_x_counter++;
                       } else {
                                 bg_x_counter=0;
                                 bg_y_counter++;
    function thumbLoaded_bg(e:Event):void {
              var my_thumb_bg:Loader=Loader(e.target.loader);
             var sprite:Sprite = new Sprite();
              var shape:Shape = new Shape();
              shape.graphics.lineStyle(1, 0x0098FF);
              shape.graphics.drawRect(e.target.loader.x-2, e.target.loader.y-2, e.target.loader.width+4, e.target.loader.height+4);
              sprite.addChild(shape);
              sprite.addChild(my_thumb_bg);
              sprite.x=4;
              bg_container_mc.addChild(sprite);
              my_thumb_bg.contentLoaderInfo.removeEventListener(Event.COMPLETE, thumbLoaded_bg);
    //  get name for each image. 
    I want to change this code in generic method. do needful.
    function bg_down(event:MouseEvent):void {
              var bg_name:String=new String(event.currentTarget.name);
              var bg_load:MovieClip=event.currentTarget as MovieClip;
              if (event.currentTarget.name=="bg_load0") {
                      var alaska_mc:alaska_png=new alaska_png();
                       addChild(alaska_mc);
                       alaska_mc.x=stage.mouseX;
                       alaska_mc.y=stage.mouseY;
                       alaska_mc.name="alaska_duplicate"+alaska_inc;
                       alaska_inc++;
                       alaska_mc.startDrag(false);
                      alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
                       alaska_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load1") {
                       var lake_mc:lake_png=new lake_png();
                       addChild(lake_mc);
                       lake_mc.x=lake_mc.mouseX;
                       lake_mc.y=lake_mc.mouseY;
                       lake_mc.name="lake_duplicate"+lake_inc;
                       lake_inc++;
                       lake_mc.startDrag(false);
                       lake_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load2") {
                       var mountn_mc:mountn_png=new mountn_png();
                       addChild(mountn_mc);
                       mountn_mc.x=mountn_mc.mouseX;
                       mountn_mc.y=mountn_mc.mouseY;
                       mountn_mc.name="mountn_duplicate"+mountn_inc;
                       mountn_inc++;
                       mountn_mc.startDrag(false);
                       mountn_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load3") {
                       var town_mc:town_png=new town_png();
                       addChild(town_mc);
                       town_mc.x=town_mc.mouseX;
                       town_mc.y=town_mc.mouseY;
                       town_mc.name="town_duplicate"+town_inc;
                       town_inc++;
                       town_mc.startDrag(false);
                       town_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load4") {
                       var water_mc:water_png=new water_png();
                       addChild(water_mc);
                       water_mc.x=water_mc.mouseX;
                       water_mc.y=water_mc.mouseY;
                       water_mc.name="water_duplicate"+water_inc;
                       water_inc++;
                       water_mc.startDrag(false);
                      water_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load5") {
                       var city_mc:city_png=new city_png();
                       addChild(city_mc);
                       city_mc.x=city_mc.mouseX;
                       city_mc.y=city_mc.mouseY;
                       city_mc.name="city_duplicate"+city_inc;
                       city_inc++;
                       city_mc.startDrag(false);
                      city_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load6") {
                        var citywide_mc:citywide_png=new citywide_png();
                       addChild(citywide_mc);
                       citywide_mc.x=citywide_mc.mouseX;
                       citywide_mc.y=citywide_mc.mouseY;
                       citywide_mc.name="citywide_duplicate"+citywide_inc;
                       citywide_inc++;
                       citywide_mc.startDrag(false);
                      citywide_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load7") {
                       var downtown_mc:downtown_png=new downtown_png();
                       addChild(downtown_mc);
                       downtown_mc.x=downtown_mc.mouseX;
                       downtown_mc.y=downtown_mc.mouseY;
                       downtown_mc.name="downtown_duplicate"+downtown_inc;
                       downtown_inc++;
                       downtown_mc.startDrag(false);
                      downtown_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load8") {
                       var powerlines_mc:powerlines_png=new powerlines_png();
                       addChild(powerlines_mc);
                       powerlines_mc.x=powerlines_mc.mouseX;
                       powerlines_mc.y=powerlines_mc.mouseY;
                       powerlines_mc.name="powerlines_duplicate"+powerlines_inc;
                       powerlines_inc++;
                       powerlines_mc.startDrag(false);
                      powerlines_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load9") {
                       var tropical_mc:tropical_png=new tropical_png();
                       addChild(tropical_mc);
                       tropical_mc.x=tropical_mc.mouseX;
                       tropical_mc.y=tropical_mc.mouseY;
                       tropical_mc.name="tropical_duplicate"+tropical_inc;
                       tropical_inc++;
                       tropical_mc.startDrag(false);
                      tropical_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
              if (event.currentTarget.name=="bg_load10") {
                       var waters_mc:waters_png=new waters_png();
                       addChild(waters_mc);
                       waters_mc.x=waters_mc.mouseX;
                       waters_mc.y=waters_mc.mouseY;
                       waters_mc.name="waters_duplicate"+waterthumb_inc;
                       waterthumb_inc++;
                       waters_mc.startDrag(false);
                      waters_mc.addEventListener(MouseEvent.MOUSE_UP, stdrag);
    Please suggest me if any  one.
    Regards,
    Viji. S

    for each loader created, create a movieclip and add your loader to the movieclip.  assign all the properties you want to retrieve later to the movieclip and assign your event listeners to the movieclip.

  • CS5 AS3 MovieClip errors.

    I'm having an issue in scripting a MovieClip to play within a MovieClip. The outer MovieClip is a "Page" and on the page, you must click a button to play the second MovieClip, which is planned to remove the activating button, and play the MovieClip, stopping at the end, and presenting another button. I'm getting various error with different variations of the scripts.
    Here is the code for my MovieClips:
    package
               import flash.display.MovieClip;
               import flash.events.MouseEvent;
               public class Main extends MovieClip
                           var startPage:StartPage
                           var hillPage:HillPage;
                           var pondPage:PondPage;
                           var raft:Raft;
                           var sailPage:SailPage;
                           var raftButton:RaftButton;              
               public function Main()
                            startPage = new StartPage();
                            hillPage = new HillPage();
                            pondPage = new PondPage();
                            raft = new Raft();
                            sailPage = new SailPage();
                            addChild(startPage);
    //add event listeners
    startPage.hillButton.addEventListener(MouseEvent.CLICK,onHillButtonClick);
    startPage.pondButton.addEventListener(MouseEvent.CLICK,onPondButtonClick);
    hillPage.hillBack1.addEventListener(MouseEvent.CLICK,onBackButtonHillClick);
    pondPage.pondBack1.addEventListener(MouseEvent.CLICK,onBackButtonHillClick);
    pondPage.raftButton.addEventListener(MouseEvent.CLICK,onRaftButtonClick);
    pondPage.exploreButtonRight.addEventListener(MouseEvent.CLICK,onExploreButtonRightClick);
    pondPage.raftButton.addEventListener(MouseEvent.CLICK,playAnimation);
    //add event handlers
    function onHillButtonClick(event:MouseEvent):void
       addChild(hillPage);
       removeChild(startPage);
    function onPondButtonClick(event:MouseEvent):void
       addChild(pondPage);
       removeChild(startPage);
    function onBackButtonHillClick(event:MouseEvent):void
       addChild(startPage);
       removeChild(hillPage);
    function onBackButtonPondClick(event:MouseEvent):void
       addChild(startPage);
       removeChild(pondPage);
    function onRaftButtonClick(event:MouseEvent):void
       removeChild(raftButton);
       flash.display.MovieClip.raft(event:MouseEvent, playAnimation);
    function playAnimation(event:MouseEvent):void
           raft.play();
    function onExploreButtonRightClick(event:MouseEvent):void
       addChild(sailPage);
       removeChild(pondPage);
    Any assistance is greatly appreciated. Thanks.

    To play a movieclip within a movieclip you target the movieclip from the timeline you are in using dot notation, such as you possibly did when you assigned event listeners to your buttons.  You may have targeted the raftButton properly when you assigned its event listener...
    pondPage.raftButton.addEventListener(MouseEvent.CLICK,playAnimation);
    but if you did, then you did not target it properly when you tried to remove it...
    removeChild(raftButton);
    that should have been
    removeChild(pondPage.raftButton);
    (but that is only if the targeting was correct for the listener)

  • Remove stage listener for multiple movieclips

    I would like to completely remove personalized stage listeners, for each movieclip as soon as they are placed where they need to be, but the listeners remain every single time a new clip is dragged.
    Thank you for any help!
    function clickToDrag(targetClip:MovieClip):Function {
              return function(e:MouseEvent):void {
                        startingPosition[targetClip.name] = new Point(targetClip.x, targetClip.y);
                        targetClip.startDrag(false, new Rectangle(0,0,800,600));
                        setChildIndex(targetClip,numChildren - 1);
                        trace('clickToDrag function invoked\ntargetClip: ' + targetClip.name + '\startingPosition: ' + startingPosition[targetClip.name] + '\n\n');
                        stage.addEventListener(MouseEvent.MOUSE_UP, releaseToDrop);
    /*          releaseToDrop
              @function          stopDrag for current clip, if dropped off stage, returns to recorded beginning location
              @param                     targetClip:MovieClip
              @param                     startPosition:int
              @returns          event:void
    function releaseToDrop(targetClip:MovieClip):Function {
              return function(e:MouseEvent):void {
                        targetClip.stopDrag();
                        trace('releaseToDrop function invoked\ntargetClip: ' + targetClip.name + '\n\n');
                        stage.removeEventListener(MouseEvent.MOUSE_UP, releaseToDrop);
                        stage.addEventListener(Event.MOUSE_LEAVE, mouseGone);
                        function mouseGone () {
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });
                                  //toggle comments to ease or not ease back to startingPosition
                                  //targetClip.x = startingPosition[targetClip.name].x;
                                  //targetClip.y = startingPosition[targetClip.name].y;
                                  stage.removeEventListener(Event.MOUSE_LEAVE, mouseGone);
                                  trace('releaseToDrop function invoked\ntargetClip dragged out of bounds: ' + targetClip.name + '\n\n');
    /*          checkTarget
              @function          checks if current clip is dragged to drag1target(dock), updates boat weight and waterline, remove listeners
              @param                     targetClip:MovieClip
              @param                     lbsAmount:int
              @param                     targetLocation:MovieClip
              @returns          event:void
    function checkTarget(targetClip:MovieClip,lbsAmount:int,targetLocation:MovieClip):Function {
              return function(e:MouseEvent):void {
                        if (targetClip.hitTestObject(drag1target)) {
                                  targetClip.x = targetClip.x;
                                  targetClip.y = targetClip.y;
                                  drop.play();
                                  TweenLite.to(targetClip, .5, { alpha: 0, onComplete:fadein });
                                  function fadein() { TweenLite.to(targetLocation, .5, { alpha: 1 }); }
                                  noMC.waterlineMC.y = noMC.waterlineMC.y - 3;
                                  lbs -= lbsAmount;
                                  lbsTxt.htmlText = lbs + "<font size='16'>lbs</font>";
                                  targetClip.buttonMode = false;
                                  targetClip.mouseEnabled = false;
                                  targetClip.removeEventListener(MouseEvent.MOUSE_UP, checkTarget);
                                  targetClip.removeEventListener(MouseEvent.MOUSE_DOWN, clickToDrag);
                                  /* TODO: Issue with stage listener for every clip, opportunity to handle programmatically? */
                                  /* check to see if eventListenter is still present */
                                  if(targetClip.hasEventListener(MouseEvent.MOUSE_DOWN)) {
                                            trace(targetClip.name + ' still has MOUSE_DOWN event listener');
                                  if(targetClip.hasEventListener(MouseEvent.MOUSE_UP)) {
                                            trace(targetClip.name + ' still has MOUSE_UP event listener');
                        } else if (borderMC.hitTestPoint(targetClip.x, targetClip.y, true)){
                                  /*targetClip.y = startingPosition[targetClip.name].y;
                                  targetClip.x = startingPosition[targetClip.name].x;                              */
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });
                        } else {
                                  /*targetClip.y = startingPosition[targetClip.name].y;
                                  targetClip.x = startingPosition[targetClip.name].x;          */
                                  TweenLite.to(targetClip, .2, { x: startingPosition[targetClip.name].x });
                                  TweenLite.to(targetClip, .2, { y: startingPosition[targetClip.name].y });

    i will try to show you a way that might help you to understand how the event-model in as3 is meant to work.
    look at this code:
    //with a MovieClip "DragClip" in the Library exoported for ActionScript
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    for (var i:int = 0; i<10;i++){
        var mc:DragClip = new DragClip();
        addChild(mc);
        mc.mouseChildren = false;
        mc.addEventListener(MouseEvent.MOUSE_DOWN, dragStart);
        mc.addEventListener(MouseEvent.MOUSE_UP, dragStop);
        addChild(mc);
    function dragStart(e:MouseEvent):void {
        e.currentTarget.startDrag();
        trace("dragging started");
    function dragStop(e:MouseEvent):void {
        e.currentTarget.stopDrag();
        trace("dragging stopped");
        e.currentTarget.removeEventListener(MouseEvent.MOUSE_DOWN, dragStart);
        e.currentTarget.removeEventListener(MouseEvent.MOUSE_UP, dragStop);
    //it places hundred Movieclips on the stage
    //makes them draggable
    //but after they are dragged once
    //they stay in place

Maybe you are looking for

  • How to make iSight work with windows vista on boot camp

    I just installed window vista on my mac, everything work perfect but the the cam, i got a MacBook pro and my boot camp is 2.0 Please advise, thanks

  • My Powerbook G4 gets so hot.

    My powerbook is now 3 years old and after suffering a fall to the floor, the notebook gets so hot it is hard to keep on my lap. I am a college student on a limited budget - any thoughts? I know it is out of warranty.

  • Can PEv5.0 extract photos from scans? Thanks.

    Hi. I am scanning my color photos. I now have heaps of JPG files, each containing five to six photos. My next project is to open each file, crop each photo and save. Since that would be a time consuming process, I was wondering of Photoshop Elements

  • Small question related to Unix and ABAP

    Hi Guys, I had a new SAP ABAP requirment in which they are asking for unix shell scripting. I am just wondering as what unix shell scripting has to do in SAP ? Please throw some light on this.... Regards, Tushar.

  • TS1424 Itunes store will not let me sign in. Id/password ok and Works on IPAD

    I can use my id and password ok on my ipad but cannot get my imac to let me sign on to the apple store detail of my account , ie past purchases. Keeps reprompting me for my password.