unload the SWFs

Hi all


I tried to solve this problem for two days, and nothing helped...

I have a menu, which works with an xml file.
the XML contains the specific code that fires the .as file:

HTML code:
<buttons>
     <button name="HOME" linkType="custom" link="home.swf" />
     <button name="ABOUT" linkType=" _custom" link="about.swf" />
     <button name="BLOG" linkType=" _self" link="contact.html" />
    <button name="CONTACT" linkType=" _self" link="contact.html" />
 
</buttons>
now, the .as file, I load the movies:

var request: URLRequest = new URLRequest (link);
var loader: Loader = new Loader()
Loader.Load (request)
var swfContainer:MovieClip = new MovieClip;
this.addChild (swfContainer)
swfContainer.addChild (loader);

When I press the button home, for example, the House takes over...
then I press the button, and it loads as well, but the House continues to play on the back...
How can I make content for the House to disappear when you click another button?

because the code works for all buttons, there must be something generic... It works for the anybutton event that is clicked...

any suggestions?

Quite happy.

the error 1180 is the result to your document class extend the sprite class.  have it extend the movieclip class and you can attach code to frames.

Tags: Adobe Animate

Similar Questions

  • [Help] Button that closes or unloads the SWF itself and charge another.

    Hello! Could someone help me please?

    Maybe my question seems little obvious to you, I ask patience ^ ^

    I'll summarize as briefly as possible .. Imagine a presentation, interactive animation and full, with many ways or different possibilities...

    The method I use is to divide it into many different rulers, otherwise it would be ridiculously heavy...

    But that's the problem: when I want to load another SWF, he eventually overwrite the original and will become more slow and overloaded, because it consumes too much memory and frame rate decreases each new SWF loading...

    I wonder if there is a way to unload the SWF itself by button and move on to the next...

    Open
    LER foneticamente

    If you have a single swf file main who must simply acts as a container that loads of the FSV of presentation, you can use the Loader class to load the presentation files, and it includes methods to unload the files loaded as well.  Find the class Loader in the help documentation if you need more information.

  • Unload the SWF file

    Hello

    I am developing a portal application.  I load all the swf files in a configuration of trusted sandbox.

    When I unload the swf file as follows (note automatically load the value true):

    swfLoader.source = null;

    swfLoader.validateNow ();

    But when I run the Profiler on that I noticed that the application loaded the swf file is never garbage collected (i.e. There is an instance for each time I load the swf file).

    When I look at what has references to the application, I get the following:

    profiler.jpg

    Is there a standard method to remove the reference to the application so that it is unloaded.  Currently, my request is vanilla and there is nothing in the mxml.

    I doubt that the SystemManager is the issue.  I would look at the amount and names

    each class in the snapshots to see what the difference is.  I think so

    someone wrote recently having to unplug the RO in order to allow

    unloading.

  • Load and unload the swf file

    I am currently using AS2.

    I create a button instance named 'myBtn' and I want it to load the external swf "test2.swf" call all to unload the current swf file named "test1.swf" when you press on / release.

    that fact is I put the following code under mybtn:

    We (Press)

    {

    unloadMovie ("test1.swf");

    loadMovie ("test2.swf", 1);

    }

    the result was that the "test2.swf" was loaded successfully, but the "test1.swf" fail to unload.

    Any help is welcome

    AS2... Scope is your problem. When you are inside the function for delivery you tell the button you used to unload test1.swf of inside of this button (which it is not located in).

    You are probably using the root timeline, so I'll take a bet that it works:

    (press)

    {

    _root.loadMovie ("test2.swf");

    }

    If you want to follow the progress of loading between them, it is a bit more complex.

  • How to load external swf file and unload the swf file parent?

    I have a question. Let's say I have file1.swf, file2.swf and file3.swf, how can I link this 3 files together.

    Let's assume that file1.swf is the main content file, but as I load file2.swf, I want the file1.swf get replaced by file2.swf. How could unload file1.swf at that time, so that my file2.swf will become the main content file?

    and even once, when my current post file2.swf and I want it get replaced by file3.swf tinkle of a button. so that i can unload the file2.swf and let them file3.swf become the main content file...
    Anyone have ideas on this?
    Thank you..

    If you're publishing to fp 10 + use:

    var loader: Loader = new Loader();

    var urlR:URLRequest = new URLRequest();

    addChild (loader);

    Btn1.addEventListener (MouseEvent.Click, f);

    btn2.addEventListener (MouseEvent.Click, f);

    function f(e:Event):void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    {if(e.currentTarget==btn1)}

    urlR.url = "file2.swf";

    } else {}

    urlR.url = "file3.swf";

    }

    Loader.Load (urlR);

    }

    p.s. Please check the useful/correct, if there is.

  • Unload the SWF using SWFLoader

    Hello

    I have a main app where I use a SWFLoader for loading a second application.

    In the second application, I want to put a (Close) button and when I click it I want to download this application.

    Is it possible to do this?

    I know that I can unload a swf file using the SWFLoader unloadAndStop method, but how do I access it the loaded application?

    I think a different approach would be adding eventlisteners to the loaded swf but I do not know how.

    Can someone help me?

    Thanks in advance,

    Alberto

    Hello

    @Alberto

    I think a different approach would be adding eventlisteners to swf loaded but I don't know how to do this.

    I think you can use the event type to custom or built-in to send information to the hosting applications and SWFLoader * has * integrated dedicated routine to the context loaded unloading - which includes the removal of event listeners added to swf-types on content charge (Yes, there is a way in the kit Flex SDK to access applications above, but most often that is not advisable to access the methods and properties of the parent that it binds tightly) content together).

    For your initial claim could start listening to the custom events when the load completes and removes loading app like this:

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx" >

    protected function chidLoadedHandler(event:Event):void

    {

    swfLoader.content.addEventListener (Event.CLOSE, unloadChildHandler);

    };

    protected function unloadChildHandler(event:Event):void

    {

    swfLoader.content.removeEventListener (Event.CLOSE, unloadChildHandler);

    swfLoader.unloadAndStop (true);

    }

    ]]>

    <>

    Width = "100%" height = "100%".

    source = "ChildApplication.swf"

    Complete = "chidLoadedHandler (Event)" "

    ID = "swfLoader" / >

    While the demand of your children simply:

    http://ns.Adobe.com/MXML/2009.

    xmlns:s = "library://ns.adobe.com/flex/spark".

    xmlns:MX = "library://ns.adobe.com/flex/mx" >

    protected function unloadMeHandler(event:MouseEvent):void

    {

    We will ship event 'CLOSE' - this could be the type of custom event

    but I think it's just enoguht heres

    var closeEvent:Event = new Event (Event.CLOSE);

    root's highest - if it's 'content' more high display object so

    this.root.dispatchEvent (closeEvent);

    }

    ]]>

    Don't know if it's more evidence of ball or recommended solution but could be the starting point,

    Kind regards

    Peter

  • Unload the SWF

    I have an app that loads a SWF using the SWFLoader.  I can't seem to get discharged.

    1 State1 - user clicks on a text with a click handler, and thinks State2

    2 State2 is a component called 'main' demand, which includes a

    SWFLoader... source = "example.swf" id = "swfLoader_ID"...

    3. State the main applicatino 2 has a 'skip' button which must discharge the example.swf.  I use

    swfLoader_ID.unloadAndStop ();

    which works very well in other situations, but not in this one.  Any help is apprecitaed.

    Thank you.

    I don't know if this could be useful for you, but here goes: once I had to load a SWF (video) file and use the class Loader.  I had a reference to this class loader and I called the unload method, however, the video was still playing but it has disappeared from the scene, what I had to do was "withdraw" all references to the magazine, for example, making this variable overall (of type charger) in a simple local variable in a method, in this way, as long as the SWF file was no references I could solve the problem.

    Hope that helps. Think of this part... removal of references...

    Kind regards

    Dev

    http://Csapp.zzl.org

  • How can I unload external SWF?

    I use the following code to load an external SWF file. I want to unload the SWF (Clock.swf) after 10 seconds (automatically). How can I? I use greensock class.

    import com.greensock;

    com.greensock.easing import. *;

    com.greensock.plugins import. *;

    import com.greensock.events.LoaderEvent;

    var mySwf1:SWFLoader = new SWFLoader ("Objects/Clock.swf", {height: 200, width: 200, onComplete:completeHandler1, container: ClockContainer});

    mySwf1.load ();

    function completeHandler1(event:LoaderEvent):void {}

    TweenLite.to (event.target.content, 0, {alpha: 0});

    TweenMax.fromTo (event.target.content, 3, {x: 0, y: 0, width: 200, height: 200, alpha:. 1}, {x: 0, y: 0, width: 200, height: 200, alpha: 1, delay: 5.});

    }

    Download:

    mySwf1.dispose (true);

    Unload after 10 seconds:

    setTimeout (function () {mySwf1.dispose (true)}; 10000);

  • Cannot unload external .swf and return to section 1

    I tried several suggestions on this forum to solve my problem, but it is clear to me miss me something, because I'm a Flash of NOVICE developer. I have everything works in my Flash file, EXCEPT that I want to use this code to play a .swf file. When the SWF is done playing OR that the user clicks on the "back to the main Menu button", they return to frame 1.

    Stop();

    Log_In.addEventListener (MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_7);

    var fl_Loader_7:Loader;

    var fl_ToLoad_7:Boolean = true;

    function fl_ClickToLoadUnloadSWF_7(event:MouseEvent):void

    {

    If (fl_ToLoad_7)

    {

    fl_Loader_7 = new Loader();

    fl_Loader_7.load (new URLRequest ("NAV01BBEC293.swf"));

    addChild (fl_Loader_7);

    fl_Loader_7 .x = 19;

    fl_Loader_7 there = 67;

    }

    on the other

    {

    fl_Loader_7.Unload ();

    removeChild (fl_Loader_7);

    fl_Loader_7 = null;

    }

    Toggle if you want to load or unload the SWF file

    fl_ToLoad_7 =! fl_ToLoad_7;

    }

    Main_btn.addEventListener (MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_9);

    function fl_ClickToGoToAndPlayFromFrame_9(event:MouseEvent):void

    {

    gotoAndPlay (1);

    }

    Games of .swf files and when I click "Back to main Menu" button, that some items display of frame 1. The .swf file is always loaded to hide items that need to display the frame 1. I've attached a screenshot of what happens when I click on the button "back to the main Menu.After_click_Main_Menu button.png

    Here is a screen should look like shot of what framework 1.

    Frame_1.png

    I'm on a very tight schedule, any help would be most appreciated!

    Looks like I got the order backwards (or Adobe did when they christened)...

    try... fl_Loader_14.unloadAndStop ();

  • need help to unload a .swf

    I am using flash CS5, AS3

    I'm a huge module having a 'nodal point' (table of contents) which contains all the links to the other slides that are individual .swf files.

    The question is, from the Center, I click on the link to open a swf file and it starts to play.  If the button that returns you to the hub are pushed before the entire .swf plays through, symbols and interpolations of the swf that has been simply discharged, always appear on top of the hub and continue playing.  someone knows how can I fix?

    Code to frame 1 of all sovereign wealth funds:

    This.btn_hub.addEventListener (MouseEvent.CLICK, SWFhub);

    var fl_Loader:Loader;

    This variable keeps track of if you want to load or unload the SWF file

    var fl_ToLoad:Boolean = true;

    function SWFhub(event:MouseEvent):void

    fl_Loader.Unload ();

    removeChild (fl_Loader);

    fl_Loader = null;

    fl_Loader = new Loader();

    fl_Loader.load (new URLRequest ("Slide HUB.swf"));

    addChild (fl_Loader);

    }

    SoundMixer.stopAll ();

    any help would be appreciated!

    -= Sondax =-

    someone who will probably need to download and to repair your file for you.

  • How to unload external SWF?

    I was finally able to work on a way to fix and preload external SWF files - now I'm looking to understand how to unload the SWF external on a mouse event so that a new SWF file can be played.
    I googled this to death all day and have resulted in nothing of what seems to work for me.
    Below is are code so far... does anyone know what I need to add?
    Help, please...

    I have it working! YAY!
    I learned a lot from Andrei1 - fantastic help... unfortunately I still couldn't the code work...
    I bought 'Visual Quickstart Guide ActionScript 3.0' and tried some of their code mixed with some of my own (with help from the knowledge I gained from Andrei1 - THANKS again legend)...
    In any case, the resulting code is as below - which you charge my external SWF files and then discharge them with a click of mouse - FANTASTIC! Hope this helps others out there with the same problem.

  • Unload and stop the swf from scene

    Hello

    I am a newbie in Flash and Actionscript. I need to give links to about 20 files swf via the menu.swf buttons. I am able to give links. But when I come back by clicking the HOME button held in the newly loaded swf audio files are always played in the background.

    Yes, there are audio files playing in the back for each slide in the new FSV. Then click the link even menu.swf again once the files are played with the old incomplete file. It's really intense.

    I need to unload the scene completely when I return to menu.swf by clicking the HOME button on one of the 20 categories.

    I used unloadAndStop but it does not. I hope I'm mistakes of committing to a place but could not provide.

    Need help!

    FOR THE HOME BUTTON:


    var _content:Loader = new Loader();

    function loadContent(content:String):void {}

    If (_content! = null) {}

    _content.unloadAndStop (true);

    removeChild (_content);

    _content = null;

    }

    var loader: Loader = new Loader();

    Loader.Load (new URLRequest (content)); -> > > > I don't really know what to put in this :-(

    _content = addChild (loader) like charger;

    }

    Home_Button.addEventListener (MouseEvent.CLICK, home);

    function home(event:MouseEvent) {}

    _content.unloadAndStop (true);

    var homeSWF:URLRequest = new URLRequest ("demo.swf");

    _content. Load (homeSWF);

    addChild (_content);

    }

    MENU.swf BUTTON

    var loader: Loader = new Loader();

    Category1_Button.addEventListener (MouseEvent.CLICK, category 1);

    function category1(event:MouseEvent):void {}

    var Category1SWF:URLRequest = new URLRequest("Category1.swf");

    Loader.Load (Category1SWF);

    addChild (loader);

    }

    I think that there is a question of terminology.

    your main swf is the SWF that is embedded in your html page.  It is the first swf to display, and it can not be unloaded using actionscript.

    It must contain the loader, the only case of Loader, you need.

    This main swf may or may not be main.swf.

    in your main swf file, you must use:

    /////////////////////////////////

    var loader: Loader = new Loader();

    addChild (loader);

    function loadF(fileS:String):void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    Loader.Load (new URLRequest (fileS));

    addChild (loader);

    }

    function unloadF (): void {}

    {if (Loader.Content)}

    loader.unloadAndStop ();

    }

    }

    /////////////////////////////////////////

    do not change anything between the lines.

    ----------------------------------------------------

    your main SWF, if you want to load "catgoryxyz.swf", use:

    loadF ("categoryxyz.swf");  This argument in this line, you can and will change

    you main swf, if you want to unload all that is been loaded (and seem to go back to your file main swf), use:

    unloadF();

    ---------------------------------------------------

    Since the script a swf loaded (as categoryxyz.swf) principal, if you want to load "categoryabc.swf", use:

    MovieClip (this.parent.parent) .loadF ("categoryabc.swf");  the argument in this line, you can and will change

    If you want a swf to unload himself (and seem to go back to your main swf file), use:

    MovieClip (this.parent.parent) .unloadF ();

    -----------------------------------------------------------------

  • How the unloading/loading swf

    I have a Flash animation which automatically opens another Flash animation inside. The main SWF has a button 'Start' at the bottom. When I click on the Start button, I want to load a new Flash video file, swf and unload the loaded SWF automatically (as a placeholder). I do this to create a placeholder for the video. I don't know what code I should use the button to unload the auto swf and load the new swf video.

    You are welcome.

    p.s. Please check the useful/correct, if there is.

  • How to unload the external .swf file when pass the other section?

    Hello

    The following code provided by Mr. kglad works very well to load an external .swf file on stage. Now, when I click on Contact (button), the file external .swf to disappear completely. How to encode on contact (button) to get by.

    Gallery.addEventListener (MouseEvent.CLICK, GalleryClick);

    function GalleryClick(e:Event):void {}

    If (currentClip! = Gallery_mc) {}

    currentClip.visible = false;

    Gallery_mc. Visible = true;

    currentClip = Gallery_mc ;}

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, ClipLoaded);

    Loader.Load (new URLRequest ("Gallery.swf"));

    function ClipLoaded(e:Event):void {}

    Gallery_mc. AddChild (Loader);

    Loader.x = 0;

    Loader.y = 120;

    Loader.Width = 1000;

    Loader.Height = 700

    }}

    I tried the following code for Contact_btn unload the Gallery.swf file that launches an error message: 1120: access of undefined property loader.

    Contact.addEventListener (MouseEvent.CLICK, ContactClick);

    function ContactClick(e:Event):void {}

    If (currentClip! = Cotnact_mc) {}

    currentClip.visible = false;

    Cotnact_mc. Visible = true;

    currentClip = Cotnact_mc;

    Gallery_mc.removeChild (loader);}}

    unloadAndStop() is supported by flash player 10 or higher (fp 10 +).

    p.s. Please check the useful/correct, if there is.

  • Too late to load the new SWF after unloading the current SWF file

    Hello

    In our application, we use more than 10 sovereign wealth funds. When you cross one SWF to others try to unload currently load SWF and load a new. We were successful to unload the existing SWF, but the problem, takes too long to load SWF again (more than 5 seconds). Please suggest a useful method to overcome this time for best performance.

    get an idea of the following code snippet.

    Thank you


    public void SwitchSWFs (): void

    {

    If (null! = SystemAgent.getInstance () .currentSWFLoader)

    {
    SystemAgent.getInstance ().currentSWFLoader.unload ();
    SystemAgent.getInstance () .currentSWFLoader = null;
    trace ("HomeUI: previous swf unloaded!");
    }
    on the other
    {

    }
    addChild (SystemAgent.getInstance (.swfLoaderSecondSWF));
    SystemAgent.getInstance () .currentSWFLoader = SystemAgent.getInstance () .swfLoaderSecondSWF;

    }


    will call by clicking a button
    public void LoadSecondSWF (): void

    {
    SystemAgent.getInstance (). swfLoaderSecondSWF.load (new URLRequest ("Second.SWF"));
    SwitchSWFs();

    }

    The delay is when you test locally?

    One thing you might try is to load all Chargers present you at the front they are needed so that there is more likely that they are ready to be added to the display list when it is called for.  So instead of having the button trigger loading the SWF, just it call the switchSWFs function.

    Another thing, you could try if you keep it where the Triggers button load the corresponding file to assign an event listener for the charger to detect when it has finished loading and then have this listener event handler function calls the switchSWFs function.  At least this way, the current swf file is not unloaded until a replacement is ready and waiting.

Maybe you are looking for