MovieClipLoader

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Martin84
    New Member
    • Jun 2007
    • 11

    MovieClipLoader

    Hi, ive managed to import files into a main fla document using a moviecliploader command. The code tracks the percentage of the file downloaded so far and shows this information in a preloader bar. The problem is whenever I import a swf file it tries to play before it is 100% loaded. To counter this I added some more code to solve this (see bold text). The code is supposed to hide the swf file until it is 100% loaded then show and play it. The code hides and shows the swf fine, but still seems to play the file in the background. Would really appreciate some help with this one, hear is the code:

    loadbar._visibl e = false;

    //set up a MovieClipLoader and a Listener for "listening" to the callback events of the MovieClipLoader
    var myLoader:MovieC lipLoader = new MovieClipLoader ();
    var myListener:Obje ct = new Object();

    myListener.onLo adStart = function(){
    trace ("started loading" );
    }
    myListener.onLo adProgress = function(){
    percent = Math.floor(box5 .getBytesLoaded ()/box5.getBytesTo tal() * 100);
    loadbar._visibl e = true;
    loadbar.gotoAnd Stop( percent );
    trace ( percent );

    //script to ensure that the movieclip is only displayed and played when it is 100% loaded
    if (percent < 100){
    gotoAndStop(box 5);
    box5._visible = false;
    } else {
    box5._visible = true;
    gotoAndPlay(box 5);
    }
    }


    myListener.onLo adComplete = function(){
    trace ("loaded");
    loadbar._visibl e = false;
    }

    // add the listener object to the movieCLipLoader
    myLoader.addLis tener(myListene r);
    myLoader.loadCl ip ("materials/rotoscope.swf" , box5);

    stop();

    Thanks in advance,

    Martin
  • Martin84
    New Member
    • Jun 2007
    • 11

    #2
    Doesn't matter, problem solved now

    Comment

    • Motoma
      Recognized Expert Specialist
      • Jan 2007
      • 3236

      #3
      Care to post your solution so others may learn from it as well?

      Comment

      Working...