A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Loading and Unloading External Swf when clicking Forward and Back?

Hybrid View

  1. #1
    Member
    Join Date
    Apr 2002
    Location
    London
    Posts
    36

    Question Loading and Unloading External Swf when clicking Forward and Back?

    I am creating an interactive slideshow, like a PowerPoint effect, I have a main scene, 4 Buttons, a Home Button, Play Button, Forward Button & Back Button.

    I want the Home Button to take me back to the start of the scene, Forward Button to Load a External swf slide and when the Forward Button is clicked again to Unload External swf and load in the next swf slide, I also want the Back Button to do a similar thing!

    I keep getting External Swf pile-ups or flickering

    Here's my code:

    Code:
    Play_button1.addEventListener(MouseEvent.CLICK, Play_btn1);
    
    import fl.display.ProLoader;
    
    var fl_ProLoader:ProLoader;
    
    var fl_ToLoad:Boolean = true;
    
    function Play_btn1(event:MouseEvent):void
    
    {
    
        
    
            fl_ProLoader = new ProLoader();
    
            fl_ProLoader.load(new URLRequest("slides/slide1.swf"));
    
            addChild(fl_ProLoader);
    
            fl_ProLoader .y = 36;
    
        }
    
        else
    
        {
    
            fl_ProLoader.unload();
    
            removeChild(fl_ProLoader);
    
            fl_ProLoader = null;
    
        }
    
        // Toggle whether you want to load or unload the SWF
    
        fl_ToLoad = !fl_ToLoad;
    
    }
    
    Forward_button1.addEventListener(MouseEvent.CLICK, Forward_btn1);
    
    function Forward_btn1(event:MouseEvent):void
    {
        gotoAndStop("Slide2");
    }
    
    Back_button1.addEventListener(MouseEvent.CLICK, Back_btn1);
    function Back_btn1(event:MouseEvent):void
    {
        gotoAndStop("Home");
    }
    
    Home_button1.addEventListener(MouseEvent.CLICK, Home_btn1);
    function Home_btn1(event:MouseEvent):void
    {
        gotoAndStop("Home");
    }
    I hope this all makes sense, any Help will be useful. Thanks

  2. #2
    Senior Member
    Join Date
    Jun 2008
    Posts
    549
    Take a look at this tutorial. There are a few different methods: http://www.ilike2flash.com/2011/04/l...wf-in-as3.html

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