Button to navigate and unload swf

I have the following code to load an external swf by clicking a button. It works fine.
btn_01_01.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);
function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
var url:String = event.currentTarget.name+".swf";
fl_Loader.load(new URLRequest("loads/TEST_VID_AS3.swf"));
I also have a button that takes me to another place on the timeline.
this.btn_back_main.addEventListener(MouseEvent.CLICK,fback_main);
function fback_main(evt:MouseEvent)
MovieClip(this.root).gotoAndPlay("main");
But the loaded swf is still visible.
I would like that button to also unload the loaded swf.
Can anyone tell me if it's possible and suggest code?
Thank you in advance.

this should do it (assuming the btn to remove it is called "btn_remover"):
var ld:Loader = new Loader();
btn_01_02.addEventListener(MouseEvent.CLICK, v);
function v(e:MouseEvent):void {
     ld.load(new URLRequest("loads/TEST_VID_AS3.swf"))
     addChild(ld)
btn_remover.addEventListener(MouseEvent.CLICK, removeSwf);
function removeSwf(e:MouseEvent):void {
     ld.unloadAndStop();
firstly, i moved the Loader definition outside of the function (otherwise it gets removed at the end of the function and cant be accessed later)
then i added event listener to remove button to call removeSwf function - which calls unloadAndStop() on the loader object
fyi, i suggest you use more descriptive names for your buttons and functions otherwise you'll find it harder to work out whats going on if you come back to it after a break.

Similar Messages

  • 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

  • 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.

  • Help with load and unload swf file.

    hello, just now i try, to  load my file using the code snippet 'load and unload' i manage to load the next file succesfully but why my recent file still appear in the background? how do i make it gone?

    When you load another SWF you're loading it 'inside' the current SWF but it appears that you want to replace the current SWF entirely with the new SWF, is that correct?
    If so you should make what's usually known as a 'stub' or a loader. Make an empty project that merely acts as a loader. It should load your first SWF and when you press a button on that first SWF to load a second SWF, it should signal the 'stub' it's loaded inside to unload the first SWF and then load the second.
    e.g. a stub.swf (just coding out of memory, not error checked, just to give a general idea):
    // make a new loader to do all the loading of SWFs
    var loader:Loader = new Loader();
    // and display
    addChild(loader);
    // a function to load a SWF into the loader (replacing any existing SWF)
    function loadSWF(path:String):void
         // assure path is defined or do nothing
         if (!path) return;
         // load requested SWF
         loader.load(new URLRequest(path));    
    // load initial SWF
    loadSWF('/path/to/1.swf');
    For your 1.swf to use the function, you're currently inside the .content property of a Loader so I believe you can just run a command like: Object(this.parent.parent).loadSWF('/path/to/2.swf');
    This example obviously lacks any error checking or transitions but you can add those and season to taste.

  • Display/load and Unload SWF in flex

    hi friends
    i wnat to disply external SWF file into flex but without using SWFLOader(it's make lot's of problem) nad i also Embed that SWF
    this is code
    [Embed(source="1.swf")]
    private var loadswf:Class;
    private function load():void{
    var symb:MovieClip = new loadswf() as MovieClip;
    this.addChild(symb);
    it's give me error....
    TypeError: Error #1034: Type Coercion failed: cannot convert demos_loadswf@39ab3c1 to mx.core.IUIComponent.
    please help to resolve this error or give me suggestion to simple Disply/Load and Unload Embed SWF file in flex

    thnx Flex harUI
    i added UI componentes now my full code is like..
            import mx.controls.Image;    
            import mx.controls.Alert;
            [Embed(source = "1.swf")]
            public var SWF:Class;
            [Embed(source = "2.swf")]
            public var SWF2:Class;
            private var mc:MovieClip;
            private var img:Image;
            protected function checkBtn_clickHandler(event:MouseEvent):void
                clear();
                img = new Image();
                img.width=Number("700");
                img.height=Number("700");
                mc = new MovieClip();
                mc = MovieClip(new SWF());
                img.source = mc;
                vBox0.addChild(img);
            protected function critcalBtn_clickHandler(event:MouseEvent):void
                clear();
                img = new Image();
                img.width=Number("700");
                img.height=Number("700");
                mc = new MovieClip();
                mc = MovieClip(new SWF2());
                img.source = mc;
                vBox0.addChild(img);
            protected function clear():void
                try{
                    if(mc!=null){
                        flash.media.SoundMixer.stopAll();
                        img.source="";
                        img.source=null;
                        mc=null;
                        vBox0.removeChild(DisplayObject(img));
                        vBox0.removeAllElements();
                        vBox0.removeAllChildren();
                }catch(e:Error){
                    Alert.show(e + " ----::---- ");
    <mx:Canvas id="vBox0" width="700" height="700" ></mx:Canvas>
    <mx:HBox >
            <mx:Button id="checkBtn" label="first" click="checkBtn_clickHandler(event)"/>
            <mx:Button id="critcalBtn" label="second" click="critcalBtn_clickHandler(event)"/>
    </mx:HBox>
    now my error gone!!! but one problem is there when i unload my first SWF and load second SWF(on button click), my first SWF sound are still play in Background, i cn't unstand Y this will happen coz i already remove all object and child from my Canvas.
    any help on this....

  • Load and unload swf file

    I am currently using AS2.
    I create a button instance named "myBtn" and i want it to load external swf file call "test2.swf" while unload current swf file named "test1.swf"  when pressed/release.
    what done is i put following code under mybtn :
    on(press)
              unloadMovie("test1.swf");
              loadMovie("test2.swf" , 1);
    the outcome was that , the "test2.swf" was loaded successfully but the "test1.swf" fail to unload.
    Any help is welcome

    AS2.. Scope is your issue. When you are inside the function for onPress you are telling the button you pressed to unload test1.swf from inside that button (which it's not located in).
    You're probably using the root timeline so I'll take a wager this will work:
    on (press)
         _root.loadMovie("test2.swf");
    If you want to monitor progress in loading between them, that's a little more complex.

  • [SWF] and [Unload SWF] in Debug mode

    I am debugging my application and I am noticing some strange output in my console window.
    I will get the same line duplicated, it looks like this:
    [SWF] C:\Users\Me\Desktop\Development\flash\bin-debug\main.swf
    [SWF] C:\Users\Me\Desktop\Development\flash\bin-debug\main.swf
    [SWF] C:\Users\Me\Desktop\Development\flash\bin-debug\main.swf
    Then at a later state in the application I see this:
    [Unload SWF] C:\Users\ Me\Desktop\Development\flash\bin-debug\main.swf
    [Unload SWF] C:\Users\ Me\Desktop\Development\flash\bin-debug\main.swf
    [Unload SWF] C:\Users\ Me\Desktop\Development\flash\bin-debug\main.swf
    Can someone exaplain to me what this means, and why I see duplicates of the exact same lines?

    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

  • Need to load and unload swf from single htm file

    I need to load or unload swf file or we can say that i need load 3 project one by one in current window

    mit,
    So are you saying you need to have one swf file call a second file to play, then call a third to play...
    Which Captivate version are you using?
    Are the swf files all captivate published swf's?
    Do you have access to Flash Professional and if so what version?
    how are you running your file, is it scorm packaged or just html based?
    I may be able to help with your issue, but need these details.

  • Loading and Unloading of swf files in SWF Loader

    Hi all,
    I have a doubt reg. SWF Loader.
    I have created two mxml files A & B.
    A. local.mxml
    B. SwfSample.mxml
    i have two labels and a button in A file and i have set values to those labels and have a method to handle the click event of the button. In B file i have loaded this A file and accessed the labels and methods using SystemManager Component and changed the values of the A file's label and accessed data from A file to B file.
    Here comes the problem,
    I have two buttons named LoadAgain and Unload
    When i click the Unload button, the SWF Loader unloads its content by the method i handled for  the Unload button, after that i have clicked on the LoadAgain button to load the same content of A's mxml to the SWF Loader, it loads succesfully,but i was not able to access its Label or Method from the B mxml. Please help me to solve the issue.
    local.mxml
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute">
    <mx:Script>
        <![CDATA[
    Bindable]
        public var varOne:String = "This is a public variable";
        public function setVarOne(newText:String):void
              varOne = newText;
        ]]>
    </mx:Script>
    <mx:Label id="lblOne" text="I am here" x="28" y="88"/>
    <mx:Label text="{varOne}" x="166" y="88"/>
    <mx:Button label="Nested Button" click="setVarOne('Nested Button Pressed');" x="28" y="114"/>
    SwfSample.mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application 
    xmlns:mx=http://www.adobe.com/2006/mxml layout="absolute">
        <mx:Script>
        <![CDATA[
              import mx.controls.Alert;  
              import mx.managers.SystemManager;  
              import mx.controls.Label; 
    Bindable]
              public var loadedSM:SystemManager;
              private function initNestedAppProps():void
                  loadedSM = SystemManager(myLoader.content);
              public function updateLabel():void
                  lbl.text = loadedSM.application[
    "lblOne"].text;
              public function updateNestedLabels():void
                  loadedSM.application[
    "lblOne"].text = "I was just updated" ;
                  loadedSM.application[
    "varOne"] = "I was just updated";
              public function updateNestedVarOne():void
                   local(loadedSM.application).setVarOne(
    "Updated varOne");
              public function unload():void
                   myLoader.content.loaderInfo.loader.unload();
              public function loadAgain():void
                   myLoader.load(
    "../bin-debug/local.swf");
            ]]>
         </mx:Script>
    <mx:Label id="lbl" x="72" y="47"/>
    <mx:SWFLoader id="myLoader" width="438" source="../bin-debug/local.swf" creationComplete="initNestedAppProps();" y="73" height="238" x="72" alpha="1.0"/>
    <mx:Button label="Update Label Control in Outer Application" click="updateLabel();" x="72" y="319"/>
    <mx:Button label="Update Nested Controls" click="updateNestedLabels();" x="72" y="349"/>
    <mx:Button label="Update Nested varOne" click="updateNestedVarOne();" x="72" y="379"/>
    <mx:Button label="Unload" click="unload();" x="72" y="409"/>
    <mx:Button label="Load Again" click="loadAgain();" x="72" y="439"/>
    </mx:Application>
    Thanks & regards,
    Sathish.K

    creationComplete only fires once when the SWFLoader is created.  Therefore you never reset your variables to point to the new sub-app.  On a slow network, creationComplete may fire before the sub-app loads.  It is best to use the COMPLETE event.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Load and Unload Movies in AS3

    Please Can someone point me to some god examplkes on loading and unloading swfs in AS3. I manage to load but unloading is a headache.
    Thanks
    Att.,
    Edwin

    there's nothing to study if you're using fp 10:
    var yourloader:Loader=new Loader();
    yourloader.load(new URLRequest("whatever.swf"));
    function unloadF(){
    yourloader.unloadAndStop();

  • Transition_Manager and unloading external swf problems

    Hi there
    I´m having a few problems with my project which i although it work it has some unpleasant bugs that i´m trying to solve for days.
    When i load external swf´s they show up on top of the Menu button.Maybe because the button i´m pressing is inside the same movieclip as the Menu.
    Explaining better here´s a little diagram of my site:
    con2 MC (Instance of Menu) ---> cont3 MC (Instance of subMenu) and mainButton MC (Instance of Main)
    Here´s the general code which is inside the Painel.as
    package {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        public class Painel3 extends MovieClip
            private var inFocus:MovieClip;
            public function Painel3():void
                setupClips();
                addEventListener(Event.ENTER_FRAME, loop);
            private function setupClips():void
            con2.mainButton.addEventListener(MouseEvent.ROLL_OVER, onOver);
            con2.mainButton.addEventListener(MouseEvent.ROLL_OUT, onOut);
            con2.mainButton.addEventListener(MouseEvent.CLICK, onClick);
                var len:int = con2.cont3.numChildren;
                for(var i:int=0; i<len; i++)
                    var mc:MovieClip = MovieClip(con2.cont3.getChildAt(i));
                    mc.buttonMode = true;
                    mc.loc = [mc.x, mc.y];
                    mc.addEventListener(MouseEvent.CLICK, onClick);
                    con2.cont3.visible = false;
            private function onOver(e:MouseEvent):void
            private function onOut(e:MouseEvent):void
            private function onClick(e:MouseEvent):void
                con2.cont3.visible = true;
    TransitionManager.start(con2.cont3, {type:Wipe, direction:Transition.IN, duration:1, easing:None.easeNone, startPoint:5} );                       
            private function loop(e:Event):void
                var distx:Number = mouseX / 1400;
                var disty:Number = mouseY / 1400;
                TweenLite.to(con2, 2, {
                            rotationY:(-70 +(145*distx)),
                            rotationX:(70 -(145*disty)),
                            ease:Expo.easeOut
    And then inside the subMenu.as class for the movieclip subMenu i have the buttons that load the external swf´s:
    package  {
        import com.greensock.TweenLite;
        import com.greensock.TweenMax;
        import com.greensock.*;
        import com.greensock.easing.*;
        import flash.display.*;
        import flash.events.*;
        import flash.display.MovieClip;
        import flash.net.URLRequest;
        import flash.display.Loader;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import fl.transitions.*;
        import fl.transitions.easing.*;
        public class subMenu extends MovieClip {
            public function subMenu() {
                // constructor code
                menu1.buttonMode = true;
                menu2.buttonMode = true;
                menu3.buttonMode = true;
                menu4.buttonMode = true;
                 menu1.addEventListener(MouseEvent.CLICK,link1);
                 menu2.addEventListener(MouseEvent.CLICK,link2);
                 menu3.addEventListener(MouseEvent.CLICK,link3);
                 menu4.addEventListener(MouseEvent.CLICK,link4);
            function link1(e:MouseEvent) {
               function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("AugmentedReality_v1.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link2(e:MouseEvent) {
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Fotos.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
            function link3(e:MouseEvent) {
            function link4(e:MouseEvent){
                function startLoad()
                var mLoader:Loader = new Loader();
                var mRequest:URLRequest = new URLRequest("Texto.swf");
                mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);
                mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
                mLoader.load(mRequest);
    function onCompleteHandler(e:Event):void {
    var swf:DisplayObject = e.target.content;
    swf.x = -400;    
    swf.y = -300;    
    addChild(swf);
    function onProgressHandler(mProgress:ProgressEvent)
           var percent:Number = mProgress.bytesLoaded/mProgress.bytesTotal;
           trace(percent);
    startLoad();
    Like i said the swf´s show up on top of the Menu and i need it to dissapear.
    Also i want to unload the swf currently in scene so that when i load another one they don´t pile on top of each other.
    Pls help. Thanks

    Oh btw, i´m having an error 1069 Property TransitionManager not found in subMenu and there is no default value
    at fl.transitions::TransitionManager$/start()
        at Painel3/onClick()
    This doesn´t happen when i uncheck the Export for actionscript in the subMenu class but i can´t do that or else the buttons wont work.

  • Buttons and external swfs

    I would like to automatically load an external swf inside an existing empty mc (or a new one)  and load/unload different external swf on several button click fuctions.  I've read the other posts, but none that quite facilitates accomplishing this.
    This is what I have, I know it's messy- but I've been trying so many different methods until its probably loaded with irrelevant functions!
    var myLoader:Loader = new Loader(); addChild(myLoader); var url:URLRequest = new URLRequest("homepage.swf"); myLoader.load(url);
      myLoader.x=477;
      myLoader.y=0;
    /* Click to Load/Unload SWF or Image from a URL.
    Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
    Instructions:
    1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
    2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
    button_1.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF);
    var fl_Loader:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad:Boolean = true;
    function fl_ClickToLoadUnloadSWF(event:MouseEvent):void
    if(fl_ToLoad)
      fl_Loader = new Loader();
      fl_Loader.load(new URLRequest("homepage.swf"));
      fl_Loader.x=477;
      fl_Loader.y=0;
      removeChild(myLoader);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader_4
      addChild(fl_Loader);
    else
      fl_Loader.unload();
      removeChild(fl_Loader);
      removeChild(myLoader);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader_4);
      fl_Loader = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad = !fl_ToLoad;
    /* Click to Load/Unload SWF or Image from a URL.
    Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
    Instructions:
    1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
    2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
    movieClip_2.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_2);
    var fl_Loader_2:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_2:Boolean = true;
    function fl_ClickToLoadUnloadSWF_2(event:MouseEvent):void
    if(fl_ToLoad_2)
      fl_Loader_2 = new Loader();
      fl_Loader_2.load(new URLRequest("portfolio.swf"));
      fl_Loader_2.x=477;
      fl_Loader_2.y=0;
      removeChild(myLoader);
      removeChild(fl_Loader);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader_4);
      addChild(fl_Loader_2);
    else
      fl_Loader_2.unload();
      removeChild(fl_Loader_2);
      removeChild(fl_Loader);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader_4);
      fl_Loader_2 = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad_2 = !fl_ToLoad_2;
    /* Click to Load/Unload SWF or Image from a URL.
    Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
    Instructions:
    1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
    2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
    movieClip_3.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_3);
    var fl_Loader_3:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_3:Boolean = true;
    function fl_ClickToLoadUnloadSWF_3(event:MouseEvent):void
    if(fl_ToLoad_3)
      fl_Loader_3 = new Loader();
      fl_Loader_3.load(new URLRequest("about.swf"));
      fl_Loader_3.x=477;
      fl_Loader_3.y=0;
      removeChild(myLoader);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader);
      removeChild(fl_Loader_4);
      addChild(fl_Loader_3);
    else
      fl_Loader_3.unload();
      removeChild(fl_Loader_3);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader);
      removeChild(fl_Loader_4);
      fl_Loader_3 = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad_3 = !fl_ToLoad_3;
    /* Click to Load/Unload SWF or Image from a URL.
    Clicking on the symbol instance loads and displays the specified SWF or image URL. Clicking on the symbol instance a second time unloads the SWF or image.
    Instructions:
    1. Replace "http://www.helpexamples.com/flash/images/image1.jpg" below with the desired URL address of the SWF or image. Keep the quotation marks ("").
    2. Files from internet domains separate from the domain where the calling SWF resides cannot be loaded without special configuration.
    movieClip_4.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_4);
    var fl_Loader_4:Loader;
    //This variable keeps track of whether you want to load or unload the SWF
    var fl_ToLoad_4:Boolean = true;
    function fl_ClickToLoadUnloadSWF_4(event:MouseEvent):void
    if(fl_ToLoad_4)
      fl_Loader_4 = new Loader();
      fl_Loader_4.load(new URLRequest("contact.swf"));
      fl_Loader_4.x=477;
      fl_Loader_4.y=0;
      removeChild(myLoader);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader);
      addChild(fl_Loader_4);
    else
      fl_Loader_4.unload();
      removeChild(fl_Loader_4);
      removeChild(fl_Loader_2);
      removeChild(fl_Loader_3);
      removeChild(fl_Loader);
      fl_Loader_4 = null;
    // Toggle whether you want to load or unload the SWF
    fl_ToLoad_4 = !fl_ToLoad_4;

    Kglad I read up on that but it's still not stopping.I'm publishing for  fp 10 and have tried several different variations including:
    function gofolio (e:MouseEvent):void{
    imageLoader.load(navfolio);
    addChild(imageLoader);
    imageLoader.unloadAndStop(true);
    folio_btn.addEventListener(MouseEvent.CLICK, gofolio);
    function goabout (e:MouseEvent):void{
    imageLoader.load(navabout);
    addChild(imageLoader);
    imageLoader.unloadAndStop(true);
    removeChild(imageLoader)
    imageLoader=null
    about_btn.addEventListener(MouseEvent.CLICK, goabout);
    ....still not working.

  • How to load and unload more than one external swf files in different frames?

    I do not have much experience on Adobe Flash or Action Script 3, but I know the basics.
    I am Arabic language teacher, and I design an application to teach Arabic, I just would like to learn how to load and unload more than one external swf files in different frames.
    Thanks

    Look into using the Loader class to load the swf files.  If you want to have it happen in different frames then you can put the code into the different frames.

  • To disable the horizontal scrollbar and to create a next button to navigate

    To disable the horizontal scrollbar and to create a next button to navigate through the records. At present I create a JSF page and drag and drop my table view and then using the Tuning property I have limited the number of records to be shown. But I need to add a button and then code it to display the next few records. Can someone kindly suggest a suitable mechanism to get this accomplished.
    Edited by: 888970 on Oct 2, 2011 10:15 PM

    Hi Erp,
    At present these are the entries that I have in my JSPX page.
    I have a Table, Iterator and a Input List of Values. As per the scenario, I want a few rows to appear on the table for which I wanted to disable the horizontal scroll bar and then once I click on the list of values it must prompt me with the remaining page numbers.
    Earlier there are about 150 records in the table. I want to show them as 15 per page.
    For which I have added the Iterator and a LOV component code in my JSPX page.
    <af:iterator id="i1"
    value="#{bindings.NsEventDetailsView1.collectionModel}"
    var="row"
    binding="#{pageFlowScope.testPageBean.myIterator}"/>
    <af:inputListOfValues label="Label 1"
    popupTitle="Search and Result Dialog" id="ilov1"/>
    Then I created the bean class as per the example.
    Below is the bean class:
    import javax.faces.event.ValueChangeEvent;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import org.apache.myfaces.trinidad.component.UIXIterator;
    import org.apache.myfaces.trinidad.event.AttributeChangeEvent;
    public class TestPagebean {
    public TestPagebean() {
    public void i1ov1_valueChangeListener(ValueChangeEvent valueChangeEvent) {
    // Add event code here...
    private UIXIterator myiter;
    public void setI1(UIXIterator myiter) {
    this.myiter=myiter;
    public UIXIterator getmyiter() {
    this.myiter=myiter;
    public UIXIterator setmyiter() {
    return myiter;
    UIXIterator valueIterator = getmyiter();
    if (!valueChangeEvent.getNewValue().equals(valueChangeEvent.getOldValue())) {
    int newPage =
    Integer.parseInt(valueChangeEvent.getNewValue().toString());
    int pageStart = (newPage) * valueIterator.getRows();
    valueIterator.setFirst(pageStart);
    AdfFacesContext.getCurrentInstance().addPartialTarget(valueIterator);
    But i am getting errors in the bean class.
    1. Block expecting }
    2. public UIXIterator getmyiter() {
    this.myiter=myiter;
    Return Statement missing
    3. Block expecting {
    4. Type or variable 'valueChangeEvent' not found
    5. Method 'getNewValue' not found
    6. Method 'getOldValue' not found
    7. Method 'toString' not found
    Can you suggest a possible solution?

  • Loading an external swf and unloading the parent one

    Hi there i have made a navigation in flash and 3 buttons that load some external swf's. Problem is that when they load the parent swf keeps playing in the background. How can i make them play separately and make the navigation stage dissapear completely when they load?

    I have attempted to use the same Loader but it doesnt replace it i dont know why.
    var myLoader:Loader = new Loader();       
    var myLoaderMain:URLRequest = new URLRequest("main1.swf");
    var myLoaderQuiz:URLRequest = new URLRequest("quiz.swf");
    var myLoaderAnimation:URLRequest = new URLRequest("athens_animation.swf");
    var myLoaderVideo:URLRequest = new URLRequest("videogallery.swf");
    videogallerybtn.addEventListener(MouseEvent.CLICK, videoFunc);
    function videoFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderVideo);
              addChild(myLoader);
    Quizbtn.addEventListener(MouseEvent.CLICK, quizFunc);
    function quizFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderQuiz);
              addChild(myLoader);
    Animationbtn.addEventListener(MouseEvent.CLICK, AnimationFunc);
    function AnimationFunc(curEvt:MouseEvent) {
              myLoader.load(myLoaderAnimation);
              addChild(myLoader);

Maybe you are looking for