Knowing when my external swf has finished reading

Hi,
I'm quite new to as, and I expected a few things to be,
well... Easier !
Here is the code I've been working on :
quote:
import flash.external.ExternalInterface;
import flash.display.*;
import flash.net.URLRequest;
import flash.events.*;
Security.allowDomain("localhost/spip2");
var tab_url = new Array('
http://localhost/spip2/squelettes-dist/flash1.swf',
http://localhost/spip2/squelettes-dist/flash2.swf');
var ldr:Loader = new Loader();
var ldra:Loader = new Loader();
var context = new LoaderContext();
var container:MovieClip = new MovieClip();
addChild(container);
function actionScriptFunction(taburl) {
var request:URLRequest = new URLRequest(taburl[0]);
ldr.contentLoaderInfo.addEventListener(Event.UNLOAD,termine);
ldr.load(request,context);
container.addChild(ldr);
function termine(pEvt:Event):void{
ldr.unload();
var request:URLRequest = new URLRequest(taburl[1]);
var context2 = new LoaderContext();
ldr.load(request,context2);
addChild(ldr);
actionScriptFunction(tab_url);
In a few words : I load a first .swf, and when it's over, I
load another one. I can't add any script to the .swf files
themselves. I've probably made my script more complicated than it
should be, however, my main problem still remains : obviously
'Event.UNLOAD' is incorrect, but how do I know my first movie is
over ? I tried to use currentframe / totalframes, but they don't
seem to return anything useful.
Is there a way to "catch" the end of a .swf ?
Thanks to anyone who could help !
Ronan

while possible, you would have to put that in an onEnterFrame
function, which tends to be fairly heavy, or even a SetInterval,
which is also heavy. It would be better to simply put a function
call in the last frame of the externally loaded SWF.

Similar Messages

  • Detecting when an external swf has stopped playing

    I want to load a short swf to play whilst a flv loads in the
    background. The problem is detecting when the swf has finished
    playing. I would use the current and total frames but unable to
    identify what swf or mc to attach the methods to. I have tried
    Loader.content but this is not working.
    Any ideas please.

    It looks like you're using AS3 and a Loader object. If that's
    the case then you can access the loaded content like this:

  • Can you tell when a loaded SWF has reached its final frame?

    I used loadMovie to load an external SWF into the bottom-half
    of a main "shell" swf. When that loaded SWF finishes playing (it's
    just an animation), I need to populate a text field with the word
    "DONE" . The text field resides on the _root, so I need some way to
    know when the loaded SWF has reached its last frame...
    This would obviously be easy if I had the .FLA of the loaded
    SWF because I could just write the actionscript on the last frame
    of that SWF to populate the _root textfield. Alas, I do not have
    the source FLA of that loaded SWF, so I need some way to have the
    main "shell" SWF/FLA know when that loaded SWF has reached its end.
    Is this possible???
    Thanks!!!

    DIY_Lobotomy,
    > The reality of my situation is that there's a "menu" of
    sorts that
    > gets loaded into "contentClip". This "menu" has a bunch
    of links.
    So far, so good.
    > When clicked, each link loads a DIFFERENT swf into
    "contentClip".
    > It is THOSE swfs that I need to note the end of.
    That's still okay.
    > So, there's actually more than one, and they're not
    exactly being
    > loaded directly from my main movie, since they're
    actually loaded
    > based on a link being clicked in the movie that is
    currently loaded
    > into "containerClip"
    The concept is still the same, no matter what. No matter how
    deep the
    one-clip-loads-another chain goes, you have to keep taps on
    each chain link.
    When the final link has loaded, you'll be able to make your
    object reference
    to that movie clip. That movie clip -- because it's an
    instance of the
    MovieClip class -- will have the _currentframe and
    _totalframes properties.
    You'll just be checking *that* cliip's properties instead of
    the one named
    contentClip in my own example.
    You can loop using onEnterFrame or, if you prefer, with
    setInterva().
    That doesn't much matter either, so long as you repeatedly
    poll the deepest
    clip to test its current frame against its last frame (this
    all assumes that
    the clip being tested is a linear animation whose end
    corresponds to its
    last frame; otherwise, you could check _currentframe against
    any arbitrary
    frame number).
    > I hope that wasn't too confusing! Do you still have a
    solution???
    Not too confusing to understand, but it might be confusing
    to route
    through in practice. Not confusing, actually, but meticulous
    ... you'll
    have to be careful with your pathing. Nested movie clips are
    very much like
    nested folders on your hard drive. Their instance names
    relate to the
    folder names.
    Now, if that menu doesn't have an instance name you provided
    -- or if
    any fork along the path has an instance name you can't
    control -- you can
    still reference the nested movie clips. If you test your file
    in the
    Debugger panel, you'll see all the instances laid out in
    hierarchical order.
    You'll see that automatic instance names are provided
    (something like
    "instance1", "instance2", etc.).
    David Stiller
    Contributor, How to Cheat in Flash CS3
    http://tinyurl.com/2cp6na
    "Luck is the residue of good design."

  • HT2173 How to know when a hard drive has failed ?

    How to know when a hard drive has failed ?

    Machine doesn't boot.  You experience strange crashes.  Gets wrong results.  Your harddrive is five or more years old.  Time to consider repacing it.   You do have backup?
    You may want to run these "standard" fixes if the problem persists.
    1) Check the amount of free space on your harddrive.  You should have a several gigs free.
    2) You should run disk utility
         a) verify the disk
         b) update your permissions.
    3) Try a safe boot.
        Shutdown your machine.  Hold down the shift key.  Poweron.  Wait awhile Wait awhile while you harddrive
          is being checked.
        http://support.apple.com/kb/ht1455
    4) You may want to run applejack to clean up your machine.
         http://applejack.sourceforge.net/
    a lot more ways to fix your Mac.
    http://www.thexlab.com/faqs/faqs.html
    verify & repair your startup drive
    To verify & repair you file system on the startup drive, you will need to run disk utility from you installation DVD.
    This article  will tell you how to get to disk utility.  Once in a disk utility, you can go and attempt to recover the disk.
    http://support.apple.com/kb/TS1417
    To repair your startup drive, you will need to run disk utility from your startup DVD.
    Mac OS X 10.4: About the utilities available on the Mac OS X 10.4 Install DVD
    http://support.apple.com/kb/HT2055
    How to run disk utility from your startup DVD.
    Insert your  startup DVD  into your reader.  Power down your machine.  Hold down to the c key.  Power on your machine.  This will bootup your startup DVD.
    This will bring you to a panel asking you for your language.  Pick your language.
    You you come to the Install Mac OS panel.  Do not install.
    Click on Utilities menu item.  This will give you a pulldown list of utilities.
    Click on the disk utility.
    You are now in disk utility.  Pick your disk.  Click on repair it should be on the lower right of the panel.
    Once the repair completes successfully, you should update your permissions.
    Verify a disk
    As an alternative, you can verify that the filesystem on the disk is correct. You will not be able to repair the file system.
    I suggest that you use disk utility to verify that your startup disk is OK. 
    Macintosh-HD -> Applications -> Utilities -> Disk Utility 
    Start up disk utility.  On the left pane view, you will see a list of all your disks.  
    Click on your startup disk.
    Click on the First Aid  Tab.
    Click on verify.  
    Hopefully your disk will verify.  If not, you have to boot from your installation DVD and run Disk Utility from there to attempt to repair your file-system.

  • HT201441 dear sir . Ihave bought a dell ipad under serial number DMPKQFF4F186 on 25th of dec.2013,it was packed and seems it was .new,after unpacking i found out it is lock. I just need to know when this serial number has registered in icloud. I will grat

    dear sir . I have bought a dell ipad under serial number DMPKQFF4F186 / UDID : 976ba8f5ba16f665bdf3b1b5ec53a172c9d65381. on 25th of dec.2013,it was packed and seems it was new after unpacking i found out it is locked.Ijust neednto know when this serial number has registered in icloud. I will grateful if you could let me this information. locking forward to your kind response.  With Regards

    Greetings,
    I've never seen this issue, and I handle many iPads, of all versions. WiFi issues are generally local to the WiFi router - they are not all of the same quality, range, immunity to interference, etc. You have distance, building construction, and the biggie - interference.
    At home, I use Apple routers, and have no issues with any of my WiFi enabled devices, computers, mobile devices, etc - even the lowly PeeCees. I have locations where I have Juniper Networks, as well as Aruba, and a few Netgears - all of them work as they should.
    The cheaper routers, Linksys, D-Link, Seimens home units, and many other no name devices have caused issues of various kinds, and even connectivity.
    I have no idea what Starbucks uses, but I always have a good connection, and I go there nearly every morning and get some work done, as well as play.
    You could try changing channels, 2.4 to 5 Gigs, changing locations of the router. I have had to do all of these at one time or another over the many years that I have been a Network Engineer.
    Good Luck - Cheers,
    M.

  • How to detect external SWF has stopped not using totalFrames

    Trying to find a way to detect when an externally loaded SWF has stopped. Using "totalFrames" like the example below doesn't work for what I'm trying to accomplish.
    I need something that simply listens and detects when the clip has stopped. Editing the external SWF is not an option. Thanks in advance for any insight.
    function onfrm( evnt: Event ): void
    if (newMC.currentFrame == newMC.totalFrames )
    newMC.removeEventListener( Event.ENTER_FRAME, onfrm);
    trace("End of banner");

    Just did a small test, and at least with loading a swf that has a timeline the totalFrames option works fine:
    var m:MovieClip;
    var a:Loader = new Loader();
    a.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    a.load(new URLRequest("anim.swf"));
    function done(e:Event):void
      m = MovieClip(a.content);
      m.addEventListener(Event.ENTER_FRAME, chek);
      addChild(m);
    function chek(e:Event):void
      if(m.currentFrame == m.totalFrames){
      trace("done");
      m.removeEventListener(Event.ENTER_FRAME, chek);

  • Error 2044 when loading external swf into my site

    Ok what i have is a site made from 1 flash file where i am loading external swf files for my picture galleries. now what is happening is in Flash, dreamweaver and when i test the site, everything is working perfectly, the problem is coming when i go into internet explorer go to the site and click on the flash button to go to the picture gallery, that is when it is giving me a Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
    does anyone know why this is happening and a possible way to fix it? thanks

    See if the following link helps at all...
    http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=20453

  • Determine when a QT video has finished playing w/ javascript

    I need to determine when a video clip is finished playing so that I can trigger a function to perform other actions. I can find functions on how to monitor loading & that sort of stuff. But, I can't find a way to monitor when it's finished playing.
    The video clip will be loaded 100% first, then played without any controls (forced to play through), and then hopefully have a function to play it.
    I could always try to determine that if it's a 30 second clip that 30 seconds after it's loaded 100% to perform the action, but I'd rather just have something monitor when it's finished.
    Any suggestions?
    Thank you,
    scott

    Hi Tracy thanks for your reply!
    Yep sorry I know swfloader cant play video but what I have is
    actually a music video swf.
    Would you be able to give me a small example of how i can
    listen for that event please because I have tried listening for a
    'complete' event but it never gets fired?
    Many thanks
    Flexchief

  • Strange LayoutManager error when loading external swf

    The swf loads and I get no popup errors in the browser.  But in debug mode my FlexBuilder console reads:
    [SWF] C:\~projects\source\flexbuilder\tests\dyvetntive_moderator_test\bin-debug\assets\swf\pres entation.swf - 1,592,516 bytes after decompression
    undefined
        at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:668]
        at Function/http://adobe.com/AS3/2006/builtin::apply()
        at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
        at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]
    Loading other swf's produces the same result.
    What is that?

    Turns out it's probably a bug:
    http://bugs.adobe.com/jira/browse/FB-24339
    Third party vendor wrote:
    We have researched this issue. It's not an issue of ours. The crash happens when the loaded AS2 Movie uses _quality property of the MovieClip object.
    Step 1 to reproduce the issue.
    Create a simples AS2 file with Adobe Flash Studio which has the only line:
    this._quality = "BEST"
    and publish this Flash file into "QualityBug.swf" file.
    Compile the following application with Flex. As you can see there is no code of ours at all:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="onInit()">
       <mx:Script>
          <![CDATA[
             import mx.core.UIComponent;
             import flash.display.Loader;
             import flash.net.URLRequest;
             private function onInit():void
                var loader:Loader = new Loader;
                var container:UIComponent = new UIComponent();
                container.addChild(loader);
                this.addChild(container);
                var request:URLRequest = new URLRequest("QualityBug.swf");
                loader.load(request);
          ]]>
       </mx:Script>
    </mx:Application>
    Launch this application in debug mode. The same crash. This means that issue is related to Adobe product family.
    We will try to report to Adobe about this issue.
    Since the issue happens only when debugging on IE we may recommend using other web browser for these purposes, for example Firefox until Adobe fix the problem with their product.

  • Knowing when an item value has changed

    Hello
    If you have a item in a form - :P1_fred which is a database columm fred
    The database table conrtaining fred columm is read and updated by
    1) Automated Row Fetch
    2) Automatic Row Processing
    This works fine
    I need to add a condition based if the valve of :P1_fred has changed.
    My currect way at the monument is to record the value after the Automated Row Fetch to :p1_fred1
    Then compair :P1_fred to :P1_fred1 and before the coniition before Automatic Row Processing
    Whiile this works, is there a simple way of doing this?
    Thanks
    Pete

    Hi Pete,
    I never do "By Reference" (or OUT) for parameters - I tend to create functions instead of procedures and do:
    SELECT check_file_one(:new.key) into status1 FROM DUAL;or something similar.
    From what I can see of the create procedure guide, you can use as many OUT parameters as you like: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_6009.htm#sthref7098
    The only time I've seen anything similar is when one process has terminated and cleared out the variables. But this was when I'd have / or GO in the procedure itself.
    What happens if you create a second variable for status1 (say, status1copy) and set this as "status1copy := status1" immediately before the second procedure call - does status1copy retain its value?
    Andy

  • How do you know when your raid controller has gone bad?

    I fired up my xserve raid 14X400 with 2X512mb Raid Controllers and drives 1-7 on the left won't show up at all. I swapped the controllers and then drives 8-14 won't show up. I have been trying to update the firmware from 1.5 to the latest and keep getting an error with the upper controller. I can't find anywhere that you can buy a new controller. Anybody know what I should do? My apple warranty ended in June and I didn't update it so Apple isn't going to help. What should I do? Can you have the controller card itself serviced? Thanks for any help. Also, I'm hoping that my media is still good?
    Todd Stanley
    Deadliest Catch Producer/shooter

    Hi
    If you have swopped the controllers around and the problem follows the controller then that is a pretty good indication that something is not quite right with the controller. Obviously reseating - basically pulling out the affected controller, a good blast of air inside to remove and dust/grit that might possibly be stopping a good connection and pushing it back again - the controller to see if that makes a difference is one thing you should do. Swopping them over effectively does this anyway. What does the events log in RAID Admin say? There is usually some indication in the log if there has been a problem.
    Its an obvious question and possibly you may have forgotten it in the panic but when you purchased the XServe RAID did you not take up the spare parts kit option? If you did install the replacement controller. If you did not and in view of the fact you did not take out the extended warranty seems overly optimistic, your only recourse in my view is to remove the affected controller and send it to your nearest Apple Repair Specialist - or deal with Apple themselves. They should send you a replacement under their Global Service Exchange Program. Make sure you send the faulty part as well as knowing the XServe RAID’s Serial Number. They should send a 90 day warranty replacement within 2 days. If you are in the UK its going to be expensive (approx £350VATshipping). Actually its going to be expensive wherever you are.
    There is a possibility that one of the other guys knows a method of getting this going again and will hopefully post a suggestion soon. However the sooner you act on this the sooner you can get your RAID array back on line. I do hope you have a current and effective backup in place just in case. You should be doing this anyway.
    Hope this helps, Tony

  • How to know when a submitted app has been approved by firefox os marketplace?

    I have submitted an app on the firefox marketplace as a developer but don't know if it has been approved yet. How can i tell when it will be approved?

    hello, when you sign in to your developer account at https://marketplace.firefox.com/developers/ and go to your submission, you should see a menu "Status and Version" which contains information about the status of the review process.
    https://developer.mozilla.org/en-US/Marketplace/Publishing/Submit/Overview

  • How do I know when S1 yoga battery has been fully charged when it's powered off?

    Is there a way to find this out WITHOUT turning on the computer?
    Solved!
    Go to Solution.

    Thanks Jin!
    That's what I was afraid of...oh well. The quirky thinkpad.

  • Action when "loadmovie" swf clip finishes

    Hi,
    I am a fledgling flash designer. I am moving on nicely with
    the program but I am stuck on one particular task, I was hoping
    that someone may be able to help me.
    I have a container movie which is a menu. That menu loads a
    buffered audio player movie into a target named "jukebox" that is a
    movie in itself with its place controls. Everything works 100%.
    Great. Except :-)
    I would like the jukebox movie to "know" when the loadmovie
    swf has finished so it can advance. At the moment if I dont place
    stop commands and user control buttons to move around the jukebox
    movie the jukebox just loads one then the other, it obviously
    doesnt wait until the loaded movie .swf has finished.
    I suspect it may be a case of making the individual loaded
    swf.s declare a variable which is equal to the frame its playing
    and then passing that variable off into the main movie and when if
    that variable total = complete frames then move to next movie...
    But being a novice I lack the script knowledge..
    Can anyone help?
    TIA :-)
    J

    if you're loading into bo_mc, you can't control where your
    loading image is going to be positioned inside bo_mc: the top left
    of your loading image will be placed at the center of bo_mc and
    there's no way to change that.
    and your container movieclip (bo_mc) may, and probably
    should, be an empty movieclip with 0 width and 0 height. so,
    centering within bo_mc, in that situation, makes no sense.
    and the only way to control the position of your loaded image
    is to control the position of bo_mc or one if its ancestors.
    so, you're more clear but you can't do what you're thinking.
    you can't keep the mc (bo_mc) static and center the loaded jpg.
    you can load into bo_mc and then position bo_mc so it's
    centered with respect to the stage or any other movieclip on-stage.
    that way your image will be centered.

  • Knowing when a swf loaded in MovieClipLoader has finished animating

    Hi,
    I'm trying to create a wrapper written in ActionScript2, which loads a second AS2 swf then when this loaded swf has finished animating the wrapper will load a second swf.
    This is the code I have to load the first swf:
    this.createEmptyMovieClip("containerClip",this.getNextHighestDepth());
    var movLoad:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();
    myListener.onLoadProgress = function(thisClip:MovieClip)
         thisClip.onEnterFrame = function()
              trace("CurrentFrame:" + this._currentframe);
              //trace("TotalFrames: " + this._totalframes);
              if (this._currentframe == this._totalframes)
                   //trace("true");
                   movLoad.loadClip("number2.swf",this);
              //trace("false"); 
    movLoad.addListener(myListener);
    movLoad.loadClip("number1.swf",this.containerClip);
    I can get the total number of frames from the loaded swf, but how can I check when I reach the total number so I can remove the first swf and load the second one?
    Stephen

    Hi,
    This is what I have so far:
    this.createEmptyMovieClip("containerClip",this.getNextHighestDepth());
    var movLoad:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();
    myListener.onLoadInit = function(thisClip:MovieClip, loadedBytes, totalBytes)
         this.onEnterFrame = function()
              trace("CurrentFrame:" + thisClip._currentFrame);
              trace("TotalFrames: " + thisClip._totalframes);
              if (thisClip._currentframe == thisClip._totalframes)
                   movLoad.unloadClip("C:/development/projects/CMSwfLoader/assets/Yahoo_Smart_Banners_Loans_300x250_v2.swf");
                   movLoad.loadClip("C:/development/projects/CMSwfLoader/assets/300x250_2p_12Mb_tipografica.jpg",this);
    movLoad.addListener(myListener);
    movLoad.loadClip("C:/development/projects/CMSwfLoader/assets/Yahoo_Smart_Banners_Loans_300x250_v2.swf",this.containerClip);
    But I found that the onEnterFrame is not called at all, I want it to be called on the movieClip that has been loaded, so I can tell when it has reached the last frame. Is the problem because I'm listening for onLoadInit?
    Stephen     

Maybe you are looking for