Preloader which modifies the external SWF files every 5 seconds

Hello

I made a web banner in flash that loads an external swf and another external swf changes after 5 seconds. The banner have a preloader, but the problem becomes when you load the first time. As sovereign wealth funds are not cached in the cache of the browser and yet, time 5 seconds start counting from the preloader, and when the external swf file, shows only 1 second rest and it is replaced by another. There is a way to 'freeze' the time for each external swf until it loads completely?

The code that loads SWFs every 5 seconds (this code is placed in a layer of action):

start of the code:

var intervalId: number;
var: 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 (Thi, "executeCallback", duration, banners [count]);
}
else {}
Count = 0;
intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);
}
}

If (intervalId! = null) {}
clearInterval (intervalId);
}

intervalId = setInterval (Thi, "executeCallback", duration, banners [count]);

end of the code
----------------------------------------

And the code to the preloader (this code I place in the movieclip that loads external SWF files):

start of the code:

{onClipEvent (enterFrame)}
var gtT:Number = this.getBytesTotal ();
var gtL:Number = this.getBytesLoaded ();
var gtP:Number = int ((gtL/gtT) * 100);
If (TWG > 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 (Thi, "executeCallback", duration, banners [count]);
delete onEnterFrame;
}
}

end of the code

Note that I tried to freeze the time using a clearInterval does in the second code, but he simply doesn't work...

Any ideas? Thank you

Edson

Here's the correct code kglad send me. Thank you very much!

Tags: Adobe Animate

Similar Questions

  • How to determine the total number of images in the external .swf file loaded

    I have to be able to load both external .swf files and make them play in order. To do this, I need to know the number of images in the first .swf file so I can check _currentframe against _totalframes to determine when he is finished playing so that I can load another.

    Most of the stuff I see indicate that _totalframes on an external .swf can be determined by loading the .swf in a container clip and then check using a listener in the .onLoadInit. Like this:

    ------------------------------------------------------------------------------------------ ----------------------------

    this.createEmptyMovieClip ("tester_mc", 1);
    var mcListener:Object = new Object();

    mcListener.onLoadInit = {function (target_mc:MovieClip)}
    target_mc.onEnterFrame = function() {}
    If (this ._currentframe > = this ._totalframes) {}
    trace ("total frames =" + this ._totalframes);
    delete this.onEnterFrame;
    } else {}
    trace (target_mc._currentframe + "OF" + target_mc._totalframes);
    }
    }
    }

    var test_mc:MovieClipLoader = new MovieClipLoader();
    test_mc. AddListener (mcListener);
    test_mc.loadClip ("Ad_Group.swf", tester_mc);

    ------------------------------------------------------------------------------------------ -------------------------------------

    Unfortunately, this doesn't seem to work. The trace will always return a total number of frames of 1.

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I would appreciate any ideas on how to raise the total number of frames of an external .swf file or, Alternatively, put it another way when it's done playing. (Not only the loading, but play until the end.)

    TIA,

    C

    I guess it's because the container clip has only 1 frame, and the external .swf timeline seems to be ignored.

    I wouldn't imagine. My guess is that the main scenario for the external swf file has only 1 frame and the rest of the animation is inside a movieclip in this timeline. You publish this swf? Can you open the FLA and check how many images is open on the main timeline?

    The approach that you have mentioned is about what there is. But he knows check a chronology. If there are many nested movieclips, it may be impossible to understand what timeline you really want to be 'THE' full chronology.

    If you have the FLA, you can have the video call function on the _root timeline which tells the main swf that has completed a movieclip or something like that.

    Also, I have in my head somewhere that I recently saw something that someone made similar to this one, but do not remember... If it appears in my head that I will post.

  • How to resize the external .swf files?

    Hello

    THA following the code is to resize the video Clips which are on stage. But how can I resize externally. SWF files? I am adding an external .swf file through Gallery_mc.addChild (loader);

    The following code works very well for resizing of video Clips on stage:

    var myStage:Stage = this.stage;

    myStage.scaleMode = StageScaleMode.NO_SCALE;

    myStage.align = StageAlign.TOP_LEFT;

    function initialDisplay(event:Event):void {}

    var swfWidth:int = myStage.stageWidth;

    var swfHeight:int = myStage.stageHeight;

    Gallery_mc. Width = swfWidth;

    Gallery_mc. Height = swfHeight ;}

    addEventListener (Event:ENTER_FRAME, initialDisplay);

    Help, please.

    Thank you.

    It is not supposed to resize an external swf, unless you load it.  If you load, use a complete listener to resize:

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, f);

    Loader.Load (new URLRequest ("swf1.swf"));

    function f(e:Event):void {}

    addChild (loader);

    Loader.Width = Whatever;

    etc.

    }

  • How to make reference to the external SWF file using if statement?

    I have a main swf file that loads several external SWF file when the user clicks a menu button. Now I want to target a specific swf file to Add an extra library child or of another swf when this specific swf file is loaded. How should I do? What should I put in the stated case?

    ///////////////////////////////////////////////////////////

    var newswf:URLRequest = new URLRequest (".") ("/ swf /" + event.target.name + ".swf");

    Loader.Load (newswf);

    addChild (loader); dynamically load SWFs

    If (newswf == ".") ("/ SWF/pubResCHETNA.swf ') //error here

    {

    FC.buttonMode = true;

    FC.addEventListener (MouseEvent.CLICK, full screen);

    }

    function fullScreen(e:MouseEvent):void

    {

    var loaderF:Loader = new Loader();

    loaderF.load (new URLRequest ("PopupFullscreen.swf"));

    addChild (loaderF);

    }

    ////////////////////////////////////////////////////////

    The State must be newswf.url == the path. However I store event.target.name as a variable and use it in the State. You use "." for your path so the condition probably will always fail.

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • How to unload the external .swf file when pass the other section?

    Hello

    The following code provided by Mr. kglad works very well to load an external .swf file on stage. Now, when I click on Contact (button), the file external .swf to disappear completely. How to encode on contact (button) to get by.

    Gallery.addEventListener (MouseEvent.CLICK, GalleryClick);

    function GalleryClick(e:Event):void {}

    If (currentClip! = Gallery_mc) {}

    currentClip.visible = false;

    Gallery_mc. Visible = true;

    currentClip = Gallery_mc ;}

    var loader: Loader = new Loader();

    loader.contentLoaderInfo.addEventListener (Event.COMPLETE, ClipLoaded);

    Loader.Load (new URLRequest ("Gallery.swf"));

    function ClipLoaded(e:Event):void {}

    Gallery_mc. AddChild (Loader);

    Loader.x = 0;

    Loader.y = 120;

    Loader.Width = 1000;

    Loader.Height = 700

    }}

    I tried the following code for Contact_btn unload the Gallery.swf file that launches an error message: 1120: access of undefined property loader.

    Contact.addEventListener (MouseEvent.CLICK, ContactClick);

    function ContactClick(e:Event):void {}

    If (currentClip! = Cotnact_mc) {}

    currentClip.visible = false;

    Cotnact_mc. Visible = true;

    currentClip = Cotnact_mc;

    Gallery_mc.removeChild (loader);}}

    unloadAndStop() is supported by flash player 10 or higher (fp 10 +).

    p.s. Please check the useful/correct, if there is.

  • Problem with the playback of the external SWF sound

    Hello

    I need to load the external SWF file, which contains the simple + audio image sequence. I used the MovieClipLoader class for this and also a preloader, where I check if I can run the SWF safely, without having to pause later and continue with loading. It works similar to video YouTube, where the video is buffered.

    The problem is that when I load the SWF file and run it, the audio start to play later. I tried more cases and the reason is that even if I load enough of the SWF, I can be certain I can start reading, because it is not enough for audio, if you start playing a little later. When I insert more, the audio begins to play immediately.

    So the question is, is there a way how can I check if the audio is loaded and ready to play?

    Thank you

    Michal

    If you can inspect the external swf fla enough to know that synchronize sound is set to stream, you should be able to look at the scenario where the sound is attached and determine the number of images, the sound is.

  • Loading external SWF files...

    I hope that I can make sense of it. I have my main SWF, which is a background image and a bar of buttons at the bottom. When you click on one of the buttons, the loader object is another SWF to cover the bottom. First time isn't a problem, but if you click on another button at the bottom, the original background image flashes through the new page will load in.

    I know this isn't a big deal, but it bothers me. How can I go about creating a smooth transition between files?

    Place the background image into a MovieClip. Place the MovieClip on the stage where you got the background image. Give it a name in the Properties window for the instance on the stage and then his set _visible to false on all buttons or call a function from buttons that does this.

    However if you use loadMovie, you will always see a difference if the same target is used because the target is destroyed at the beginning of the loadMovie method and until the internet serves the first frames of the external swf file target is empty.

    A buffering approach can be explored by using more than one target, MovieClipLoader and exchanging multiple depths (or interpolation of transition) when the MovieClipLoader.onLoadInit method is called.

  • Preloader is running on top of the external SWF

    I have a very simple preloader that loads an external SWF. It almost works. :-)

    I find that the external SWF appears in the window - good - but the preloader continues to run on top of it - bad. I have attached the actionscript code that is in my preloader...

    To see it in action, go HERE.

    Thanks in advance!
    -bryan

    ================================================

    Thank you very much. But I think that I'm not sure why the progress bar is HERE. If the SWF file is loaded and appears in the window, why is the progress bar still there and running? Why didn't he go away? The progress bar is correct, and the SWF file is displayed even if it is only partially charged?

    I finally subordinate the visibility of the external SWF that it is fully charged - so bytesLoaded file< bytestotal,="" then="" the="" swf's="" visibility="" is="" set="" to="" false.="" maybe="" that's="" just="" kludge,="" but="" it="">

    Again, thank you for answering my question!

  • How to preload external swf file in my main timeline?

    To try to reduce the size of the file for download time... I have a SWF file that I placed it by using the "UILoader" (not sure if it's the right thing to do)... what I would like to work on is how to make a preloader in my main to this SWF file timeline when it comes...

    I hope that makes sense - I am very new to all this and struggling with terminology, etc.

    I thought that Actionscript would be right now what I need - but not a clue...

    I conclude this thread for people who seek a way preload external SWF files. However, please note that I started a new thread to unload the file again on a mouse event... so even if it's not completely final it will start the process of an external SWF preloading... Hope this helps someone.

  • How to load external swf files into the AIR

    I try this code its working at the computer, but when I publish this .apk or .ipa file, my external swf file does not open

    (I included my external file as well)

    places_btn.addEventListener (MouseEvent.MOUSE_DOWN, newvid);

    function newvid(event:MouseEvent) {}

    trace ("you clicked me");

    var loadit = new Loader();

    addChild (loadit);

    loadit. Load (new URLRequest ("scene02.swf"));

    }

    01.jpg

    Add this in your newid function:

    You forgot to put the beginning of your original function:

    var loadit = new Loader();

    addChild (loadit);

    var _lc:LoaderContext = new LoaderContext (false null, ApplicationDomain.currentDomain),

    loadit. Load (new URLRequest ("scene02.swf"), _lc);

  • How to prevent the sounds of the timeline in external swf files to play during the loading?

    I'm having a problem with the sounds of the external timeline in the swf files play while charging in a main swf file. Can someone help me?

    Here is a part of the main code of the swf. I hope I got enough.

    Thank you.

    import flash.events.MouseEvent;

    import flash.display.MovieClip;

    import flash.display.Loader;

    to import flash.events.ProgressEvent;

    import flash.events.Event;

    import flash.net.URLRequest;

    Import fl.events.SliderEvent;

    import flash.media.SoundTransform;

    preloader_mc.fill_mc. ScaleX = 0;

    var swfA:Array = ["part1.swf", "part2.swf"];

    var frameA:Array = [];

    var currentLoader:Loader;

    var swfTotalFrames:int;

    var tl:MovieClip =;

    var st:SoundTransform = new SoundTransform()

    var int index = 0;

    loadNextF();

    play_slider. Enabled = false;

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    TL ["loader_" + index].contentLoaderInfo.addEventListener (ProgressEvent.Progress, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.Complete, completeF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function progressF(e:ProgressEvent):void {}

    var fractionLoaded:Number = index/swfA.length+e.bytesLoaded/(e.bytesTotal*swfA.length);

    preloader_mc.fill_mc. ScaleX = fractionLoaded;

    preloader_mc. TF. Text = (100 * fractionLoaded) + "% Loaded";

    }

    function completeF(e:Event):void {}

    TL ["loader_" + index].contentLoaderInfo.removeEventListener (ProgressEvent.PROGRESS, progress F);

    TL ["loader_" + index].contentLoaderInfo.RemoveEventListener (Event.Complete, completeF);

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    frameA.push (mc.totalFrames);

    index ++;

    if(index<swfA.Length) {}

    loadNextF();

    } else {}

    / / full of all charges.  start playing.

    restart_mc.buttonMode = true;

    restart_mc.Alpha = 1;

    tl.addEventListener (Event.ENTER_FRAME, playUpdateF);

    tl.removeChild (preloader_mc);

    preloader_mc = null;

    play_slider.enabled = true;

    playpause_mc.Alpha = 1;

    currentLoader = tl ["loader_0"];

    tl.addChild (currentLoader);

    MovieClip (currentLoader.content) .play ();

    sliderParamsF();

    }

    }

    I have about 70 sounds in my two external SWF. What I need to stop all of them?

    //---

    more than likely, Yes. I guess it depends on how you have 70 put sounds up in your external swf file... I mean:

    you have 70 movieclips appointed on the external swf stage with a distinct sound in each of them? and each have a stop() action in the first picture?

    or

    you say your external swf to go to a certain image tag that plays a sound on the timeline to this label?

    or

    are your 70 sounds created dynamically with code and told. start()?

    //---

    Keep in mind, a swf loading will start to play even before it is fully charged. So instead of when it is fully charged, try stop the loaded swf with a listener for 'init', i.e. when the swf file loaded passes its first image:

    function loadNextF (): void {}

    TL ["loader_" + index] = new Loader();

    TL ["loader_" + index] .name = index.toString ();

    . contentLoaderInfo.addEventListener TL ["loader_" + index] (ProgressEvent. COURSES, progressF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.COMPLETE, completeF);

    TL ["loader_" + index].contentLoaderInfo.addEventListener (Event.INIT, initF);

    TL ["loader_" + index] .load (new URLRequest (swfA [index]));

    }

    function initF(e:Event):void {}

    SoundMixer.stopAll ();

    var mc:MovieClip = MovieClip (tl ["loader_" + index] content);

    mc.gotoAndStop (1);

    }

  • Unloading of an external SWF that is loaded with a close button on the external SWF to unload

    I found a discussion on this topic, but I still have problems to work and was hoping to get some help here.

    Here, I have a file: http://www.dril-quip.com/test/main.swf

    I: main.swf (menu) and I module.swf (content)

    If you go to the wellhead systems/SS-15 BigBore II submarine and click on I have to load an external swf which covers most of the parent company.

    So far so good. My problem drains the loaded swf to 'Child' with the button provided on the loaded swf to 'Child'.

    Here is the code that I used to upload the file but I can't, for the life of me, find a way to unload.

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);

    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");

    bigboreLoader.load (bigboreRequest);
    stage.addChild (bigboreLoader);

    I am sure that it requires the child to communicate with the parent somehow, but I'm at a loss. If I could get a bit of advice or a link to something to deal with this, it would be a great help. I just need to have my links loading my modules and remove it when the narrow buttong is struck on the loaded swf file. I promise you that I did some research and I confess that I found asnwers, but still they do not work. I found the code below:

    Main FLA:

    function removeF() {}

    removeChild (bigboreLoader);

    }

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);

    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");

    bigboreLoader.load (bigboreRequest);
    stage.addChild (bigboreLoader);

    EXTERNAL FLA:

    btnClose2.addEventListener (MouseEvent.CLICK, bigborecontent);

    function bigborecontent(myevent:MouseEvent):void {}

    MovieClip (parent.parent) .removeF ();

    }

    I think I have a poor understanding of the code. Thanks for any help you might be able to provide.

    again, this code should all be on the same timeline as btnbb2. in main.fla.

    var bigboreLoader:Loader = new Loader();
    btnbb2.addEventListener (MouseEvent.MOUSE_UP, bigborecontent);


    function bigborecontent(event:MouseEvent):void {}
    var bigboreRequest:URLRequest = new URLRequest ("moduletemplate.swf");
    bigboreLoader.load (bigboreRequest);
    addChild (bigboreLoader);

    }

    function removeF() {}

    removeChild (bigboreLoader);

    }

    /////////////////////// end main.fla code ///////////////////////////////////////

    This code should all be on the main timeline in FLA EXTERNAL.

    and btnClose2 should be placed on the main timeline in your external fla. //

    btnClose2.addEventListener (MouseEvent.CLICK, bigborecontent);

    function bigborecontent(myevent:MouseEvent):void {}

    MovieClip (parent.parent) .removeF ();

    }

    end external fla code.

  • Communicate with the embedded SWF files

    So if I have several external swf into one big, how can I communicate with each other?

    More specifically,.

    -the swf principal needs to know when the keys were pressed in a shipped, and he needs to tell you all the other included those on this subject.

    -embedded SWFs must intelligently resize and shuffle around each other, while keeping their origins coordinated in the upper corner.

    How can I go about it?

    As long as you mean by "shipped" you load swf files in you main file dynamically, then there is hope for all that you have planned.  If you mean that import you into the library by embedded and plant them in the chronology of the main file, that does not work.

    The other event and the event or Manager is coded in the main SWF.  Are the code loaded SWF to displatch events than the main file of the headphones for.  If simply scream of the loaded swf when they will, not for mutual assistance who hears him... allowing them to compile without dependence on the master file.

    If in the film loaded, which triggers the need to rehabilitate the main file in action would send an event as follows...

    dispatchEvent (new Event ("eventName")); name of the event you want to

    To add the listener in your main swf file, listen for the complete event of load on the Loader.contentLoaderInfo which is used to load the file.  In the complete event handler, add the listener for the event on the loaded swf file.

    function loaderCompleteHandler(e:Event) {}
    MovieClip (e.currentTarget.content) .addEventListener ("eventName", eventHandler);
    }

    function eventHandler(event:Event):void {}
    trace ("load swf triggered event");
    }

  • addition of html in the box edge animate the text of the external js file

    I have a text field in the anime that I want to update with a score of edge. The function that allows you to click and update the partition is in an enternal file so I'll try to figure out how to get my div animated dashboard replaced by jquery in the external file. That's what I have so far in the external js, but it is not reading the field to animate the text of edge correctly:

    external .js file:

    AdobeEdge.coinCounter += 250; It called the coinCounter variable introduced in edgeActions.js and the initial value of 0 updates
    Alert (AdobeEdge.coinCounter); This shows that it works and updated correctly

    var comp = AdobeEdge.getComposition ("EDGE-172492634");

    var point = comp.getStage ();

    stage.sym.$("gameText").html (AdobeEdge.coinCounter); It's when things go wrong. I want this updated value in the text box named 'gameText' which is in the composition of edgeAnimate

    stage.sym.$("gameText").html ("NewText"); There is no indication in the text box 'gameText. " something must be wrong how am I referencing outside edgeActions in the external .js file

    Did someone mind helping me to refer to the text box 'gameText"correctly so I can enter my new value? Thank you!!

    Hello

    You must remove "sym.": internship. $("gameText").

  • With the help of a button to load and unload the external SWF in AS3?

    How can I use a button to load and unload a sequence of external SWF files, as a Next button and previous?

    I don't know if it will work because apparently you are trying to load a swf AS1/2, but try

    change the line to be...

    _swfTempClip = MovieClip (event.target.content);

    If this does not work, then you will need to create _swfTempClip as a new MovieClip and add the event.target.content to this MovieClip using addChild().

Maybe you are looking for