+ Reply to Thread
Results 1 to 1 of 1

skip preloader once external swf is loaded

This is a discussion on skip preloader once external swf is loaded within the Flash English forums, part of the Flash CS3 - CS4 - CS5 category; Hi, I have a preloader that loads up an external swf and then adds it to the stage. It works ...

  1. #1
    Junior Member Settled In fakecopper is on a distinguished road
    Join Date
    Mar 2009
    Posts
    2
    Rep Power
    0

    skip preloader once external swf is loaded

    Hi,
    I have a preloader that loads up an external swf and then adds it to the stage. It works fine, but as you go to the site again you will see the preloader again and the animation goes really really fast, which is kind of annoying. I want to skip the preloader animation once the external swf is loaded.

    Basically, I write a function "onCheck" to see if the external swf is already loaded, but I don't think that's working. I must have done something wrong but I can't figure out what it is. The following is my code, please kindly look at it and offer me help if you could. Thanks, and much appreciated.


    stop();
    import caurina.transitions.*;
    import caurina.transitions.Tweener;
    import caurina.transitions.properties.*;

    var holder_mc:MovieClip=new MovieClip();
    var loader:Loader = new Loader();
    var OriginX:Number = panel_loading.ferry_animation.mcFerry.x;
    loader.load(new URLRequest("myMovie.swf"));

    loader.contentLoaderInfo.addEventListener(Progress Event.PROGRESS, onCheck);
    function onCheck(evt:ProgressEvent):void {
    var percent:Number = Math.floor( (evt.bytesLoaded*100)/evt.bytesTotal );
    trace(percent);
    panel_loading.percent_txt.text = percent.toString() + "%";
    if (percent == 100) {
    Enter_Scene();
    } else {
    loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, onCheck);
    showLoader();
    }
    }
    function showLoader():void {
    loader.contentLoaderInfo.addEventListener(Progress Event.PROGRESS, loop);
    }

    function loop(evt:ProgressEvent):void {
    var percent:Number = Math.floor( (evt.bytesLoaded*100)/evt.bytesTotal );
    if (panel_loading is MovieClip) {
    panel_loading.ferry_animation.mcFerry.gotoAndStop( percent);
    panel_loading.percent_txt.text = percent.toString() + "%";
    }
    if (percent == 100) {
    done();
    }
    }

    function done():void {
    Tweener.addTween(panel_loading.percent_txt,{alpha: 0, time:1});
    Tweener.addTween(panel_loading.ferry_animation,{al pha:0, time:1, onComplete:Enter_Scene});
    }
    function Enter_Scene():void {
    loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, onCheck);
    loader.contentLoaderInfo.removeEventListener(Progr essEvent.PROGRESS, loop);
    addChild(loader);
    MovieClip(loader.content).gotoAndPlay(2);

    removeChild(getChildByName ("logo"));
    removeChild(getChildByName ("panel_loading"));
    }
    Last edited by fakecopper; 07-04-09 at 19:59.

+ Reply to Thread

Similar Threads

  1. preLoader with external files!!!
    By losbenos in forum advanced Actionscript 3.0
    Replies: 10
    Last Post: 01-11-09, 08:21
  2. Preloader issues with external content, please help!
    By hard131313 in forum Actionscript 3.0 newbies
    Replies: 1
    Last Post: 21-01-09, 13:33
  3. Remove sound inside an external swf file loaded
    By xoxo in forum advanced Actionscript 3.0
    Replies: 4
    Last Post: 13-01-08, 10:12
  4. access loaded object
    By jimbo in forum Actionscript 3.0 newbies
    Replies: 6
    Last Post: 18-10-07, 12:20
  5. tween display above loaded swf
    By jimbo in forum Actionscript 3.0 newbies
    Replies: 10
    Last Post: 16-10-07, 14:29

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts