Preload extern swf results in weid behavior. It this normal?

Hello,
I tried to load an external swf file. In this swf file i have an embeded movie so that i see the preloader in action.
What happens is, that while preloading i hear the movie playing in the background.
So when the external swf is at for example 20% preloading the timeline is already playing in the external swf.
Isn't that weird?
I also noticed that the Event.INIT get's executed sooner for example at 17%  progress.  This should be at 100% is it not?
And in CS3 i get the error while previewing the bandwidth profiler:
Error #2044: Unhandled IOErrorEvent:. text=Error #2036: Load Never Completed.
Does anyone know what is going wrong?
Regards,
Chris
This is the code i use:
package {
import flash.display.LineScaleMode;
import flash.display.DisplayObject;
import flash.net.URLRequest;
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.display.MovieClip;
* @author chris
public class PreloadMain extends MovieClip {
private var _loaderSprite:Sprite;
private var _request : URLRequest;
private var _loader : Loader;
private var _myMovie:Sprite;
public function PreloadMain() {
addEventListener(Event.ADDED_TO_STAGE, init);
private function init(event:Event):void {
_request = new URLRequest("../swf/main.swf");
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress, false, 0, true);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingComplete, false, 0, true);
_loader.contentLoaderInfo.addEventListener(Event.INIT, loadInit)
_loader.load(_request);
drawLoader();
private function drawLoader():void {
trace("draw");
_loaderSprite = new Sprite();
_loaderSprite.graphics.lineStyle(1, 0x000000,1,false, LineScaleMode.NORMAL );
_loaderSprite.graphics.beginFill(0x0000FF, 1);
_loaderSprite.graphics.drawRect(0, 0, 150, 20);
_loaderSprite.graphics.endFill();
_loaderSprite.x = stage.stageWidth/2 -_loaderSprite.width/2 ;
_loaderSprite.y = stage.stageHeight/2 - _loaderSprite.height/2;
addChild(_loaderSprite);
function loadProgress(event:ProgressEvent):void
    var percentLoaded:Number = event.bytesLoaded / event.bytesTotal;
    percentLoaded = Math.round(percentLoaded * 100);
  _loaderSprite.scaleX = percentLoaded/100;
   trace("loaded " +String(uint(percentLoaded)) + "%" );
    //this.percentLoaded.text = String(uint(percentLoaded)) + "%";
function loadingComplete(event:Event):void
  removeChild(_loaderSprite);
  _myMovie = Sprite(_loader.content);
  addChild(_myMovie);
_loader.contentLoaderInfo.removeEventListener( ProgressEvent.PROGRESS, loadProgress);
_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, loadingComplete);
_loader = null;
   trace("Load Complete");
function loadInit(event:Event):void {
trace("load Init");

It is normal to receive Event.INIT before Event.Complete because on Init event you may access as3 on loaded swf, but the symbols of library may still downloading.

Similar Messages

  • Preload external swf before play

    i have a project i am working on...but for some reason the solution i went with is not satisfying my instructor......
    so....here is my new code ( which is incorrect but i cant figure out how to arrange the preloader at the end )
    var Xpos:Number=0;
    var Ypos:Number=0;
    var swf:MovieClip;
    var bgloader:Loader = new Loader();
    var bgURL
    if(page==1){
    bgURL=new URLRequest("pages/home.swf");
    else if(page==2){
    bgURL=new URLRequest("pages/about.swf");
    else if(page==3){
    bgURL=new URLRequest("pages/projects.swf");
    else if(page==4){
    bgURL=new URLRequest("pages/experimental.swf");
    else if(page==5){
    bgURL=new URLRequest("pages/contact.swf");
    bgloader.load(bgURL);
    bgloader.x=Xpos;
    bgloader.y=Ypos;
    bg.addChild(bgloader);
    stop();
    var percent:Number = bgURL.bytesTotal;
    if(percent==100){
    gotoAndPlay("start");
    first off, i dont even know if what i am being asked to do is possible...but, what i am being requested to do is obviously load in the external swf BUT, the external swf cannot play until the MAIN swf is directed to "start"......
    i have done this numerous times in as1 and 2....but back then things were totally written different and if you do it the same way you run into migration issues....
    i thought this was solved already, but my instructor will not accept the method of using an event to be dispatched in the external SWF to tell the main swf when to play "start"....im not sure if there is any other way to do this?
    he wants the external swf to contain NO code other than what is necessary for its internal functions....
    everything is to be coded in the MAIN swf.....
    so im trying to use bytesTotal, and the percent==100 is just a number i threw in for example purposes.....i am just not figuring this out....
    any help is greatly appreciated

    From what I could gather based on your description, your instructor wants you to start playing when external swf is loaded completely.
    If my understanding is correct, what you need to do conceptually is:
    1. Instantiate Loader
    2. Add event listeners that you are interested in.
    3. Execute code corresponding to these listeners in their corresponding handler functions.
    As for No 2 - Usually there are at least 3 events that are of interest when dealing with Loaders:
    1. Event.COMPLETE - dispatched when entire target is loaded
    2. ProgressEvent.PROGRESS - dispatched when a new bytes packet arrives.
    3. IOErrorEvent.IO_ERROR - dispatched when something goes wrong with loading (say, wrong url, etc.)
    In your particular case it is supposed to be something like this (may not work because you did not describe what is the point of different swfs loading and how it affects entire application). SEE COMMENTS:
    stop();
    var swf:MovieClip;
    // always specify datatype
    var bgURL:URLRequest;
    if(page == 1) {
         bgURL = new URLRequest("pages/home.swf");
    else if (page == 2) {
         bgURL = new URLRequest("pages/about.swf");
    else if (page == 3) {
         bgURL = new URLRequest("pages/projects.swf");
    else if (page == 4) {
         bgURL = new URLRequest("pages/experimental.swf");
    else if (page == 5) {
         bgURL = new URLRequest("pages/contact.swf");
    var bgloader:Loader = new Loader();
    configureListeners();
    // now you are ready to load
    bgloader.load(bgURL);
    * Adds listeners.
    function configureListeners():void {
         // NOTE!!! Listeners are added to contentLoaderInfo - not Loader itself
         bgloader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
         bgloader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
         bgloader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    * Removes listeners.
    function removeListeners():void {
         bgloader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoadComplete);
         bgloader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
         bgloader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoadError);
    function onLoadComplete(e:Event):void
         // depeneding on the situation
         // you may want to add loaded swf
         // but before if swf exists - you need to remove it
         if (swf && this.contains(swf)) {
              removeChild(swf);
              swf = null;
         swf = bgloader.content as MovieClip;
         addChild(swf);
         // now play
         this.gotToAndPlay("start");
         // dont't forget to remove listeners
         removeListeners();
    function onLoadError(e:IOErrorEvent):void
         // deal with the error
    function onProgress(e:ProgressEvent):void
         // here you update preloader if you have one
         trace("Progress", e.bytesLoaded, e.bytesTotal);
    On a side note, the way you deal with instnatiating URLRequests is not the most efficient or scalable. A better approach would be to keep them in an array and call by index. Note, conditionals are gone.
    var bgList:Array = [
              "pages/home.swf",
              "pages/about.swf",
              "pages/projects.swf",
              "pages/experimental.swf",
              "pages/contact.swf"];
    var bgURL:URLRequest = new URLRequest(bgList[page]);

  • Preload External swf files

    I am trying to create a website that has a main swf file that
    loads several external swf files into itself.
    I would like the preloader not only to preload all of the
    "main" content, but also the content that exists inside the
    external swf files before proceeding to the main user interface.
    Any help that you could give, addresses to a tutorial would
    be much appreciated.
    Thanks in advance.

    You could load each movie using movieClip.loadClip(); and
    check it has been loaded by using a listener and the
    "myListener.onLoadInit" script to write your own function to begin
    the playhead for that movie.

  • Preload external swf's

    Hi,
    Every time I have asked this question, people say , just go
    online you'll find lots of preloaders out there. Or, its documented
    really well in flash help. BUt I still dont get it. Im sure that
    anyone who knows actionscript moderately well can figure it out no
    prob.
    All I want to do is preload 3 external swf's into my main
    movie - and I want to include the preloading script in the
    preloading script I already have for my main movie. This is the
    script Im using (it has a loader bar etc,..).
    onClipEvent (load) {
    if (_parent.getBytesTotal() == _parent.getBytesLoaded()) {
    quickPlay = true;
    } else {
    preLoad = (_parent.getBytesTotal() * 0.75); //percent to
    preload
    _parent.stop();
    onClipEvent (enterFrame) {
    gotoAndStop(loadedIndicatorFrame());
    if (quickPlay == true) { //quickly play the anim
    if (_currentframe == _totalframes) {
    _parent.play();
    } else { //wait for the preload
    if (_parent.getBytesLoaded() >= preLoad) {
    _parent.play();
    Can someone help me out here?
    Also, if I preload it right at the beginning, do I need to
    additionally specify the place (empty mc) that I want to eventually
    run it in?
    Thanks a million for anyone who can help with this. Please
    dont tell me its well document\ed, because although it may, Its
    just as hard to figure it out with the documentation, Im not great
    at action script.

    I'm having a similar issue!
    I am currently building a web gallery that loads external
    .swfs (of each gallery) into movie clip containers within seperate
    frames.
    Is there any way to preload those .swfs in the background
    before they are called upon by going to those frames?
    An example of a site I built in this manner can be found
    here:
    http://gillestoucas.com/
    Help! Thanks a bunch!

  • My Airport Extreme always needs a reboot for it to see an external drive plugged into it. Is this normal?

    The title pretty much sums it up. Every few days I have to reboot my AE in order for it to recognize the external drive (iOmega Prestige 500gb) I have plugged into it. Needless to say, it's pretty frustrating. I was hoping to setup the external drive so all of my computers could use it as a central device, but needing to reboot all the time kind of kills the convenience. Wondering if I'm doing something wrong?

    Relax. It's normal for an iOS device to turn on when it is plugged in and charging. You didn't hurt anything. As long as it has a charge, you can use it and it should come with a sufficient charge to use it right out of the box.
    Your phone will be fine. Charge it when you need to charge it. You didn't damage anything.

  • Loading an external SWF from an external SWF

    Hello,
    I'm somewhat caught between a rock and a hard spot on a flash
    site project. Here is the situation:
    I have created a parent movie (which loads all external SWFs
    inside of it) that has the menu navigation built into it. However,
    my client wants me to place some more links inside of the external
    SWFs that lead to other pages (external SWFs) of the site. Is this
    at all possible? I was hoping there is a way to tell a button in an
    external SWF to make the parent movie switch between external SWFs.
    Any and ALL help is very much appreciated. Thank you.
    Another question: does this involve using the _parent script?
    Elijah

    Hello,
    Thank you for replying. Here is exactly what I'm needing to
    do:
    We will call the parent file "index.swf". Inside "index.swf"
    I have a "holder" for external swf files to load into when I call
    on them from the main menu buttons on "index.swf". When a customer
    comes to the site, the "index.swf" file initially loads
    "welcome.swf". Inside of "welcome.swf", I have some images that I
    want to make into links to other external swf files.
    My problem is when someone clicks on one of those pictures I
    want the "index.swf" file to open up the corresponding external swf
    file in its "holder", where "welcome.swf" currently resides. Also,
    all of these swf files ("index.swf" included) have stand-alone FLA
    files, none are attached to one another. I have never worked with
    "levels" before, would that be necessary in this case? I have
    attached the code for the external swf loader.
    I hope that gives you a better idea of what I'm trying to
    accomplish.
    Thanks again.
    Elijah
    CODE:

  • Load external swf into existing mc

    I think this is very old question,
    in as2 you can just add a external swf inside a mc.  like this -  loadMovie ("example.swf", "_root.mc");  and that's it.
    how do i do that in as3? this following doesn't work..
    var newLoader:Loader = new Loader();
    function loadMc(evt:MouseEvent) {
        var request:URLRequest = new URLRequest("example.swf");
        newLoader.load(request);
        addChild(mc.newLoader);
    can I go remove mc first, and then add the swf as mc again?
    removeChild(mc);
    addChild(mc);

    Hi, moccamaximum,
    thank  you, going to test-fail-test for a while with this.
    meanwhile Im gonna ask ahead another thing
    Hi kglad, you gave me the source file for jpegTest yesterday, I tested it work like charm,
    now you have these,
    import JPEGEncoder;
    var bmpd:BitmapData=new BitmapData(mc.width,mc.height);
    bmpd.draw(mc);
    var jpegEnc:JPEGEncoder =  new JPEGEncoder(75);
    var jpegDat:ByteArray = jpegEnc.encode(bmpd);
    then in function localSave it send jpegDat to php for generating the jpeg.
    I want to pack these into calling function, so after example.swf loaded into mc, can call the function so the jpegDat will have the data of example.swf and generate the jpeg from it? 
    jpgDatGenerate('mc');
    function jpgDatGenerate (target) {
    var bmpd:BitmapData=new BitmapData(target.width,target.height);
    bmpd.draw(target);
    var jpegEnc:JPEGEncoder =  new JPEGEncoder(75);
    var jpegDat:ByteArray = jpegEnc.encode(bmpd);
    obviously something wrong, it gives me something about jpegDat not defined at localSave
    what have I missed?

  • How to Load an external swf using loadmovie in AS3

    I need to create a button with script, on rollover load an external swf into movieclip in AS3.  This was able to create this in AS2, but I need to create this in AS3

    Thanks again Ned.
    Kenneth Russell
    graphic artist, Sr.
    Lockheed Martin - MS2
    2323 Eastern Blvd., Baltimore, MD 21220
    Phone 410.682.0554    Fax 410.682.0543
    From: Ned Murphy <[email protected]>
    Reply-To: [email protected]
    Date: Thu, 23 Jul 2009 19:08:25 -0600
    To: kenneth russell <[email protected]>
    Subject: How to Load an external swf using loadmovie in AS3
    In AS3 you use the Loader class to load external swf's and image files.  You
    should be able to find examples both in the Flash help files and these forums
    if you search.  If you aren't aware of how to code buttons in AS3, that can be
    found as well.  In AS3, just about any kind of interction involves the use of
    event listeners in combination event handler functions... in the case of a
    button rollover an example would be...
    btnName.addEventListener(MouseEvent.ROLL_OVER, overHandler);
    function overHandler(evt:MouseEvent):void {
         // your loading code or whatever
    >

  • How can I get a preloader to launch a main (external) swf file, and have the main file remove the preloader once it's fully loaded?

    Using Flash MX, ActionScript 2:
    I’ve been struggling for several weeks, trying to get a preloader to work on a large (~80 MB) photo portfolio file (using the method where the preloader is on frame 1 of the file, and when loading is completed, it jumps to the content).  I’ve done countless tutorials, and none seem to work on my presentation.  I even tried downloading a trial version of CS4 so I could export every one of the file’s library movie clips and images so that they load on Frame 2 (a feature MX doesn’t have).  It takes about 20 seconds for the .exe to load from a CD, and no matter which preloader construction I use, it always seems to appear in the last few seconds before the movie loads completely.  During the initial wait time, there’s no indication that anything is happening:  no hourglass on the mouse, and not even a blank screen. This is only true for the first time that the file is loaded from the CD; on subsequent loads, the file must already be in RAM, because it loads within a few seconds. 
    I decided that I’m going to try and make the file which the user clicks on (one named Windows_Portfolio.exe or another called Mac_Portfolio.hqx) the preloader so that it would be tiny, and would load instantly.  I want that file to launch the external huge portfolio file (renamed files.swf), keep track of its loading progress, and cycle through a slideshow (10 thumbnail images that transition into each other over 100 frames) proportionally, based upon the percentage of files.swf that had been loaded.
    I assume that there should be a loadMovie() or a loadMovieNum() command on the preloader’s timeline to launch files.swf, and that the initial code of files.swf should have some sort of this._parent._visible=false or other way of deleting the preloader on level0.  Can anyone explain the steps to me, or direct me to a good Flash MX tutorial that explains how to launch another external swf from a preloader .exe, keep track of its load progress, and delete the preloader .exe once the external swf had been loaded?
    Also, I’ve read that, using this construction on a CD, every file has to be in the same place, and that I can’t nest files.swf in a folder named “files,” and reference it with files/files.swf.  Is this true?
    Thanks for any assistance you can offer.

    If you know JavaScript (ECMA Script) then you might be able to get it done applying a for loop and a random function
    to the for loop if you know how to get a page-loaded request into JavaScript.
    But an easier solution, if you know ActionScript 3.0, and if your SWF's don't need to be recoded and can load into a "container" SWF would be to create a master FLA file that loads your SWF's in a random fashion using Math.random() as a multiplier, though you won't see much variation if you only have 2-3 SWF's to load--if you had more than that then you would begin to benefit from the random function's capabilities.  In ActionScript 3.0 use the load() method along with addChild() to load the SWF and add it to the stage.  You will be able to search for specifics on how to code the FLA properly by using Flash's Adobe Help tool and also using an internet search.
    -markerline
    P.S. Once you have the master FLA coded you can Publish it to an SWF and an HTML and if the container/master SWF needs to be in a page with other content you can simply copy and paste the object and embed tags for the container SWF from the published HTML into any place on your master HTML that you need it to reside.  You can then use CSS to control placement of the SWF object if it is in a div tag.

  • Both main movie and external swf preloader - confusion!

    Hi there!
    I have a webite with my main movie (88kb) and an external swf
    soundloop (1mb). I made a preloader, but it only loaded the main
    movie, meaning that after the intro, the soundloop would not start.
    I loaded the soundloop onto level 1, and then tried to make a
    preloader with this code (I thoguht it worked but it really was a
    total guess).
    stop();
    this.onEnterFrame = function() {
    bl = _level1.getBytesLoaded()+this.getBytesLoaded();
    bt = _level1.getBytesTotal()+this.getBytesTotal();
    if (bt<=0) {
    bt = 99;
    bar.gotoAndStop(Math.floor((bl/bt)*100));
    if ((bl == bt) && (bt>0)) {
    delete this.onEnterFrame;
    gotoAndPlay("Intro", 1);
    Now when I test the movie, everything loads, but when the
    soundloop is loaded after the intro, the preloader movie clip
    appears and starts playing and repeating itself!
    How on earth do I get rid of this?! You can see the problem
    here:-
    http://www.vanitee.co.uk/princess.swf
    Thanks in advance

    Please! Still in great need of help. Have tried all sorts
    =(

  • Preloader in external swf not working

    I have several external SWFs that are loaded into my site and
    each one has a preloader. When I run them by themselves the
    preloader works fine, but when it is embeded into the main SWF the
    preloaders do not work. Any ideas?
    here is my actionscript -
    lBytes = _root.getBytesLoaded();
    tBytes = _root.getBytesTotal();
    percentLoaded = Math.floor((lBytes/tBytes)*100);
    loader.bar._xscale = percentLoaded;
    loader.percent.text = percentLoaded + "% of " +
    Math.floor(tBytes/1024) + "K loaded.";
    if (lBytes>=tBytes && tBytes>0) {
    if (count>=12) {
    gotoAndPlay("enter");
    } else {
    count++;
    gotoAndPlay("preload");
    } else {
    gotoAndPlay("preload");
    }

    I am experiencing the exact same problem on my site -
    www.expansiondesign.com
    It works in flash player but not when live (tested safari and
    firefox)
    I don't know if you are using the same script as I am paul.
    I execute the following when each image button is pressed:
    button1.onRelease = function () {
    startLoading("image1.jpg");
    which runs this:
    function startLoading(whichImage) {
    loadMovie(whichImage, "_root.image_holder");
    _root.onEnterFrame = function() {
    infoLoaded = _root.image_holder.getBytesLoaded();
    infoTotal = _root.image_holder.getBytesTotal();
    percentage = (infoLoaded/infoTotal*100);
    _root.loader._yscale = percentage;
    _root.loader._visible = true;
    if (percentage>=100) {
    delete this.onEnterFrame;
    _root.loader._visible = false;
    Thanks,
    Barton

  • External swf. preloader blues

    Hiya,
    I've just finished a website which is nearly ready to go
    live, all except the preloader. I need to have external swfs
    preload before running, and after going through a few tutorials and
    threads, I'm pretty sure that my website is constructed in such a
    way as to make it difficult to impliment the tutorials into my
    work.
    I've attached 2 fla. files (the main parent and one of the
    external files. ), and would be really greatful if someone could
    take a look at them and let me know how I could create a preloader
    for the exteranl files (in the attachement's case the
    "visual.fla").
    Thanks a million for your time.
    ...Probably obvious, but the visual.swf is launched when the
    "visual" button is pressed on the main home.swf.
    Cheers!
    http://www.yousendit.com/transfer.php?action=download&ufid=B95706E71E2DB94E&rcpt=goodwalla [email protected]

    did you manage to do this?
    If yes, then please let me know how you did it, cause I also
    want this
    10x

  • Preloader that changes external swfs every 5 seconds

    HI,
    I've done an web banner in flash that loads an external swf
    and changes for another external swf after 5 seconds. The banner
    have a preloader, but the problem becomes when it loads the first
    time. As the swfs aren't cached in the browser's cache yet, the
    time for 5 seconds starts to count from the preloader, and when the
    external swf finally shows, only rest 1 second and it is changed to
    another. There is a way to "freeze" the time for each external swf
    until it totally loads?
    The code that loads the swfs every 5 seconds (this code is
    placed into an action layer):
    begin of code:
    var intervalId:Number;
    var count:Number = 0;
    var maxCount:Number = 23;
    var duration:Number = 0;
    var banners:Array = new Array(
    "abatrade.swf",
    "bancobrasil.swf",
    "caparao.swf",
    "cedro.swf",
    "cesama.swf",
    "copasa.swf",
    "damatta.swf",
    "emtel.swf",
    "engedrain.swf",
    "extel.swf",
    "feedback.swf",
    "iti.swf",
    "intermedium.swf",
    "magnesita.swf",
    "maquenge.swf",
    "maxxdata.swf",
    "orteng.swf",
    "paiva.swf",
    "paraibuna.swf",
    "paraopeba.swf",
    "sabesp.swf",
    "serpro.swf",
    "soll.swf",
    "thawte.swf"
    function executeCallback(param:String) {
    var duration:Number = 5000;
    loadMovie(banners[count],loadmovie_mc);
    loadmovie_mc._x=0;
    loadmovie_mc._y=0;
    clearInterval(intervalId);
    if(count < maxCount) {
    count++ ;
    intervalId = setInterval(this, "executeCallback", duration,
    banners[count]);
    else {
    count=0;
    intervalId = setInterval(this, "executeCallback", duration,
    banners[count]);
    if(intervalId != null) {
    clearInterval(intervalId);
    intervalId = setInterval(this, "executeCallback", duration,
    banners[count]);
    //end of code
    And the code for the preloader (this code I place into the
    movieclip that loads the external swfs):
    //begin of code:
    onClipEvent(enterFrame) {
    var gtT:Number = this.getBytesTotal();
    var gtL:Number = this.getBytesLoaded();
    var gtP:Number = int((gtL/gtT)*100);
    if ( gtT > gtL ) {
    this._alpha = 0;
    _root.loader._alpha = 100;
    _root.loader.bar._width = gtP;
    clearInterval(intervalId);
    } else {
    this._alpha = 100;
    _root.loader._alpha = 0;
    intervalId = setInterval(this, "executeCallback", duration,
    banners[count]);
    delete onEnterFrame;
    //end of code
    Note that I tryed to freeze the time using a clearInterval in
    the second code, but it simply don't works...
    Any Ideas? Thanks
    Edson

    http://www.maxxdata.com.br/banners.zip
    Open the fla and preview the file with bandwidth preview (
    Crtl+Enter twice ). You will note that the third banner
    (caparao.swf) start to loads but it don't shows at all because the
    loading for a slow internet (56K) takes more than 5 seconds. So the
    loader skip to the next banner. Is there a way to "freeze" the time
    for the preloader (to give it enough time to the banner load
    completely, even in slow connections) and count the 5 seconds only
    to the banner itself?
    Thanks.

  • Preloader ignores external swf's actionscript

    Hey guys
    I have an External.swf file that is a video. The swf is 1135 frames long and running just fine by itself, stopping as I want when the actionscript says stop(); on the first frame and looping the end of the clip with gotoAndPlay(837).
    The preloader SwfLoader.swf linked to the External.swf shows the percentage of bytes loaded as it should. However, it runs the video (sound playing in the background) while the preloader shows the loading progress I think it's because it doesn't load the first frame first.
    Once the external swf is loaded, it plays the video again, still ignoring the first actionscript frame that says stop(); and the last frame gotoAndPlay(837).
    Thank you.
    Here is the preloader's actionscript on the first and only frame:
    import flash.geom.*
    import flash.display.*
    var loadurl:String = "External.swf";
    var nDepth:Number = 0;
    var nWidth:Number = 200;
    var nHeight:Number = 20;
    var nPadding:Number = 3;
    var cLoader:MovieClipLoader = new MovieClipLoader();
    var oListener:Object = {onLoadInit:onContentLoaded};
    var mcLoader:MovieClip = this.createEmptyMovieClip("Loader_MC", 0);
    var mcContent:MovieClip = this.createEmptyMovieClip("Content_MC", 1);
    var mcLoadBarBg:MovieClip = mcLoader.createEmptyMovieClip("LoadBarBg_MC", nDepth++);
    var mcLoadBar:MovieClip = null; //Duplicated later with mcLoadBarBg
    var txtPercLoad:TextField = null; //Create after duplication
    var cMatrix:Matrix = new Matrix();
    mcLoader._alpha = 0;
    cMatrix.createGradientBox(nWidth, nHeight, 0, nPadding, nPadding);
    cLoader.addListener(oListener);
    mcLoader.lineStyle(1, 0x000066, 100);
    DrawRect(mcLoader, 0, 0, nWidth, nHeight);
    mcLoadBarBg.lineStyle(1, 0x0000FF, 0);
    mcLoadBarBg.beginGradientFill("linear", [0x006699, 0x0066FF], [100,100], [0, 255], cMatrix, SpreadMethod.PAD);
    DrawRect(mcLoadBarBg, 0, 0, nWidth - nPadding*2, nHeight - nPadding*2);
    mcLoadBarBg.endFill();
    mcLoadBar = mcLoadBarBg.duplicateMovieClip("LoadBar_MC", nDepth++);
    txtPercLoad = mcLoader.createTextField("PercLoad_TXT", nDepth++, 0, 0, nWidth, nHeight);
    mcLoadBar._alpha = 80;
    mcLoadBarBg._alpha = 30;
    Translate(mcTextMask, nPadding, nPadding);
    Translate(mcLoadBarBg, nPadding, nPadding);
    Translate(mcLoadBar, nPadding, nPadding);
    mcLoadBar._xscale = 0;
    mcContent._alpha = 0;
    mcContent._lockroot = true;
    mcLoader._x = Stage.width/2 - mcLoader._width/2;
    mcLoader._y = Stage.height/2 - mcLoader._height/2;
    txtPercLoad._x = mcLoader._width/2 - txtPercLoad._width/2;
    txtPercLoad._y = mcLoader._height/2 - txtPercLoad._height/2;
    SetTextFormat(txtPercLoad, "0%");
    mcLoader._alpha = 100;
    cLoader.loadClip(loadurl, mcContent);
    _root.onEnterFrame = function()
       var nBytesLoaded:Number = mcContent.getBytesLoaded();
       var nBytesTotal:Number = mcContent.getBytesTotal();
       var nPercLoaded:Number = Math.round(nBytesLoaded / nBytesTotal * 100);
       if(nPercLoaded > 0)
          SetTextFormat(txtPercLoad, nPercLoaded.toString() + "%");
                mcLoadBar._xscale = nPercLoaded;
    function onContentLoaded(Void):Void
       //trace(_root + "::onContentLoaded");
       SetTextFormat(txtPercLoad, "100%");
       cLoader.removeListener(oListener);
       delete _root.onEnterFrame;
       delete oListener;
       delete cLoader;
       _root.onEnterFrame = function()
          //trace(_root + "::onContentLoaded::_root.onEnterFrame");
                var nInc:Number = 5;
                mcLoader._alpha -= nInc;
                mcContent._alpha += nInc;
                if(mcLoader._alpha <= 0) startLoadedContent();
    function startLoadedContent(Void):Void
       delete _root.onEnterFrame;
       mcLoader.removeMovieClip();
       mcContent._alpha = 100;
       mcContent.play();
    function DrawRect(mc:MovieClip, nX:Number, nY:Number, nW:Number, nH:Number, nR:Number)
       trace("DrawRect in: " + mc);
       if(nR == undefined) nR = 6;
       mc.moveTo(nX+nR,nY);
       mc.lineTo(nX+nW-nR,nY);
       mc.curveTo(nX+nW,nY,nX+nW,nY+nR);
       mc.lineTo(nX+nW,nY+nH-nR);
       mc.curveTo(nX+nW,nY+nH,nX+nW-nR,nY+nH);
       mc.lineTo(nX+nR,nY+nH);
       mc.curveTo(nX,nY+nH,nX,nY+nH-nR);
       mc.lineTo(nX,nY+nR);
       mc.curveTo(nX,nY,nX+nR,nY);
    function SetTextFormat(txtField:TextField, sText:String)
       var txtFmt:TextFormat = new TextFormat();
       sText = "Loading... " + sText;
       txtFmt.font = "Verdana";
       txtFmt.align = "center";
       txtFmt.size = 11;
       txtFmt.color = 0x000066;
       txtFmt.bold = true;
       txtField.selectable = false;
       txtField.text = sText;
       txtField.setTextFormat(txtFmt);
       txtFmt = null;
    function Translate(mc:MovieClip, nX:Number, nY:Number):Void
       mc._x = nX;
       mc._y = nY;

    Hi kglad,
    The external swf is a movieclip (flv embedded with an AS3 layer to control the timeline) exported as an swf file .
    The first frame of the external swf is just stop();
    I didn't know the proloader code was AS2 though
    The preloader works fine with the external swf locally, but the problem happens when I run them from my server.
    The external swf itself and its code works fine from the server, both combined don't, so I guess the problem comes from the preloader. Probably because of the AS being 2 insted of 3.

  • Differing behavior loading external swfs between Linux and Windows

    I have a swf that loads several different swfs that implement the same basic class, some of these external
    swfs also import different resources from library swfs, such as font, video, and graphic assets.
    This seems to work perfectly well on both windows and Linux with using the font and graphic assets in
    the flash player (debug v 10r32), everything works as I'd expect.  I am added everything into the main swf's
    appdomain when using the loader (with loadercontext, etc).
    When I am loading the video asset class in the external swfs, it works fine on both systems for the first swf
    loaded that uses the video class.  On windows, whenever the second swf using the video library loads up, it
    gives a #1065 Reference error pointing to one of the variables used in the video asset swf.  It runs fine on Linux.
    I've tried playing around with the different AppDomain settings to no avail.  I am stumped as to why it would
    function perfectly well in Linux, but fail on Windows.  Any pointers as to where to look next?
    Thanks for any and all help,
    RP.

    In this case, it appears to be differing versions of the flexsdk that was being used to compile the application.
    Windows was using the default tarball from the adobe site,
    Linux was using a more up to date version from svn.
    I updated the svn snapshot, recompiled, set the Windows box to use it, and the error messages have disappeared.
    I can still crash the flashplayer doing other things, but it's more or less working exactly as expected now.
    RP.

Maybe you are looking for

  • My iPhone 5C's time won't move forward unless I'm using my phone

    I'm an American student, currently studying abroad in Rome, Italy and over this weekend I went to London. When the time zone on my phone changed, I thought everything was fine, until later that day when I realized that my phone was like 9 hours off t

  • What is the recommended way to connect my iMac to Fedora

    Hello, Ever since the OSX 10.8.2, NFS has vanished so I can't connect to Fedora where I have an NFS server.  So what is the best way to set up Fedora to connect to an iMac.  I don't want to have to continue to connect by going to "Finder -> Connect t

  • Cannot connect to the internet from my MAC on WRT160Nv2 - no problems connecting from my PC

    Hi, I have just bought a WRT160Nv2, but I am having problems connecting to the internet from my MAC (a powerbook with OS X) when I connect to the router wirelessly. If I try from my PC the Internet works fine. Also if I connect the MAC directly to th

  • What is an action file?

    I downloaded a data usage file from my cell carrier website.  Instead of being a spreadsheet fie it had the suffix action.  What is that?  When I clicked it Automator wanted to know if I wanted to install it.  I clicked install and it crashed.  I ope

  • Administrator Role for "Create Travel Expense Report"

    Hello Everyone, I would like to know if there is any ESS "Role" that is provided by SAP for ESS which allows an administrator to "Create Travel Expense Report" for employees who doesn't have access to computers. I would appreciate your help. Kind Reg