A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Preloader Troubles

  1. #1
    Junior Member
    Join Date
    Sep 2006
    Location
    Boulder/Denver
    Posts
    2

    Preloader Troubles

    Hi, I am following a tutorial for a preloader using Beyond the Basics Flash MX 2004. For some reason my preloader won't work. Here's the code. Any ideas? I would appreciate any input. Thanks. -chris


    var myMCL:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();

    myMCL.addListener(myListener);

    myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes) {
    _level50._visible = true;
    var preloadPercent:Number = Math.round((loadedBytes / totalBytes) * 100);
    _level50.preloader.gotoAndStop(preloadPercent);
    }


    myListener.onLoadComplete = function (target_mc) {
    _level50._visible = false;
    }

    myMCL.loadClip("splash.swf", 5);
    myMCL.loadClip("DSC01096.jpg", 4);
    myMCL.loadClip("preloader.swf", 50);

  2. #2
    Junior Member
    Join Date
    Sep 2006
    Posts
    2
    It's very simple and easy >>>

    1º Create one FLA File called [preloader.fla] with 2 movie clips.

    One movieclip empty and the other with some loading animation.


    Now Make 3 layers in your FLA (with only one frame) one layer called actions for actions and two others layers for the two movieclips with their own names! (names help you to know what their are but are optional)

    Remember to put the empty movieclip in the top-left corner of the stage and name it in the properties panel. (find in the properties panel the instance name and give it a name)

    Now in actions layer put this code:

    var myMCL:MovieClipLoader = new MovieClipLoader();
    var myListener:Object = new Object();

    myMCL.addListener(myListener);

    myListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
    var loaded:Number = Math.round((bytesLoaded/bytesTotal) * 100);
    progressBar.gotoAndStop (loaded);
    }

    myListener.onLoadInit = function (target_mc:MovieClip) {
    progressBar._visible = false;
    }

    myListenet.onLoadStart = function (target_mc:MovieClip) {
    progressBar._visible = true;
    }

    myMCL.loadClip("./index.swf","container");

    Now save your FLA file and enjoy!

    Remember the red areas are the ones you need to change in my case i was loading index.swf and my empty movieclip was named as container!


    The good thing about this code is that you can load and use it with pretty much any file!

    If you need more help... Contact me jgganeto@hotmail.com

  3. #3
    Junior Member
    Join Date
    Sep 2006
    Location
    Boulder/Denver
    Posts
    2
    Thank you very, very much, I'll give it a shot right now.

  4. #4
    Junior Member
    Join Date
    Sep 2006
    Posts
    2

    Hey...

    Quote Originally Posted by cpmv2
    Thank you very, very much, I'll give it a shot right now.
    Ok man if it's dosen't work for you send me an message or an e-mail at jgganeto@hotmail.com and i'll give you another code ok?!!!!

    bye

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