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

Similar Messages

  • 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
    =(

  • External SWF preloader

    Hi,
    I have a SWF file with a loader, in which i need to load an
    external multiframe swf file.
    The problem i am experiencing is that the loader does not go
    all the way too 100% and the loading swf starts playing after
    around 20% have loaded. Basically, i need the external file to
    start playing only when it's completely loaded.
    Any help would be appreciated.
    I have looked at this topic, however have not really
    understood the solution.
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1223099&highlight_key=y&keyword1=external%20swf%20preloader

    k, never mind..... finally figured it all out.

  • 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.

  • 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

  • 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.

  • 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!

  • 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.

  • Loading external swf  not complete

    Hi, I'm trying to load external swf (with more than one frame and actionscript 3 on every frame - I used there "timeline" coding) from my main swf.
    code for loading external swf into main swf:
    var loader01:Loader;
    function openGame1(evt:Event):void
    loader01 = new Loader();
    var requestSWF01:URLRequest = new URLRequest("game01.swf");
    loader01.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, processHandler);
    loader01.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
    loader01.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
    loader01.load(requestSWF01);
    addChild(loader01);
    function processHandler(evt:ProgressEvent):void
    var loaded:Number=evt.target.bytesLoaded;
    var total:Number=evt.target.bytesTotal;
    var stav:Number=loaded/total;
    loaded_txt.text=(Math.round(stav*100))+" %";
    function initHandler(evt:Event):void{
    loaded_txt.text="";
    function errorHandler(evt:IOErrorEvent):void
         trace ("Error: " + evt.text);
    I found out that this works only for loading swf, which has only one frame (and all actionscript on that frame)... It seems that if there are more frames, than it will not load complete swf (hmm maybe it is caused, because not all objects on frames are export in first frame). Preloading starts but after for example 20 % the event.INIT is fired and the external swf starts to play (and crashes..).
    You can see this here http://bvyborcik.xf.cz/  If you click on the blue building on the left with blinking text "Start hry" you will see what happens - preloading is not completed and after clicking on first floor btn, the swf crashes...
    Please is there a solution for this kind of problem?  Any help or pointing is welcome.
    regards Boris

    just curious, is the file you want to load the swf into set up exactly the same way with the same stage size, fps, and layers?

  • FAQ: How do I load an external SWF file into a parent SWF file?

    A ton of Flash users visit Adobe’s we site every month wondering  about how to load an external SWF file from within another SWF.
    Adobe's own TechNote on the subject attempts to answer the basic question, along with some common follow-up questions, including:
    How do I load more than one SWF?
    How do I load a SWF into a specific location in the display list?
    How do I resize the loaded SWF?
    How do I set its X and Y location?
    Here are some additional resources that elaborate on loading content and on working with the display list:
    Sample files for the above TechNote. A set of 3 FLA and 3 corresponding SWF files, including a parent SWF and 2 SWFs that the parent loads.
    Help > AS3 Developer’s Guide > Loading an external SWF file
    Help > AS3 Developer’s Guide > Loading display content dynamically
    Loading multiple external SWFs within a main SWF – CreativeCow.net forums
    Video tutorial: ActionScript 101 – Episode 6: Adding named objects to the Stage. By Doug Winnie. An example of how to add the loaded external asset to the Stage and modify its location or other properties.
    Video tutorial: Preloading in ActionScript 3.0.  By Lee Brimelow. A slightly more complicated example, showing how to  make the parent SWF display information about the progress of loading  the external SWF.
    Tutorial: Loading and unloading SWFs - FlashAndMath.com
    This article provides several examples of how to communicate between a parent SWF file and the loaded SWF:
    SWF to SWF Communcation via ActionScript 3.0 (by kglad)

    quote:
    Originally posted by:
    NedWebs
    You now seem to want to get rid of the swf once it has loaded
    and played itself thru. To do that you would need to have something
    in the swf itself that triggers its removal in its last frame. The
    following might work...
    MovieClip(this.parent).removeChild(this);
    Unfortunately I couldn't get this to work. I placed it on the
    last frame of the SWF to be called - is that right?
    I am not sure I am doing it correctly...

  • Problem with volume handle and external SWF

    Hello I'm having 2 problems.
    The first is that when loading an external swf in my main SWF I get this in the output window:
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at audio_fla::list_1/frame1()
    at flash.display::Sprite/constructChildren()
    at flash.display::Sprite()
    at flash.display::MovieClip()
    at audio_fla::MainTimeline()
    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at audio_fla::MainTimeline/frame1()
    But it still works. Its an mp3 player.
    The other problem is that the loaded SWF has a volume controller. When I test the external SWF by itself it works fine. When I load it on my main SWF when I start to drag the handle on my volume slider and MOUSE_UP outside the handle it still keep dragging the handle.
    The code of my main SWF is:
    import caurina.transitions.*;
    var _currentCategory:String = "";
    var percent:String = "";
    var loader = new Loader();
    loader.name="videoLoader";
    loadermc.visible=false;
    cat.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
    cat.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
    cat.addEventListener(MouseEvent.CLICK, onClickCat);
    btnback.addEventListener(MouseEvent.MOUSE_OVER, onOverCat);
    btnback.addEventListener(MouseEvent.MOUSE_OUT, onOutCat);
    btnback.addEventListener(MouseEvent.CLICK, onClickBack);
    cat.buttonMode = true;
    btnback.buttonMode = false;
    btnback.visible = false;
    function onOverCat(e:MouseEvent):void{
         Tweener.addTween(e.target, {alpha:.5 , time:.5});
    function onOutCat(e:MouseEvent):void{
         Tweener.addTween(e.target, {alpha:.25 , time:.5});
    function onClickBack(e:MouseEvent):void{
         loader.unloadAndStop();
         loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
         lcontent.visible = false;
         cat.visible = true;
         Tweener.addTween(cat, {alpha:1, time:1});
         btnback.buttonMode = false;
         btnback.visible = false;
         cat.buttonMode = true;
         toptxt.text = "SELECCIONE UNA CATEGORIA"
    function onClickCat(e:MouseEvent):void{
         lcontent.visible=true;
         cat.buttonMode = false;
         Tweener.addTween(cat, {alpha:0, time:1, onComplete:function(){
                                  cat.visible = false;                                                       
                                  btnback.buttonMode = true;
                                  btnback.visible = true;
                                       loaderTweenIn(e.target.name);
    function loaderTweenIn (c:String):void{
         var category:String = c+".swf";
         trace(category);
         loader.load(new URLRequest(category));
         loader.contentLoaderInfo.addEventListener (Event.COMPLETE, movieLoaded);
            loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, movieProgress);
    function ioErrorHandler(e:IOErrorEvent):void{
         trace("ioErrorHanlder: "+e);
    function movieLoaded(e:Event):void{
         trace("The movie has loaded");
         lcontent.addChild(loader);
         loadermc.visible=false;
    function movieProgress(e:ProgressEvent):void{
         loadermc.visible = true;
    //     percent=String(Math.floor(e.bytesLoaded / e.bytesTotal * 100)) + "%";
         trace("The movie is loading "+Math.floor(e.bytesLoaded / e.bytesTotal * 100));
    The code on my external SWF is:
    import caurina.transitions.*;
    volume_mc.slider_mc.buttonMode = true;
    var myXML:XML;
    var thb:Thbs;
    var myThumbs:XMLList;
    var totalThumbs:Number;
    var thumbHeight:Number=50;
    var i:uint = 0;
    var preloader:LoaderAnim;
    var yCounter:Number = 0;
    var container:MovieClip;
    var musicReq:URLRequest;
    var music:Sound = new Sound();
    var sc:SoundChannel;
    var currentSound:Sound = music;
    var pos:Number;
    var songPlaying:Boolean = false;
    var songlist:XMLList;
    var currentIndex:Number = 0;
    mc_sound.mute.visible=false;
    var xmlLoader:URLLoader = new URLLoader();
    ///////////////////////////PLAYLIST//////////////////
    function initMediaPlayer(e:Event):void{
         myXML = new XML(xmlLoader.data);     
         myThumbs = myXML.*;
         totalThumbs = myThumbs.length();
         trace("The total thumbs are "+totalThumbs);
         createContainer();
         callThumbs();
    xmlLoader.load(new URLRequest("audio.xml"));
    function createContainer():void{
         container = new MovieClip();
         list.ch.addChild(container);
         container.y = 0;
         container.x = 0;
         container.buttonMode = true;
    function onOver(e:MouseEvent):void{
         var t:Loader = Loader(e.target);
         Tweener.addTween(t, {alpha:.5, time:1});
    function onOut(e:MouseEvent):void{     
         var t:Loader = Loader(e.target);
         Tweener.addTween(t, {alpha:1, time:1});
    function callThumbs():void{
              var thumbURL = myThumbs[i].@thumb;
              var thumbTitle:String = myThumbs[i].@title;
              var thumbDesc:String = myThumbs[i];
              trace("Loading "+thumbURL);
              trace("Title "+thumbTitle);
              trace("Desc "+thumbDesc);
              var thumbLoader = new Loader();
              thumbLoader.load(new URLRequest(thumbURL));
              thumbLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, thumbLoaded);
              thumbLoader.name=i;
              thumbLoader.x=5;
              thumbLoader.y=5;
              thb = new Thbs();
              container.addChild(thb);
              thb.thb_title.htmlText = thumbTitle;
              thb.thb_desc.autoSize = TextFieldAutoSize.LEFT;
              thb.thb_desc.htmlText = thumbDesc;
              thb.y = (thumbHeight+2)*yCounter;
              preloader = new LoaderAnim();
              preloader.x = thb.x + 20;
              preloader.y = thb.y+ 20;
              container.addChild(preloader);
              yCounter++;
    function thumbLoaded(e:Event):void{
         var thbx:Loader = Loader(e.target.loader);
         thb.addChild(thbx);
         thbx.addEventListener(MouseEvent.MOUSE_OVER, onOver);
         thbx.addEventListener(MouseEvent.MOUSE_OUT, onOut);
         container.removeChild(preloader);
         i++;
         if (i<totalThumbs){
              callThumbs();
         if (i==totalThumbs){
              startAudio();
    xmlLoader.addEventListener(Event.COMPLETE, initMediaPlayer);
    ///////////////////////////////////////AUDIO//////////////////////////
    function startAudio():void{
         songlist = myXML.*;;//this is the same as myXML.*;
         trace("This is the first song "+songlist[0].@song);
         musicReq = new URLRequest(songlist[0].@song);
         music.load(musicReq);
         sc = music.play();
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);     
    next_btn.addEventListener(MouseEvent.CLICK, nextSong);
    prev_btn.addEventListener(MouseEvent.CLICK, prevSong);
    pause_btn.addEventListener(MouseEvent.CLICK,pauseSong);
    stop_btn.addEventListener(MouseEvent.CLICK,stopSong);
    function nextSong(e:Event):void
         if (currentIndex < (songlist.length() - 1))
              currentIndex++;
         else
              currentIndex = 0;
         var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
         var nextTitle:Sound = new Sound(nextReq);
         sc.stop();
         sc = nextTitle.play();
         songPlaying = true;
         currentSound = nextTitle;
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
    function prevSong(e:Event):void
         if (currentIndex > 0)
              currentIndex--;
         else
              currentIndex = songlist.length() - 1;
         var nextReq:URLRequest = new URLRequest(songlist[currentIndex].@song);
         var prevTitle:Sound = new Sound(nextReq);
         sc.stop();
         sc = prevTitle.play();
         songPlaying = true;
         currentSound = prevTitle;
         sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
    function pauseSong(e:Event):void
         pos = sc.position;
         sc.stop();
         songPlaying = false;
         play_btn.addEventListener(MouseEvent.CLICK,playSong);
    function playSong(e:Event):void
         if(songPlaying == false)
              sc = currentSound.play(pos);
              sc.addEventListener(Event.SOUND_COMPLETE, nextSong);
              songPlaying = true;
              play_btn.removeEventListener(MouseEvent.CLICK,playSong);
    function stopSong(e:Event):void
         sc.stop();
         pos = 0;
         songPlaying = false;
         play_btn.addEventListener(MouseEvent.CLICK,playSong);
    ///////////////////////////////VOLUME/////////////////////////////
    var xOffset:Number;
    var xMin:Number = 0;
    var xMax:Number = volume_mc.track.width;
    volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown);
    volume_mc.slider_mc.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
    stage.addEventListener(MouseEvent.MOUSE_UP, sliderUp);
    function sliderDown(e:MouseEvent):void{
         stage.addEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
         xOffset = mouseX - volume_mc.slider_mc.x;
    function sliderUp(e:MouseEvent):void{
         stage.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
    function sliderMove(e:MouseEvent):void{
         volume_mc.slider_mc.x = mouseX - xOffset;
         if(volume_mc.slider_mc.x<=xMin){
              volume_mc.slider_mc.x = xMin;
         if(volume_mc.slider_mc.x>=xMax){
              volume_mc.slider_mc.x = xMax;
         var vol:Number = volume_mc.slider_mc.x*.01;
         var st:SoundTransform = new SoundTransform(vol,0);
         sc.soundTransform = st;
         trace("The volume is "+vol);
         if(vol==0){
              mc_sound.mute.visible=true;
         }else{
              mc_sound.mute.visible=false;
         e.updateAfterEvent();

    I found the solution.

  • Trouble loading external .SWF into my main page with preloaders

    Dear All,
    I am working on my first Flash project with AS3.
    The structure of the flash site is pretty simple. I have a
    stage 1165px wide x 710px height
    Inside my Stage I have an horizontal bar with a menu followed
    by a container right under.
    **** My goal
    is that whenever I click on one of the button on the menu, that the
    related external .SWF loads into
    the container with a preloading bar and %. *****
    I already did all my .SWF files and it is pretty frustrating
    at this point to be stuck at this point of development.
    Please help.
    -Alex

    Visit gotoandlearn.com. There is a video tutorial there
    regarding preloading that should answer most, if not all, of your
    wonderings.

Maybe you are looking for

  • Since 1.3.1 update, can't send outgoing E-mails on Yahoo related accounts

    I have an email account from AT& T ([email protected]), and they must own Yahoo, or be associated because to access me E-mail through the web, I go to www.att.yahoo.com On my pre, none of my E-mails that use Yahoo, will send Email, and the messages g

  • IPhoto deleted all my RAW files when transferring??

    All my RAW files, 30 GB, from my summre holiday, just disappeared. Are there any way to recover them?? This was what happened: 1) I was in Sweden on holiday, brought my Macbook and left my iMac at home 2) I took a lot of picutres, and transferred the

  • Creating a java thread in a jframe class?

    hello is this possible to create a thread for a jframe class? so that everytime a connection is established, a new thread along with the gui is opened automaticly? if so, would i just need to insert extends Thread on my declaration of my class? i alr

  • Graphical Screen Painter error

    When i try to create a screen, the system show a message timeout loading gaphical screen painter, and open a screen painter alphnumeric. I try this in minisap 6.1 and netweaver, using sapgui 6.4. Guive me sugestions o solve m problem. Regards, thanks

  • Button on webview

    Hii, I am new to Iphone development. Can i place a button on webview so that the button will appear when we touch the webview.