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     

Similar Messages

  • How to know when a .swf file ends

    I have a base .swf file that opens and plays another .swf
    file. I want to know when that .swf file has finished so I can then
    open a third .swf file inside the original.
    Thanks.
    Rob Childress

    In Flash 8 AS1 or 2 look at
    MovieClip._currentframe
    and
    MovieClip._totalframes.

  • Controlling SWF loaded through MovieClipLoader

    Hello AS gurus,
    I have a two-level site for a portfolio where users can view
    still images and videos for different projects. The top level SWF
    file can be considered as the "parent SWF" and within this file,
    the user navigates by choosing which project he/she wants to
    explore. After choosing, the "parent SWF" loads in a "child SWF"
    via MovieClipLoader of the selected content. It is within this
    "child SWF" that the user can view the various images and videos
    (with sound) of the selected project. To go back out and choose a
    different project, the parent SWF is used and the user navigates to
    and chooses another project.
    The problem is that I can't figure out how to communicate
    from the child SWF to the parent SWF (and vice versa)...well not
    really...this is difficult to explain...hmmm... It would be better
    to explain it with an example...
    If you go to:
    http://www.culshaw.info/junk_drawer/xdin/swf/
    (1) Choose the "Examples" square (when this box zooms up, you
    are presented with a way to navigate to various projects -- this
    SWF that loads as the zoom up happens is what I am calling the
    "parent SWF").
    (2) Choose the second project, labelled "Ford : Ti-VCT" by
    clicking on it (after clicking on the Ford project, the "child SWF"
    is loaded via a MCL from the "parent SWF").
    (3) You can see that the Ford project has 8 images and one
    video that the user can view. Choose the video and ensure that it
    begins to play and hit the mute button so that you hear sound
    (sound is default muted. It is within this "child SWF" that the
    video is NetStream(ed) and the sound is controlled. (there is a bug
    with my code here so you may need to hit play/pause to get the
    video going).
    (4) Now, as the video is playing and you hear sound, click on
    the "Other Examples" button that is located below the video player.
    This button is actually embedded in the the "parent SWF" that
    allows the user to navigate back up to see other projects and not
    in the "child SWF" which contains all of the content. Notice that
    you continue to hear the sound and that the net connection is still
    streaming the video within the "child SWF". I don't want this to
    happen. I want the "parent SWF" to tell the "child SWF" to stop
    streaming and stop all sounds when this "parent SWF" - embedded
    "Other Examples" button is pushed.
    I can't figure out how to do this. Any info that may help
    would be appreciated...
    -john

    Hi,
    It looks to me that the example you are going by has a main
    navigation in the parent swf that is controlling which child movie
    is loaded in and each child swf has its own internal navigation. If
    this is what you are trying to achieve and you are using
    _root.MoveClipName to target things you need to use the lockroot
    code so the flash player knows what root you are talking about.
    Place on the first frame of each Child swf
    this._lockroot = true;
    Hope this helps

  • Need to stop cursor moving when external swf loads???

    Hi, I am using a magnifying glass as part of my portfolio but when I click on another section and this loads an external swf above the main movie, because you can still see the main movie below, you can see the magify glass still moving as you move the cursor above??
    you can see what I mean at :
    www.zoeglazebrook.co.uk
    any ideas how I can stop the magnify glass moving while i am on the external swf above?

    OK, I wasn't following what that code was doing before, but try replacing all the code I gave you before with this (put it all on the timeline, and remove that function from the movie clip):
    var mGInt;
    magnifyingGlass.onPress = function(){
         startGlass();
    function startGlass() {
         magnifyingGlass.startDrag("", true, 215, 120, 1080, 660);
         mGInt = setInterval(updateGlassImage,100);
    function stopGlass(){
         magnifyingGlass.stopDrag();
         clearInterval(mGInt);
    function updateGlassImage(){
         largeobject._x = (original._x-magnifyingGlass._x)*2;
         largeobject._y = (original._y-magnifyingGlass._y)*2;
         updateAfterEvent();
    webBtn.onRelease = function()
         disableBtns();
         stopGlass();
         loadMovieNum("Advertorial/Advertorial.swf", 1);
    function enableBtns():Void
          webBtn.enabled = true;
    function disableBtns():Void
          webBtn.enabled = false;

  • How do I know when a file loaded into a Sound object is invalid?

    I'm writing an app that allows the user to play various sound files.
    Some of these files are mp3, but some may also be ogg, wma, etc.  The selection is out of my control, so I need the sound API to tell me if it can't play something.
    To test, I loaded some test files into a sound object like so:
                    var urlRequest:URLRequest = new URLRequest("http://support.microsoft.com/support/MediaPlayer/wmptest/samples/new/mediaexample.wma");
                    var sound:Sound = new Sound();
                    var soundChannel:SoundChannel = sound.play();
    Even though Flex doesn't play wma's there is no error information or null objects anywhere.  Everthings seems to be fine to flex, I can even register for progress events and see the wma being loaded.
    Just to see how far this goes, I loaded a gif instead of an audio file and the same thing happened.  Progress went fine with no errors of any kind even though I registered for every listed event.  As expected though, no sound played from the gif file.
    What is the recommended way for checking if a file is not playable?

    I'm looking more for an "is it playable" value (since it might be an FLA or FLV as well).
    Even a meaningful length value would work (for some reason duration is set to a value even when loading a gif file - not sure what it means for a GIF to have a length of 96 milliseconds).
    For now I'll have to filter on extension as you mentioned.

  • Knowing when repainting has finished

    Hello,
    I want to perform an action immediatley after repainting a Panel is finished (and not during repainting).
    Is there a method that I can call which tells me when the repainting of a component has finished?
    Thanks

    If you are currently repainting and want something to be called when repainting is done, you can use SwingUtilities.invokeLater(...)

  • The next screen's audio starts playing when the current screens audio has finished

    So I've added audio to a few screens and on the first couple it works fine. I have added a mute button and that's all, I just want the audio to play to the end then stop on each screen. It does that perfectly on the first few screens and then at a certain point, when the audio for that screen has finished, it plays the audio for the next screen, and the next, and so on even though I haven't moved on. I can't work out why it's doing this! Sure someone can explain what I've done wrong. Using Captivate 8.0.1...

    I adjusted them on one screen and it      worked - you've solved my problem again -  Thank you!
    Is there a way I can make my audio files load up like this automatically?

  • When class gets loaded and unloaded

    Hi,
    I want to know when class gets loaded in to the memory, is it when the class is called for the first time??. Also how much time the loaded class will stay in the memory. when the class gets unloaded ??
    chetana_vir

    hahaha class gets loaded or class object?Class. Objects don't get loaded.
    @OP: It certainly gets loaded no later than when the class is first referenced in your code. I may permissible to load it earlier. I don't know the details. Look [url http://java.sun.com/docs/books/jls/second_edition/html/execution.doc.html#44459]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#19175]here or [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html]here
    Unloading of a class can only happen if there are no more references to the class or to any instances of it, and if it was loaded by a classloader other than the primordial or the system classloader. It will be unloaded when the classloader that loaded it is unloaded. I forget the details of when this happens, but there can't be any references to any classes loaded by that loader (or to any instances of those classes).
    [url http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#32202]here for unloading info.
    [url http://java.sun.com/developer/JDCTechTips/2003/tt0819.html#2]Unloading and Reloading Classes
    (which came from http://www.google.com/search?q=java+tech+tip+class+loader&sourceid=opera&num=0&ie=utf-8&oe=utf-8)
    ¶

  • Need to know when text has finished loading

    The following code loades text into a textfield the problem I'm having is the routine at the bottom runs before the text loads and the scrollbar disappears even when there's enough text to overflow the textfield.  How would I make sure the text has finished loading before running the code that enables/disables the scrollbar?
    mainText.htmlText = main[1];
    textFieldLength = mainText.text.length;
        if(mainText.length > textFieldLength){
            mainScroll._visible = true;
        }else{
            mainScroll._visible = false;

    I messed up the example.  All I really need to know is how can I determin when a dynamically textfield overflows.

  • Knowing when a page has finished loading

    Hi all,
    I've  produced  a small project that has  a  few tabs, each tab contains an IFrame UI, which loads a BW report.
    I've been asked to  add an indicator that should tell when the reports are finished loading.
    I have two problems:
    1. How  do I know when the frame has finished loading the url? I know I can use the OnLoad tag in html, but how can I edit the HTML WebDynpro produce?
    2. What kind of indicator can I use? I thought of two options - Putting the "Progress Clock" which WebDynpro uses when calling an RFC, and for that I need to know if it's even possible  to call that clock.
    The 2nd option I thought  of is using the ProgressIndicator UI, and just divide the 100% to the number of tabs, and change the percent value when each tab  has  finished loading the URL.
    I appreciate any help  that  you  could provide.
    Yaniv

    Armin Reichert -> I've tried what you suggested about the portal integration (I send parameter to an URL Iview, which changes the url), and it works great!
    Thanks.
    Noufal Kareem -> Because I use an IFrame UI which loads a BW report, I don't have an indication (The WD don't know / care if the page inside the frame was loaded.)

  • Can you print from an iPad 2 using 3G in a home with no computer or wifi by using an iPhone 5 hot spot connection if the printer has been set up in another place with live wifi? I know this question is loaded but my dad lives in a rural area

    Can you print from an iPad 2 using 3G in a home with no other computer or wifi by using an iPhone 5 hot spot connection if the printer has been set up in another place with live wifi? I know this question is loaded but my dad lives in a rural area and is wanting a printer to use occasionally. He doesn't want to deal with a computer and I keep his iPad updated for him at my home.  Please shed some light on this for us PLEASE. Thanks

    In that case, it should be possible. I haven't tried this directly, but I believe it should work.
    You'll need to get an actual AirPrint compatible Printer.
    Check here for a list of Printers you can choose from.
    http://support.apple.com/kb/ht4356
    Once you have the compatible printer, using the Hotspot feature from the iPhone he'll have to create the Wifi bubble form the iPhone, and connect the Printer to that Wifi network.
    Then connect the iPad to that same Wifi network provided by the iPhone. When all that is done, the printer should appear in any of the Apps that can Print under the Action Arrow button.
    For instance in email, pressing the action arrow should show a Print option. In there the printer should appear.
    Alternatively you can simply buy a wireless router and setup the network through there even if there is no internet attached.  Connect the wireless printer to the router network, and connect the iPad or iPhone to that same wifi network to print.

  • How can I tell when a JEditorPane has finished loading the document?

    Hi!,
    I've got a JEditorPane connected to a viewport and a couple of scrollbars, and I realy need to know when the JEditorPane has completed loading the document, so that I can decide whether to turn on or off the scrollbars.
    When I try to check the viewport.getView().getWIdth() right after calling setText() or setPage() the values come out wrong... is there an eventHandler that I can register ?
    thanks in advance
    -Miguel

    OK, I'm not an expert. But, why set the scrollbars manually? Would it not be easier to put the JEditPane in a JScrollPane with the scroll policy set to "as needed"?
    Ken

  • Stopping external SWF when new SWF is loaded

    Ok.... hmmmmm. I am currently working on a flash site that
    loads external SWFs for each page. one of the SWFs contains a
    sitepal movie. the sitepal has been coded to stop playing and
    unload on a frame change but it keeps playing when a link in the
    index is clicked and another SWF comes in. (in other words there is
    no frame change. the new SWF loads but the old one keeps playing)
    make sense?
    I just need the site pal to stop playing when the next SWF
    loads!
    each link on the bottom is part of the main.swf
    (index.swf)...
    I need the links on the bottom to "turn off" the SWF when a
    new page is choosen. the External SWFs are labled 1-5....
    attached is a simple diagram in .jpg format explaining the
    functionality of the site!
    any insight is appreciated...
    PS
    IM NO CODE MONKEY.... more of a point-click, copy-paste type
    o dude..

    HI,
    My files loads an external swf (containing the video) into a
    container on my stage. The loaded swf contains the embedded wmv
    movie file, which is quite large I might add. Do I need to cut file
    size or change to flv?
    thanks again.

  • TS1702 I cannot get the keyboard to come up on the ipad mini when in the citrix receiver.  Has anyone ran into this and do you know how to fix it?

    I cannot get the keyboard to come up on the ipad mini when in the citrix receiver.  Has anyone ran into this and do you know how to fix it?

    I am not familiar with Citrix Reciever but is it possible it is open or being used in another open app?
    Try quitting all apps then try again.
    Quit all apps: Double tap the Home button and swipe the app preview page up for each open app

  • I have my credit card on my daughter's i pod and i needed it to set up the apple id how do i make it so she can't spend any of the money but still get free apps.? Also she has a$15 app card on there how do I know when she buys apps which payment it takes?

    I put my credit card on my daughters new i pod. How do I block her from buying apps but still being able to download free apps? Also she has a $15 app card on the i pod how do i know when she buys something whitch payment it will take the visa or app card? PLEASE HELP A.S.A.P. THANK YOU

    You can
    Create a NEW account using these instructions. Make sure you follow the instructions. Many do not and if you do not you will not get the None option. You must use an email address that you have not used with Apple before.
    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    You can have apps purchased from more than one account. It does complicate update apps though.
    - Go to settings>Store and sign out and sign into your account.
    - Apps are locked to the account that purchased them.
    - To update apps you have to sign into the account that purchased the apps. If you have apps that need updating purchased from more than one account you have to update them one at a time until the remaining apps were purchased from one account.

Maybe you are looking for