Preloading SWFs

I have a project which, due to the large number of PNG files,
I have broken up into several smaller SWFs. I have so far
successfully managed to get them all to play in sequence using the
Load External Movieclip behaviour on the last frame of
each, so that it starts playing the first SWF and then
successively loads the next and then the next.
Now the problem: this project is NOT for playback on the
Internet, but rather will be used as a presentation. So I assumed
that using the Load External Movieclip would give smooth playback
as I don't have to take bandwidth into account.
However, each time a new Movieclip has to load, there is a
lag... if it is playing off a CD-ROM, the CD starts spinning again,
if it is on the local hard drive the lag is less but still
noticeable.
So how can I avoid this? Do I need to make a preloader for
this? Or can I put some ActionScript in the first movie which will
preload all the subsequent SWFs without needing to make a
preloader/progress bar?
And please in any answers, be as obtuse as possible... I'm
very, very new with AS!
Cheers
Rabaab

"Rabaab_m" <[email protected]> wrote in
message news:e4kf2b$hh$[email protected]..
> However, each time a new Movieclip has to load, there is
a lag... if it is
> playing off a CD-ROM, the CD starts spinning again, if
it is on the local hard
> drive the lag is less but still noticeable.
>
> So how can I avoid this? Do I need to make a preloader
for this? Or can I
> put some ActionScript in the first movie which will
preload all the subsequent
> SWFs without needing to make a preloader/progress bar?
>
> And please in any answers, be as obtuse as possible...
I'm very, very new with
> AS!
>
> Cheers
> Rabaab
Under those conditions you can load everything right in the
beginning and just wait for everything to load up. That puts all
the
loading lag up front in one lump without spreading the lag
through the whole presentation. Since it's loading locally you
don't
have to worry about the wait.
Since you would be loading everything, you don't want
everything to show, just parts of it. To do that you can either set
visibility to off for movieclips that you load into or
position out of view or the option that I like.. Make all the
external swfs
have a blank frame 1 and a stop command. When you want to
hide them, move them to frame 1. When you want to show them, move
them
to frame 2 and play. Each swf can have it's own preloader
that does nothing more than set a flag variable to notify the main
swf
that it is loaded.
Details if you need it.
tralfaz

Similar Messages

  • Preloading SWF for later

    I have a character in a game that has alot of animations
    associated with him. these animations are triggered by a rollover,
    and reside as seperate swf files on a server. what I want to do is
    preload an animation from the server, without actualy loading it
    into the movieclip. then once the rollover happens I want to play
    the preloaded swf in the movieClip. I've tried using loadMovie, but
    theres a few frames while the swf is loading where the movieClip is
    empty. Anybody have any ideas?
    Thanks,
    Simon

    Instead of using loadMovieNum create a empty movieclip in
    your main fla file. Assign a instance name to this movie clip and
    use movieClipInstance.loadMovie("bigFile.swf");. You can use
    MovieClipLoader class to check the progress of loaded content and
    then use onLoadProgress event to set movieClipInstance._visible =
    false;
    Please let me know if I'm not clear and send me the FLA file
    you are using. I'll make changes to the code.
    Thanks & Regards
    Ankur Arora
    Project Leader(Flash and Flex)
    http://flashdeveloper.blogspot.com
    let your
    thoughts fly to others... you will become rich.

  • Captivate CS6 Preloader (SWF) Error

    So - I changed the Captivate preloader value to 20%.  Now, I get an error when runnig the SWF with the Flash Debugger -
    ReferenceError: Error #1065: Variable CPPreloader is not defined.
    Huh??

    I believe there is a bug with the preloader that results, as you have found, in fail. Hopefully that will be fixed soon.
    Here's how I understand the HTML 5 output from Captivate and how you can use it in Dreamweaver.
    Basically it is HTML 5 ... so it's a bunch of text files like any HTML, so you can open it in Dreamweaver and edit it to suit your needs, drop it into pages/sites of your own, etc - >cough< with the caveat that if yuo are not sure what youa re doing, you could break something.
    But you didn't really explain what kind of integration you are looking for.
    e.g. If you publish as HTML 5 from Captivate, then edit it in Dreamweaver, can you then further edit it in Captivate ... NO you cannot. There is no round tripping between Captivate and Dreamweaver.
    Did you want, instead, to achieve something different?
    Steve

  • Preload SWF Levels into Main Movie

    Hello - Can anyone suggest a reliable and efficient way to
    preload several SWF movies into one Main "Container" SWF... and
    show one progress bar. My problem is that I don't need all my SWF's
    initially (they will be needed when the user navigates to that
    page) but I would like to load them into some sort of cache for
    later access. I would GREATLY appreciate any comments or
    suggestions! Thank You!!
    Here's what I am doing so far, but it's not working great:
    On my master SWF I have the following Code in Frame 1:
    stop();
    //---------Function to Load New Movie--------------\\
    var myMCL:MovieClipLoader = new MovieClipLoader();
    var myListener
    bject = new Object();
    myMCL.addListener(myListener);
    //---------/Preload Levels---------------//
    myMCL.loadClip("Movie1.swf", 1);
    myMCL.loadClip("Movie1.swf", 2);
    myMCL.loadClip("Movie1.swf", 3);
    myMCL.loadClip("Movie1.swf", 4);
    myMCL.loadClip("Movie1.swf", 5);
    myMCL.loadClip("Movie1.swf", 6);
    THEN: on frame 2, I have all the movies I don't want to play
    initially unload (with my thinking that they will be immediately
    accessible when needed):
    stop();
    unloadMovieNum(1);
    unloadMovieNum(2);
    unloadMovieNum(3);
    unloadMovieNum(4);
    unloadMovieNum(5);
    LAST OF ALL: I have this script in my preloader movie (to
    supposedly add up all the bytes to load and show one seamless bar
    for them all)
    onClipEvent (enterFrame) {
    // get the amount currently loaded for sum of all levels
    loading = ((_root.getBytesLoaded()) +
    (_level1.getBytesLoaded()) + (_level2.getBytesLoaded()) +
    (_level3.getBytesLoaded()) + (_level4.getBytesLoaded()) +
    (_level5.getBytesLoaded()) + (_level6.getBytesLoaded()));
    // get the total needed to load for sum of all levels
    total = ((_root.getBytesTotal()) + (_level1.getBytesTotal())
    + (_level2.getBytesTotal()) + (_level3.getBytesTotal()) +
    (_level4.getBytesTotal()) + (_level5.getBytesTotal()) +
    (_level6.getBytesTotal()));
    // get percent variable by dividing amount still loading by
    the total amount needed to load
    percent -= (percent-((loading/total)*100))*.25;
    // make the percent an integer (no decimal)
    per = int(percent);
    // display that integer with percent sign to make variable
    percentage load in dynamic text box
    percentage = per+"%";
    //move movie clip slider to show percentage
    tomMC._x = int(per * .01 * 230);
    // if the amount loaded is great than 99 percent (i.e. it is
    almost 100) then let master continue to play
    if (percent > 99) {
    _parent.gotoAndStop(2);
    Text

    Just a thought- can i refer to the external movie through the
    loading component instance name?
    Still wondering if I can control the time line inside the
    external movie from the main movie...

  • Preload swf in web pages

    Hi,
      I am trying to load a flash object in html using javascript. I have a requirement that i want to load the swf prior to loading html content. because in the html code i have a meta tag to refresh the page and redirect to other url. what i am doing In swf is some calculations and return the value to a javascript function. My problem is swf (500bytes, 1 * 1 size) is loading slowly and the control is redirecting to other resource.
    how can i preload flash (swf)

    Well, most people approach this from the angle of preloading INSIDE the swf content.  Google 'flash preloader'.  We have technotes on the topic too (it's a very common topic).
    If you -must- do it from the HTML side, then you're probably going to need to use some type of hidden div that you load first, provide some kind of alternate html content until that's loaded, and then that DIV either moves into your main display area.

  • Preload SWF's in Dreamweaver

    Is it possible to preload a SWF movie (instead of images)
    using the Preload images in the Behaviors panel in Dreamweaver MX
    2004? If not, is there a Javascript or an Extension that can do
    this...so that the same SWF movie (present in multiple .html files)
    won't play everytime the surfer clicks on a new URL or webpage?
    Thanks for looking to resolve my quandary.

    Nope. The only way to solve that problem would be to use
    Frames. Ew.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "Rainbird8" <[email protected]> wrote in
    message
    news:e2id5q$3ld$[email protected]..
    > Is it possible to preload a SWF movie (instead of
    images) using the
    > Preload
    > images in the Behaviors panel in Dreamweaver MX 2004? If
    not, is there a
    > Javascript or an Extension that can do this...so that
    the same SWF movie
    > (present in multiple .html files) won't play everytime
    the surfer clicks
    > on a
    > new URL or webpage?
    >
    > Thanks for looking to resolve my quandary.
    >

  • Preloader + SWF file

    I have a preloader built and ready to roll. The preloader is
    set to start on Frame 2 when all is downloaded. Is it possible to
    import a SWF file into frame 2 and allow the preloader download
    that and then start the SWF?

    Does anyone have any ideas?
    Thanks,
    Mattypee

  • Trying to preload swfs

    Hello,
    i have a main swf that i'm trying to preload other swf's
    into. i'm trying to add a Listener to the MovieClipLoader. i'm
    using flash cs3 and got the code from livedocs here:
    http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Liv eDocs_Parts&file=00001993.html
    here">here
    here's my code
    this.createEmptyMovieClip("swf_mc", 999);
    var myMCL:MovieClipLoader = new MovieClipLoader();
    //create the listener object
    var mcListener:Object = new Object();
    mcListener.onLoadError = function(target_mc:MovieClip,
    errorCode:String, status:Number) {
    trace("error loading: " + errorCode + " " + status);
    mcListener.onLoadStart = function(target_mc:MovieClip){
    trace("onLaodStart: " + target_mc);
    mcListener.onLoadProgress = function(target_mc:MovieClip,
    numBytesLoaded:Number, numBytesTotal:Number) {
    var numPercentLoaded:Number = numBytesTotal / numBytesLoaded
    * 100;
    trace("bytes loaded: " + numPercentLoaded + "% " + " of " +
    numBytesTotal);
    mcListener.onLoadComplete = function(target_mc:MovieClip,
    status:Number) {
    trace("onLoadComplete: " + target_mc);
    myMCL.addListener(mcListener);
    myMCL.loadClip("dante_montage.swf", swf_mc);
    i get error messages:
    1046: Type was not found or was not a compile-time constant:
    MovieClipLoader.
    for the following line of code-
    var myMCL:MovieClipLoader = new MovieClipLoader();
    and i get this message:
    1180: Call to a possibly undefined method MovieClipLoader.
    for this line of code-
    myMCL.loadClip("dante_montage.swf", swf_mc);
    thanks!

    awesome!!!!!!!
    i also found this link if anybody is interested, seems like
    there's a bit of confusion between the old loader and the new
    Loader in AS 3.0
    http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/LoaderInfo.html
    thanks dzedward!

  • Strange Problem - All of my preloaded .swf files play at once

    Hey guys,
      I've been getting a strange problem that I haven't been able to debug.  I recently developed an interactive audio and video treatment program that users click through in which a master swf file (DTM-Start.swf) uses ActionScript upon first being loaded to load the rest of the program in the background.  Here's how the code looks: 
    import flash.display.MovieClip;
    import flash.display.Loader;
    import flash.net.URLRequest;
    import flash.events.Event;
    // create movieclip objects to hold the loaded movies
    var intr1:MovieClip;
    var maladaptIntr1:MovieClip;
    var maladaptIntr1Loader:Loader = new Loader();
    var maladaptIntr1Request:URLRequest = new URLRequest("DTM-Maladapt1.swf");
    maladaptIntr1Loader.load(maladaptIntr1Request);
    maladaptIntr1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, maladaptIntr1Loaded);
    var intr1Loader:Loader = new Loader(); 
    var intr1Request:URLRequest = new URLRequest("DTM-Intr1.swf");
    intr1Loader.load(intr1Request);
    intr1Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, intr1Loaded);
    function maladaptIntr1Loaded(event:Event):void
        maladaptIntr1 = event.currentTarget.content as MovieClip;
        maladaptIntr1.stop();
        addChild(maladaptIntr1);
        maladaptIntr1.y = -1000
        trace("maladaptIntr1");
    function intr1Loaded(event:Event):void
        intr1 = event.currentTarget.content as MovieClip;
        intr1.stop();
        addChild(intr1);
        intr1.y = -1000
        trace("intr1");
    function playIntr1() {
       intr1.y = 0;
       intr1.play();
    function playMaladapt1() {
        maladaptIntr1.y = 0;
        maladaptIntr1.play();
    So that's the idea.  What's strange is that when I load a .swf file compiled with AIR 2.6 (because the user interacts with the movie and a text file is output) it's fine too, but as soon as I add any actionscript, even if it's just a stop() command, to a .swf file compiled with AIR, the DTM-Start.swf loads and then plays all of the movies simultaneously so they're all going off at once.  Essentially, flash seems to be ignoring the maladaptIntr.stop() command in the Loaded function, for instance.  I just don't understand why adding any Actionscript whatsoever to a .swf compiled with AIR would make my DTM-Start do this.  I am very confident this is the issue too, because loading .swf files compiled with the FlashPlayer with action script are fine...AIR .swf files without Actionscript are fine too, it's only AIR .swf files with ANY actionscript that cause this problem....
    Any ideas?
    Much appreciated!
    Thanks,
    Ricky

    One solution is simply to have a stop() in the constructor of the document Class of each swf you're loading. Another solution is something like:
    package {
         class MainDocument extends MovieClip {
         protected var swfs:Array = ['DTM-Maladapt1.swf', 'DTM-Intr1.swf'];
         protected var positions:Array = [{x:0, y:0}, {x:0, y:0}];
         protected var movies:Array /*of  MovieClips*/ = [];
         protected var loadIndex:int;
         protected var playIndex:int;
         protected var curremtMovie:MovieClip;
              public function MainDocument() {
                   super();
                   loadMovie(loadIndex);
              protected function loadMovie(loadIndex:int):void {
                   var loader:Loader = new Loader;
                   loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadComplete);
                   loader.load(new URLRequest(swfs[loadIndex]));
              protected function onLoadComplete(e:Event):void {
                   var mc:MovieClip = LoaderInfo(e.currentTarget).content as MovieClip;
                   mc.stop();
                   var position:Object = positions[loadIndex];
                   mc.x = positions.x;
                   mc.y = positions.y;
                   addChild(mc);
                   movies[movies.length] = mc;
                   loadIndex++;
                   if (loadIndex<swfs.length) {
                        loadMovie(loadInxed);
                   } else {
                        playMovie(playIndex);
              protected function playMovie(playIndex):void{
                   if (currentMovie) {
                        currentMovie.stop();
                   currentMovie = movies[playIndex];
                   currentMovie.play();
    Note that with this approach you don't need to create a whole new set of logic each time you want to add a new swf to load.

  • How do I program the preloader in a fluid swf from another fluid swf?

    I have built a fluid swf(preloader.swf) which is like an intro-cum-preloader screen to a flash site which is stored in main.swf. How do I program the preloader.swf to show the preload percentage of main.swf ?
    All the swf files used here are fluid,so there is an actionscript file which loads the movieclips onto stage dynamically,please give me a solution to this keeping this in mind. Please do ask for clarifications if needed.

    You want to use the Loader class in Actionscript 3. If you look at the example in the online help, you'll see that there are, among others, a progress event and a complete event. You can use this progress event, to track the progress of the loading of the file. The complete event occurs when the file has completely loaded.
    Have a look at this: http://help.adobe.com/en_US/ActionScript/3.0_UsingComponentsAS3/WS5b3ccc516d4fbf351e63e3d1 18a9c65b32-7fa4.html it explains how to use a Progress Bar component to show the loading of a file.

  • Preloading in the swf itself AS3

    Hello guys ;]
    I need some help in AS3.
    My problem is that I can't preload the content in the swf
    movie itself.. I mean movie clips and images that are inside the
    swf not external and so on.
    In AS2 All I needed to do is this :
    this.onEnterFrame = function() {
    loadingAmount =
    this.getBytesLoaded()/this.getBytesTotal()*60;
    if (loadingAmount == 60 and sVars.loaded == true and
    this.bigPicWidthsScript_mc.wVars.loaded == true) {
    this.gotoAndStop(3);
    delete this.onEnterFrame;
    This is juat an example what used to work.. I copied this
    part from a code I wrote time ago in AS2.
    So all u had to do is put this code on frame 1 along with
    some preloading graphics (small size), move all your movie clips u
    want loaded before they actually show up and start your animation
    to frame 2 as keyframe, and Put the ones who show up at the start
    in your movie at frame 3 where you actually go when preloading is
    finished.
    So I want to do the same thing in AS3.. I've found tutorials
    about preloading swfs images and so on but I don't need that.. I
    need this one here.. so does anyone have any idea how to do that ?
    I will be very grateful !
    Waiting for replies,
    Filip Nedyalkov
    Also u had to set Export frame for classes = 2 (in the
    publish settings),

    The reason you need it is because you are using the .text
    property on a member of the _root object. (I'm guessing but it
    wouldn't surprise me).
    About the import statement
    This is a personal philosophy and I'm open to valid
    suggestion here but the Flash Player looks at your code and builds
    a list of all the different classes that will be required at
    run-time and need to included in the compressed swf. If you an
    import like this....
    import flash.display.*;
    you are in theory including all of the classes inside of the
    flash display package. This is not actually the case. Even if you
    include the entire package in your code, all you are actually doing
    is telling Flash that this path/package is available for searching
    for the classes you are using in your document. Flash is only going
    to include a list of "necessary" classes when it runs its compile
    for your swf so keep that it mind. It is actually better to include
    the entire package set in my opinion thus playing it safe.
    It is a known bug and issue with preloading code inside
    IE6(7?) that prevents any kind of update being pulled from the
    browser concerning a files download. I've only had this issue in
    IE7 myself but this doesn't affect me or work since I typically
    only use the top level of a swf as a container for individual swfs
    which I load in using the Loader class. You can read more about the
    problem here (leads off to Actionscript.org forums with related
    post on topic)...
    http://pixelfumes.blogspot.com/2007/07/ie6-as3-preloader-events-failing.html

  • Using one swf to preload another swf

    Hey everyone,
    I have two swf files, one is a preloader and the second is
    the main file. I want to preload the main file using my preload
    swf. It works, however the main swf starts to play after about 11%
    of it is preloaded, how can i stop this? I want to preload the
    entire main swf and then have it play. Here is the code i'm using
    in my preloader swf. I'm fairly new to this so any help is much
    appreciated. Thanks in advance.

    http://www.gotoandlearn.com/
    this is Lee Brimelow's site; he has some really good
    tutorials on this and other topics; I've found them pretty helpful.
    look into loaders and event listeners.
    good luck.

  • Preload main swf with another swf

    Hey everyone,
    I have two swf files, one is a preloader and the second is
    the main file. I want to preload the main file using my preload
    swf. It works, however the main swf starts to play after about 11%
    of it is preloaded, how can i stop this? I want to preload the
    entire main swf and then have it play. Here is the code i'm using
    in my preloader swf. Or if anyone can tell me another way, anything
    that will work at this point! I'm fairly new to this so any help is
    much appreciated. I need this asap so anyone that could help,
    please do! Thanks in advance!!

    insert a blank frame before your current 1st frame in your
    main swf and attach a stop() to that frame.
    in your preloader use:

  • Preloader: works locally but not when live

    1. give that you have website A, website B and local
    directory structure
    2. give that you have a class based (see code snippet 2
    below) 444k swf
    sitting on website A
    3. give that you have a preloader swf on the local directory
    structure
    [that uses code in CODE SNIPPET 1]. _debug.text shows that
    bytes total is
    454103 and that the preloader rises smoothly up to that
    point. great!
    4. give that you move said preloader swf on to website B.
    _debug.text
    shows that bytes total is -1 for a bit, then undefined
    and.... that's
    about all until the swf actually finishes loading at which
    point we
    briefly see 454103 before displaying the swf
    eh?

    ok, the trick is to use MovieClipLoader instead. its
    onLoadProgress method does just the job you want... :)
    thank &*$£ for that. :)

  • Captivate 5 and preloader: Error #1065: Variable CPPreloader is not defined.

    Hi,
    If I add a preloader swf (any of those which ship with Captivate 5 - in \Gallery\Preloaders\AS3) - then when I publish the movie - the flash player throws an error:
    ReferenceError: Error #1065: Variable CPPreloader is not defined.
    Then (mostly) crashes the plugin (firefox) else carries on with the captivate movie.
    If I remove the preloader - all is fine again. I've tried every preloader swf, pretty much every option I can think of in publish settings.
    Windows 7 64, I've got Flash 10.2.153.1 (debug). It looks to me like an error in the code written by Captivate, but if that were the case, I'm sure I would find some mention of the problem or the var CPPreloader elsewhere!
    Anyone else seen this? Know how to make it go away??
    Cheers

    Are you adding preloaders from these locations?:
    C:\Program Files\Adobe\Adobe Captivate 5\en_GB\Gallery\Preloaders in 32bit systems
    or
    C:\Program Files (x86)\Adobe\Adobe Captivate 5\en_GB\Gallery\Preloaders  in 64bit systems
    You mention you're using the debug versiion of Flash Player.  Have you tested the published output on a system that IS NOT using the debug Flash player, just a normal Flash Player version?

Maybe you are looking for

  • Picture changes when I close and restart.

    I have been retouching old Census pages of my family. I get the lines all straigtened up I close it down and the next time I open it up the lines are all jagged and the beautiful straight lines of solid color are changed into multiple . Is there a wa

  • Data Source for Table J_1IEXCDTL  & J_1IEXCHDR

    Hi, I suppose to extract data from J_1IEXCHDR & J_1IEXCDTL table to BI system. Can any body tell me is there any SAP provided Data Source is available for these table. As these tables are created during some patch upgradation only. Thanx in Advance.

  • Why my contact number disappear suddenly and how i can fix it?

    May be cause by i delete the iCloud email account but why i even can not  find in my computer

  • When on windows xp red light from headphone jack and low sound

    I put windows xp sp3 on my computer about a week ago. There is a red light that comes from the headphones jack that is always on. The sound is only audible at full, it is extremely low. I don't understand this problem. It only happens when Im on wind

  • Multiple layouts - each patch a different layout

    Hello, I am looking for a way to change the layout for each patch individually, instead of just having one layout per concert. I'm working on a one man show, so let's say for one song I am singing, so I want lots of parameters for the voice plugins.