A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: How to make sure randomly loaded externals swfs are fully loaded [F8]

Hybrid View

  1. #1
    Developing For Dunkets mneil's Avatar
    Join Date
    Mar 2007
    Location
    Lincoln City
    Posts
    2,156
    instead of using loadMovie you can use the MovieClipLoader class that has the onLoadInit function that checks if an external swf is loaded including it's actions.

    var mcl:MovieClipLoader = new MovieClipLoader;
    choice = Math.round(Math.random()*2);
    switch (choice) {
    case 0 :
    location.loadClip("image0.swf");
    break;
    case 1 :
    location.loadClip("image1.swf");
    break;
    case 2 :
    location.loadClip("image2.swf");
    break;
    default ://add a default in case the switch fails for some reason
    location.loadClip("image0.swf");
    break;

    }

    mcl.onLoadInit = function(){
    //add the actions you want to happen when the movie is loaded
    }

    mcl.addListener(this);
    Last edited by mneil; 08-28-2007 at 01:51 PM. Reason: you should add a default to your switch
    http://code.mneilsworld.com/
    Text Effects | Bubbles | Dynamic Resize
    4 weeks , 20 papers ... thats 2 dollars .....Caassshhh!

  2. #2
    Junior Member
    Join Date
    Feb 2006
    Posts
    12
    Thanks for your help!

    I tried the code you provided, and I received an error saying "there is no property with the name 'onloadInit'.

    Do you know what the problem is?

    Thank you!

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