Unloading SWF movie

Hi,
I've been working on a CD-Rom presentation with Flash and so
far I was mostly using AS1 and AS2 to built it. I started to learn
some AS3 for a part of the presentation but now I'm running into
issue, here's the main one:
I'm loading different SWF movie one on top of the other, and
unloading them as needed, now this is very easy with AS1 (loadmovie
and unloadmovie function are simple to use), but when I'm loading
my file built with AS3 I can't figure out how to unload it. The AS3
movie is loaded on the Level 5, I just want to make sure that when
I'm unloading the file it's not unloading everything else.
Can anyone help me.
Yann Poirier

Disregard, I found my answer

Similar Messages

  • Hello please, somebody knows how to unload a movie clip recently loaded and back to the main SWF?

    Good night guys!
    I come humbly ask for your help ...
    I have an extensive animation .. A kind of map of Brazil with 33 stores in 4 states distributed .. Clicking on the desired state, it expands and appear their stores. Only the animation and the first store were enough to generate a SWF comporting 3 megabytes .. So I decided to use an external SWF to every single stores, otherwise would be too heavy ..
    My goal is: Every shop clicked, loads a new external SWF which occupies the entire screen .. So if I wanted to return to the main SWF with button, how should I proceed?
    I have found an article that shows communication between two SWF, however, some steps did not work and I want it to button.
    Please, if you know, needs to be in ActionScript 3.
    Can somebody help me?
    Thanks, I hope to answer

    Olá Felipe, tudo bem com você?
    In order to unload content loaded into a Loader object you can use either the unload() method or the unloadAndStop() method. The difference between them is that unloadAndStop() will unload the loaded SWF and try to stop executing any code that it was running including animations, sound and event listeners.
    If you wanto to call the unload() or unloadAndStop() methods from the loaded SWF you can use its loaderInfo.loader property to reference the Loader object that loaded it.
    It could be someting like this:
    this.closeButton.addEventListener(MouseEvent.CLICK, this.handleClose);
    protected function handleClose(event:MoueEvent):void {
         this.loaderInfo.loader.unloadAndStop();
    You can pass a Boolean parameter to unloadAndStop() to indicate if Flash's garbage collector should be run ont the unloaded SWF in order to free up memory. Considering the size of your SWFs, this could be a good option. The downside is that there is a performance penalty and in my professional experience, CPU is still a resource that is more scarce than memory, so use with care.
    Hope this helps.
    Abraço,
    Rui

  • Unload parent movie after onloadInit of child movie

    Hi,
    I am loading external swf's into a main load.swf, using a Moviecliploader object. What I basically want to do is that, after an external movie, say home.swf, loads another external swf, say about.swf, home.swf should be unloaded.
    home.swf is loading about.swf into the _root.mc_holder, which is placed inside load.swf. I want all external files to be placed within this holder. Now this is working with some files, but not with others. My standard code within all files is this:
    //code within home.swf to load about.swf
    var loader:MovieClipLoader = new MovieClipLoader();
    var ldrlistener = new Object();
    loader.addListener(ldrlistener);
    ldrlistener.onLoadStart = function(_mc:MovieClip) {
        trace("about loading started");
    ldrlistener.onLoadProgress = function(_mc:MovieClip, loaded:Number, total:Number) {
        var prcnt:Number = Math.floor((loaded/total)*100);
        if (prcnt == 10) {
            trace("loading:10");
            ldgraphic.gotoAndStop("ten");
        if (prcnt == 15) {
            trace("loading:15");
            ldgraphic.gotoAndStop("fifteen");
        if (prcnt == 20) {
            trace("loading:20");
            ldgraphic.gotoAndStop("twenty");
        if (prcnt == 25) {
            trace("loading:25");
            ldgraphic.gotoAndStop("twentyfive");
        if (prcnt == 30) {
            trace("loading:30");
            ldgraphic.gotoAndStop("thirty");
        if (prcnt == 40) {
            trace("loading:40");
            ldgraphic.gotoAndStop("forty");
        if (prcnt == 50) {
            trace("loading:50");
            ldgraphic.gotoAndStop("fifty");
        if (prcnt == 55) {
            trace("loading:55");
            ldgraphic.gotoAndStop("fiftyfive");
        if (prcnt == 60) {
            trace("loading:60");
            ldgraphic.gotoAndStop("sixty");
        if (prcnt == 70) {
            trace("loading:70");
            ldgraphic.gotoAndStop("seventy");
        if (prcnt == 80) {
            trace("loading:80");
            ldgraphic.gotoAndStop("eighty");
        if (prcnt == 100) {
            trace("loading:100");
            ldgraphic.gotoAndStop("hundred");
    ldrlistener.onLoadInit = function(_mc:MovieClip) {
        ldgraphic._alpha = 0;
        trace("load completed");
    loader.loadClip("about.swf",_root.mc_holder);
    this.unloadMovie();                    //unloads home.swf, which was loaded from load.swf
    Now the problem is, it is successfully unloading the movie, but after a while it stops doing this. Is there something wrong with the code?? Any help will be greatly appreciated.

    Hi Kglad,
    I seem to have managed to get it to work so far. But once again, I can't be sure as it seems to stop working on its own. Also, if I do not insert the this.unloadMovie, the next movie does not load in some cases. I think I need to reconsider my strategy, but for now this will have to do. Thanks for the response

  • SWFLoader.unloadAndStop() - does it unload swf and release memory?

    Hi all,
    Do SWFLoader FP10 unloadAndStop() and GC really unload swf?
    I have simpliest test case possible when parent app creates new SWFLoader, loads sub app and then unloads it.
    Every time when it does it I see memory grows. The sub app is tiny:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Label id="idLabel" color="blue" text="This is embedded application."/>   
    </mx:Application>
    The parent application is also simple
    public function loadSwf(name:String):void
      loader.addEventListener(Event.COMPLETE, completeHandle, false, 0, true);   
      loader.showBusyCursor = true;
      loader.scaleContent = true;
      loader.source=name;     // name is subappswf.swf the
      loader.load();
    private function completeHandle(event:Event):void
      loader.removeEventListener(Event.COMPLETE, completeHandle);
      loader.unloadAndStop(true);
    Profiler shows decent Peak Memory and even Cumulative Memory does not seem horrible. There are no objects hanging in sub-application except SystemManager. But Google Chrom Task Manager shows the real picture:  Shockwave Flash memory grows and as soon it reaches threshold ~0.5 GB, application becomes unresponsive and eventually FP crashes.
    What else should be done to free up memory?
    Regards,
    Ilya

    This is iInteresting...
    /*** Unloads an image or SWF file. After this method returns the
    * <code>source</code> property will be null. This is only supported
    * if the host Flash Player is version 10 or greater. If the host Flash
    * Player is less than version 10, then this method will unload the
    * content the same way as if <code>source</code> was set to null.
    * This method attempts to unload SWF files by removing references to
    * EventDispatcher, NetConnection, Timer, Sound, or Video objects of the
    * child SWF file. As a result, the following occurs for the child SWF file
    * and the child SWF file's display list:
    * <ul>
    * <li>Sounds are stopped.</li>
    * <li>Stage event listeners are removed.</li>
    * <li>Event listeners for <code>enterFrame</code>,
    * <code>frameConstructed</code>, <code>exitFrame</code>,
    * <code>activate</code> and <code>deactivate</code> are removed.</li>
    * <li>Timers are stopped.</li>
    * <li>Camera and Microphone instances are detached</li>
    * <li>Movie clips are stopped.</li>
    * </ul>
    * @param invokeGarbageCollector Provides a hint to the garbage collector to run
    * on the child SWF objects (<code>true</code>) or not (<code>false</code>).
    * If you are unloading many objects asynchronously, setting the
    * <code>gc</code> parameter to <code>false</code> might improve application
    * performance. However, if the parameter is set to <code>false</code>, media
    * and display objects of the child SWF file might persist in memory after
    * the child SWF has been unloaded.
    public function unloadAndStop(invokeGarbageCollector:Boolean = true):void
    useUnloadAndStop =
    true;unloadAndStopGC = invokeGarbageCollector;
    source =
    null; // this will cause an unload unless autoload is true
    if (!autoLoad)load(
    null);}
    It means that if autoload is true (default) unload will not happen and sub-app
    will persist in memory.
    Regards,
    Ilya

  • How to unload a movie clip within a movie clip.

    Hi all,
    I am trying to unload a movie clip that is on a layer in a
    movie clip. After clicking on a button, I would like the movie to
    go back to the previous menu without playing a couple of movie
    clips that's in the main movie clip.
    So at the end of my movie clip I have:
    _parent.gotoAndPlay("resources"); // resources is the frame
    name in the main movie clip where I would like the movie to restart
    from
    _parent.vhost_mc.unloadMovie("vhost_mc"); //vhost_mc is a
    movie clip in the main movie clip that I want to unload
    _parent.videoScreen_mc.unloadMovie();
    But the videoScreen_mc doesn't unload. The main movie clip
    starts with the videoScreen and I've actually deleted the frames of
    videoScreen_mc where the "resources" frame starts, but still it
    appears.
    I've even tried _parent.videoScreen_mc._visible = false; but
    nothing works! I've tried createEmptyMovieClip, but since the
    videoScreen_mc is on the main timeline, I don't think it works.
    I've even tried putting this function on the "resources" frame:
    onEnterFrame = function() {
    play();
    vhost_mc.unloadMovie("vhost_mc");
    vhost_mc.removeMovieClip();
    this.videoScreen_mc.unloadMovie();
    this.videoScreen_mc.removeMovieClip();
    this.mask._visible = false;
    But when I do this, the play button loops starting at the
    "resources" frame.
    Essentially I would like the main movie clip to play without
    certain movie clips that's included within the main movie clip.
    I hope I'm making sense. Please help, I've been at this for
    days!

    Olá Felipe, tudo bem com você?
    In order to unload content loaded into a Loader object you can use either the unload() method or the unloadAndStop() method. The difference between them is that unloadAndStop() will unload the loaded SWF and try to stop executing any code that it was running including animations, sound and event listeners.
    If you wanto to call the unload() or unloadAndStop() methods from the loaded SWF you can use its loaderInfo.loader property to reference the Loader object that loaded it.
    It could be someting like this:
    this.closeButton.addEventListener(MouseEvent.CLICK, this.handleClose);
    protected function handleClose(event:MoueEvent):void {
         this.loaderInfo.loader.unloadAndStop();
    You can pass a Boolean parameter to unloadAndStop() to indicate if Flash's garbage collector should be run ont the unloaded SWF in order to free up memory. Considering the size of your SWFs, this could be a good option. The downside is that there is a performance penalty and in my professional experience, CPU is still a resource that is more scarce than memory, so use with care.
    Hope this helps.
    Abraço,
    Rui

  • RH 7 - How can I get .swf movies to work inside CHM output on Windows 7

    Hi RHelpers,
    I'm using RoboHelp Html (RH 7, latest patch) on my Win 7 64-bit machine to provide a HtmlHelp (CHM) output.
    Now that we're close to releasing, I've been doing some testing, and I've noticed that my SWF movie files do not play inside of Windows 7 when viewing them inside of the CHM file. It keeps asking to install the Adobe Flash Player. But I've already clicked Yes several times to that message, and it still doesn't play the file. I've even manually downloaded and installed it as an administrator, restarted my system and still no go. It just shows a red X in the container where the movie should be playing.
    However, viewing the same topic inside of RH's preview window (or inside a browser) seems to work fine. Also, I've copied and pasted the problem CHM onto a virtual machine running 32-bit Vista, and the movies display fine there. This tells me it's something to do with how how compiled files are handled in 64-bit environments.
    Has anyone else experienced this? Any solutions out there?

    I see the answer here:
    http://forums.adobe.com/thread/781427?tstart=2
    Also I verified that our software does use the 32-bit hh.exe so I'm only seeing this when running the help by itself, outside of our software. That's good news.

  • Can an swf movie be opened on a specific frame?

    When I call up an Flash-generated swf movie in its own
    browser window via a navigation bar button, it always open on its
    first frame. Is there a way to tell the browser in conjunction with
    the getURL command to open at a specific frame other than frame 1?
    I can't find an Actionscript code sample that allows this while
    using getURL. Or is there some other way -- e.g. appending the swf
    file with frame number in its HTML page in some way, using
    Javascript, FSCommand, etc?
    Jody

    Maybe this will help
    http://www.adobe.com/devnet/flash/articles/deep_linking.html

  • Loading and unloading swf

    I am making a site and I want each button to load an swf,
    which would be the content of each page. When I click on each
    button the swf will load, however, the old swf will not go away.
    how does one do this. Thanks.

    It looks like you are adding the newly loaded swf, but not
    removing the old one. So, maybe this change would help:
    function about_CLICK(myevent:MouseEvent):void{
    var loadMain:Loader = new Loader();
    loadMain.load(new URLRequest("clip0.swf"));
    // if there is a child on the display list remove it
    if (getChildAt(0) !=null) removeChildAt(0);
    stage.addChild(loadMain);
    I should mention, however, that there is a bug in Flash 9
    related to unloading swfs:
    http://www.gskinner.com/blog/archives/2008/04/failure_to_unlo.html
    However, I don't think this is affecting your visible
    behavior.

  • Replace one swf movie with another

    I have a flash movie on my web page and I have made some of
    the text inside the movie into buttons. The movie only takes up a
    portion of the page. I would like to replace the movie with another
    movie when somebody clicks the button.
    I'm sorry if this is a really basic question but I have spent
    ages trying to find out how to do it and I keep getting an error
    when I try to search this forum.
    Thanks for your help.

    Thanks for your help so far. I seem to be having more and
    more trouble though!
    I have a swf file (sunnyserv.swf) that contains a pre-loader
    and then opens another swf file (downturn.swf). The downturn.swf
    contains the buttons that I want to listen to, and swap out the
    movies.
    If I open sunnyserv.fla in flash and test the movie, it loads
    downturn.swf, listens to the mouse click and runs the
    communication.swf movie (although it doesn't clear all of the
    children from downturn.swf).
    However, if I export all three movies and open my web page
    nothing happens! If I change the xhtml to load downturn.swf that
    works ok. Any idea why it would work in test movie but not when
    loaded into an xhtml page?
    Also, can you see a reason why all of the children are not
    being removed in the commClickHandler function?
    Code below:
    sunnyserv.swf (container)
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,
    loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("downturn.swf"));
    function loop(e:ProgressEvent):void
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    percent.text = Math.ceil(perc*100).toString();
    function done(e:Event):void
    addChild(l);
    removeChildAt(0);
    percent = null;
    downturn.swf
    import flash.events.MouseEvent;
    import flash.events.EventDispatcher;
    import flash.display.MovieClip;
    var l:Loader = new Loader();
    // add listeners for each button
    btn_communication.addEventListener(MouseEvent.CLICK,
    commClickHandler);
    function commClickHandler(event:MouseEvent):void {
    for(var i:int = 0; i < numChildren; i++){
    removeChildAt(i);
    l.load(new URLRequest("communication.swf"));
    addChild(l);
    stop();
    Hope somebody can help!

  • Using loadVariables with nested SWF movies

    I have a .swf with a dynamic text box that loads an external
    text file. Using both loadVars and loadVariables I can see the that
    text is loaded when i play just that file but when i nest the .swf
    into a movie clip in a container movie the text doesn't appear.
    I've used many different path and variable variations but with no
    joy. The nested .swf is loaded using this syntax...
    loadMovie("storyboard.swf",'_root.mainmask.inside_loader');
    the syntax I'm using on the storyboard.swf movie to load the
    text are variations on
    loadVariables("news.txt" this);
    I've tried playing with _parent and _root to get from the top
    level of the container movie to the nested one but can't hit the
    spot.
    Thanks in advance for any help.

    if you use loadVariables() (AND you correct your syntax) in
    storyboard.swf, then you should check to see if the variables are
    loaded before assigning their value(s) to the text property of your
    textfield. if the textfield is on the same timeline that contains
    the loadVariables code, you don't need to use an explicit path.
    in any case, you can always use trace(this) on
    1. the timeline where you want to put your code assigning the
    text property and
    2. on the timeline that contains your loadVariables()
    statement and
    3. on the timeline that contains your textfield.
    with those three trace statements you can get explicit help
    for the correct path if you're still having trouble.

  • Placed SWF movie options

    Using InDesign CS4, I've placed a SWF movie. In Object > Interactive > Movie Options, I chose to embed the movie in PDF, choose a JPG file as the poster, Mode: Play Once Then Stop, and turned on Show Controller During Play.
    Exporting the InDesign document to PDF, choose the Smallest File Size preset, Compatibility: Acrobat 8, Include Interactive Elements, and Embed Multimedia.
    The problems are that in the resulting PDF file:
    the controller bar does NOT show
    the movie loops repeatedly instead of playing only once
    Can anyone help?

    You could always use the Change Property behavior to swish
    that layer
    offscreen to the top left, e.g., change "top" to -10000 and
    "left"
    to -10000.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "lsb235" <[email protected]> wrote in
    message
    news:e3ebpf$qoq$[email protected]..
    > Tricky question for you.....
    > I've placed an swf movie in my main layout table and
    when I change the
    > visibility of my layers, it doesn't hide like everything
    else does.
    > Can it be done?
    > It always appears infront of the upper most layer.
    > Cheers
    > Laini
    >

  • Problem in importing swf movie

    I imported an SWF movie into my captivate project. The problem is that when I pause the project then the movie is not paused. How can I solve the problem?

    Hi there,
    Welcome to Adobe Community.
    May I know how have you inserted the movie file? Is that a video?
    Also which version of captivate you are using?
    Thanks!

  • Loader, Unload SWF and Warning: Ignoring 'secure' attribute........

    Hey all
    I was just simply trying to load one swf into another.  in my document class I have the following line of code in my constructor.
    var loadBoard:LoadBoard = new LoadBoard("Directory.swf");
    in my LoadBoard class:
    package com.myproject
         import flash.display.Loader;
         import flash.display.MovieClip;
         import flash.net.URLRequest;
         public class LoadBoard extends MovieClip
              public function LoadBoard(nameOfBoard:String)
                   var boardLoader:Loader = new Loader();
                   addChild(boardLoader);
                   boardLoader.load(new URLRequest(nameOfBoard));
                   trace("swf should be loaded");
    In my console I get the following when I debug"
    [SWF] U:\fullPath\Directory.swf - 69,058 bytes after decompression
    [SWF] U:\fullPath\Directory.swf - 2,067 bytes after decompression
    [SWF] U:\fullPath\Directory.swf - 322,606 bytes after decompression
    [SWF] U:\fullPath\Directory.swf - 112,558 bytes after decompression
    [Unload SWF] U:\fullPath\Directory.swf
    Warning: Ignoring 'secure' attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml.  The 'secure' attribute is only permitted in HTTPS and socket policy files.  See http://www.adobe.com/go/strict_policy_files for details.
    Not sure why I am getting this warning, when I googled it, the erro has to do with trying to load a file from another domain. My Directory.swf file is in the same location as my main swf, the bin-debug folder.  Also the Directory.swf does not seem to load into my main swf as I don't see it show up in the flash player when i run my app.   I am also a little confused on the [Unload SWF], I am not doing anything to tell it to Unload my swf.
    I am using FB to do all my coding and debugging if that matters.
    Does anyone have any ideas.
    thanks,

    Apparently I was, so I changed it to classic text in my Directory.fla and that seemed to remove the weird error.  However it seem that my swf is still not loading.  any Ideas why that might be?
    [EDIT]  Ok, my Directory swf is defenatly loading. but not showing up in the display list. I updated my LoadBoard to the following.
    package com.aces
         import flash.display.Loader;
         import flash.display.MovieClip;
         import flash.events.Event;
         import flash.net.URLRequest;
         public class LoadBoard extends MovieClip
              public function LoadBoard(nameOfBoard:String)
                   var boardLoader:Loader = new Loader();
                   boardLoader.load(new URLRequest(nameOfBoard));
                   boardLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
              public function finishLoading(loadEvent:Event):void
                   addChild(loadEvent.currentTarget.content);
                   trace("swf should be loaded");
    any Ideas?
    Thanks,

  • Redirect [SWF] and [Unload SWF] trace?

    Hi all!
    I was wondering if there is a way to redirect or disable
    [SWF] and [Unload SWF] based messages when working with external
    SWFS.
    Ideally I would like to redirect trace statements, but I
    doubt that's possible.
    Thanks!

    I would like to add a question to this topic, but instead of describing it, I would like to refer to this forum, where it was described very good: http://www.gotoandlearnforum.com/viewtopic.php?f=33&t=28730
    In short:
    When the loader object is only referenced by a local variable within a method and there's no other reference to the loader, other than the EventListener, the loaded SWF file is being sporadically unloaded (by the GC perhaps) before I am able to access the loader.content! That's kind of a bug, I guess and not acceptable!
    So any help would be much appreciated!
    Regards,
    Matthias

  • [Unload SWF] - Automatically unloading a swf while loading - GC issue?

    Hi, I am trying to load a few style SWFs at runtime using the StyleManager.loadStyleDeclarations. There are more than 4 style SWFs and I load them through a for loop and add the IEventDispatcher to an array as a reference.. The files seem to load properly. But some times, some of the style SWFs are automatically unloaded . I see the [unload SWF] in the log... I am not sure how to avoid the files being GCed at the time of loading... Also it seems like they are being loaded/ decompressed twice. Please see the log below...
    [SWF] /Flex/com/../styles/Common.swf - 45,421 bytes after decompression
    [SWF] /Flex/com/../styles/StyleSkin.swf - 253,886 bytes after decompression
    [SWF] /Flex/com/../styles/StyleSkin_Fonts.swf - 440,292 bytes after decompression
    [SWF] /Flex/com/../styles/ StyleSkin _Assets.swf - 189,281 bytes after decompression
    [SWF] /Flex/com/../styles/ StyleSkin _Assets.swf - 1,153,335 bytes after decompression
    [SWF] /Flex/com/../styles/ Common.swf - 1,153,335 bytes after decompression
    [SWF] /Flex/com/../styles/ StyleSkin _Fonts.swf - 1,153,335 bytes after decompression
    [SWF] /Flex/com/../styles/ StyleSkin.swf - 1,153,335 bytes after decompression
    [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/StyleSkin_Assets.swf
    [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/Common.swf
    [Unload SWF] /Flex/com/marketlinx/mls/client/ui/styles/StyleSkin _Fonts.swf
    How can avoid the files being GCed. is it because I  re use a single Loader (loadStyleDeclaration) to load multiple files?

    Both the copies go away.. and I don't load them twice , only once through a loop and when i debug and see the for loop below is executed only once... Am I not doing it the right way? . I am failry new to Flex and I couldn't find why Flex loads it twice
    This is how try to load them in the application...
    for   (var index:uint = 0; index < styleSheetFiles.length; index++){
    styleSheetsLoaded[index] =
    false; 
    // Load the stylesheet files
    var styleSheetFileFullPath:String = STYLESHEET_FILE_BASE_PATH + (styleSheetFiles[index] as String);eventDispatchers[index] = StyleManager.loadStyleDeclarations(styleSheetFileFullPath)
    as IEventDispatcher; 
    trace("loading: index" + index + " file:" + styleSheetFileFullPath); 
    // It doesn't matter whether the result is complete or error
    (eventDispatchers[index]
    as IEventDispatcher).addEventListener(StyleEvent.COMPLETE, styleSheetFileLoaded);(eventDispatchers[index]
    as IEventDispatcher).addEventListener(StyleEvent.ERROR, styleSheetFileFailed);}
    In the complete event I try to trace that the particular file has been loaded to see whether it has been loaded... But i don''t see it there...

Maybe you are looking for