dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Load & Unload Multiple External SWF

  1. #1
    Junior Member
    Join Date
    Jan 2009
    Posts
    24

    Load & Unload Multiple External SWF

    What I have is one swf with buttons, pressing one loads another swf containing several thumbnails (all thumbnails should be images loaded externally).
    Pressing one of the thumbnails should load yet another swf containing a large image of that thumbnail.

    This is what I have done so far (this is for the swf containing all the thumbnails):
    var swf:MovieClip;
    var loader:Loader = new Loader();

    var defaultSWF:URLRequest = new URLRequest("1.swf");

    loader.load(defaultSWF);
    addChild(loader);
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Btns Universal function
    function btnClick(event:MouseEvent):void {

    removeChild(loader);
    var newSWFRequest:URLRequest = new URLRequest( + event.target.name + ".swf");
    loader.load(newSWFRequest);
    addChild(loader);
    }
    // Btn listeners
    invisiblebtn1.addEventListener(MouseEvent.CLICK, btnClick);

    Problem is MouseEvent don't work here. This ActionScript automatically loads the 1.swf containing the larger image of the first thumbnails without waiting for the user to click the mouse. Why?

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Looking at the first part of the script the defaultSWF should be automatically loaded. Your question is not quite clear.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    var swf:MovieClip;
    var loader:Loader = new Loader();

    addChild(loader);
    //loader.load(new URLRequest("1.swf"));

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

    // Btns Universal function
    function btnClick(event:MouseEvent):void {
    loader.load(new URLRequest( + event.target.name + ".swf"));
    }
    // Btn listeners
    invisiblebtn1.addEventListener(MouseEvent.CLICK, btnClick);

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