A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: [RESOLVED] Loading/Unloading External Swfs w/ External FLVs help

Hybrid View

  1. #1
    Junior Member
    Join Date
    Aug 2010
    Location
    jersey city
    Posts
    8

    resolved [RESOLVED] Loading/Unloading External Swfs w/ External FLVs help

    Working on a project that has a main stage and loads/unloads external swfs into it. Most of these external swfs also contain FLVs (that are also loaded externally via FLVPlayback). Basically the user clicks on a button in the navigation and it should unload the swf and FLV that is currently playing and then load the new one. Then after the the FLV and swf play theres a "close" button that they can click to go back to the "home" swf which would be hidden underneath. I got it to work to an extent - but the FLV (even though not visually there) still has its audio playing in the background.. I've been searching to find a tutorial or anything that could help point me in the right direction with no luck.. Any chance anyone on FK knows of any tutorials or a way to accomplish this? Im pretty new to AS3 so as you can imagine its causing a world of grief to say the least haha

    Also I've read a few articles about caching the other swfs while the user is floating around on the site.. Any thoughts or ideas on this?

    Thanks in advance, you guys have all been an amazingly huge help!

  2. #2
    Lunatic
    Join Date
    Nov 2002
    Location
    AS3 Forum
    Posts
    342
    removeChild(myFLVInstance);
    myFLVInstance = null;

    No?

  3. #3
    Junior Member
    Join Date
    Aug 2010
    Location
    jersey city
    Posts
    8
    Quote Originally Posted by Beathoven View Post
    removeChild(myFLVInstance);
    myFLVInstance = null;

    No?
    Thanks Beathoven.
    I tried the code but I keep getting an "undefined property error" because the FLV is being called in from the external swf. Or am i placing the code in the wrong place? Sorry, Im still really new to AS3 and kinda get lost easy lol

    This is my code so far that sits inside my main swf:
    PHP Code:
    var myLoader:Loader=new Loader  ();
    introplay_btn.addEventListener(MouseEvent.CLICKintrocontent);
    function 
    introcontent(myevent:MouseEvent):void {
        
    SoundMixer.stopAll()
        var 
    myURL:URLRequest=new URLRequest("swfs/GST_intro.swf");
        
    myLoader.load(myURL);
        
    addChild(myLoader);
    }

    meat_btn.addEventListener(MouseEvent.CLICKmeatcontent);
    function 
    meatcontent(myevent:MouseEvent):void {
        
    SoundMixer.stopAll()
        var 
    myURL:URLRequest=new URLRequest("swfs/GST_Meat.swf");
        
    myLoader.load(myURL);
        
    addChild(myLoader);
    }

    //UNLOAD
    myLoader.addEventListener(MouseEvent.CLICKunloadcontent);
    function 
    unloadcontent(myevent:MouseEvent):void {
        
    removeChild(myLoader);
        
    removeChild(meatflv);
        
    meatflv null;

    All the external swfs load correctly and everything. But I dont think they really unload? Cant really tell because they get covered by the new external swf. But the FLV audio def keeps playing.

    Any ideas? Been racking my brain all day sifting through forums and sites lol Thanks again!

  4. #4
    Junior Member
    Join Date
    Aug 2010
    Location
    jersey city
    Posts
    8

    resolved

    Wooo! I figured out how to solve the issue. I'm posting the working code below in case anyone else out there comes across the same issue. But the main part was using an unloadAndStop instead of just an unload. Thanks for the help!

    PHP Code:
    //Variables

    var swfMenu1 = new Loader();
    var 
    swfMenu2 = new Loader();
    var 
    swfMenu3 = new Loader();


    //Intro btn
    introplay_btn.addEventListener(MouseEvent.CLICKintroswf);

    function 
    introswf (e:MouseEvent)
    {
       
    addChild(swfMenu1);
       
    swfMenu1.load(new URLRequest("swfs/GST_intro.swf"));
       
    swfMenu1.0;
       
    swfMenu1.0
       swfMenu2
    .unloadAndStop();
       
    swfMenu3.unloadAndStop();
    }

    //Meat btn
    meat_btn.addEventListener(MouseEvent.CLICKmeatswf);

    function 
    meatswf (e:MouseEvent)
    {
       
    addChild(swfMenu2);
       
    swfMenu2.load(new URLRequest("swfs/GST_Meat.swf"));
       
    swfMenu2.0;
       
    swfMenu2.0
       swfMenu1
    .unloadAndStop();
       
    swfMenu3.unloadAndStop()
    }


    //Dairy btn
    dairy_btn.addEventListener(MouseEvent.CLICKdairyswf);

    function 
    dairyswf (e:MouseEvent)
    {
       
    addChild(swfMenu3);
       
    swfMenu3.load(new URLRequest("swfs/GST_Dairy.swf"));
       
    swfMenu3.0;
       
    swfMenu3.0
       swfMenu1
    .unloadAndStop();
       
    swfMenu2.unloadAndStop();


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center