Preloading Assets

Hi,
I have two questions about preloading assets using actionscript 3.0
• Is there a way to preload all assets in the library for faster view before viewing them on stage?
• I know how to preload an image using a progress bar but how can i load multiple images and show their loading progress using one progress bar?
I know that i need to caclulate the size of all the assets and then divide them somehow but im not sure how to do it...
I been trying to figure it out for a while now and i will appreciate some code examples if possible.
Thanks

thanks CaioToOn!
The array is working great but i still had a small issue that i had to solve and it's the bytesLoaded.
i used the line loadedBytes += event.currentTarget.bytesLoaded; and it was a mistake because it would increase
the loadedBytes every time that the progress event is called and i would get a very high number...
i tried to sort it out with creating another variable that will hold all the data and every time that one bytesLoaded is complete it will add
it to the variable and reset itself, it seems to work fine when i simulate the download but when i upload it to the server it's playing
up. the percentage goes up and down....
you can check out the link of the swf file:
http://www.eliprint.net/m2/prototype.swf
below is the revised code....(in red is the lines of code that are probably causing the problem).
if anyone have a clue about how to load multiple images and post some helpful code
or if any one have time to look into my code and find out what's wrong i will really appreciate it!
Thanks
// variables
var urlReq:Array = new Array();
var included:Array = new Array();
var images:Array = new Array();
var numOfImg:Number = 11;
var loadedBytes:Number = 0;
var totalBytes:Number = 0;
var loaded:Number = 0;
var percent:Number = 0;
import fl.controls.ProgressBarMode;
progressBar.mode=ProgressBarMode.MANUAL;
// create images array
for (var j=0; j<urlReq.length; j++){
    var loader:Loader = new Loader();
    loader.load(urlReq[j]);
    loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadingImage);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadingComplete);
// progress event
function loadingImage(event:ProgressEvent):void{
    loadedBytes = event.currentTarget.bytesLoaded;
    if (loadedBytes >= event.currentTarget.bytesTotal){
        loaded += event.currentTarget.bytesTotal;
        loadedBytes = 0;
    if (included.indexOf(event.currentTarget) == -1){
        included.push(event.currentTarget);
        totalBytes += event.currentTarget.bytesTotal;
    percent = Math.ceil((loaded+loadedBytes) * 100 / totalBytes);
    trace("PERCENT: " + percent);
    txtPercent.text = percent.toString() + "%";
    progressBar.setProgress(percent, 100);
    trace("LOADED: " + loaded);
    trace("TOTAL: " + totalBytes);
function loadingComplete(event:Event):void{

Similar Messages

  • Embedding GIF image

    Hello!
    Is there any convenient way to embed GIF image into flash
    file? Embedding JPG image was easy using HTML <img> tag, but
    that does not seem to work with GIF.
    The reason I need this, so the argument ?image could be
    passed to flash file and the image inside flash would switch
    according to the passed argument (without editing .FLA file
    itself).
    Thank you in advance!

    ok - the real problem here is that you are using the 'actual'
    file as it loads to act as the preloader - in this case the
    majority of the file will load previous to the preloader initiating
    anything because it will not function until the file is
    instantiated. a much better way of handling this is to use the
    MovieClipLoader class and create a 'loading' swf file that IS the
    preloader, which in turn 'loads' the actual swf. you then use the
    onLoadProgress handler of the MCL class to control the events of
    the load and then you can initiate the opening methods in the load
    file using the onLoadInit handler.
    so you would make a file that is the same size as the main
    file, then place your preloader assets and code constructs for the
    options you're using within that file - call mcl.loadClip() and
    load the 'main' swf in that way. the preloader should then only be
    a few k at the most and load almost instantly, and show the
    progress properly. this is the best way to go when dealing with
    large files.

  • Using the vanilla/default preloader to load additional assets?

    I have a Flex application that automatically loads the SWF and it's contents and displays the default progress bar like in all Flex apps. Currently I have a class in the application using a Loader instance to load a few external bitmaps to be added to the stage/canvas as well as an MP3. I'd like to handle the loading of these assets in the Flex default preloader and get rid of the Loader instance entirely.
    How can I do this?

    At least for the images, and perhaps for the sound, you need to not use loader, and instead embed the assets, because if loader is used the assets load at the same time as the SWF, which is too late.
    So in the createChildren method you override when you override DownloadProgressBar:
    //global var
    [Embed("Logo1.png")]
    [Bindable] public var logoCls:Class;
    private var logoDO:DisplayObject;
    // in createChildren() method
    logoDO = new logoCls();
    logoDO.x = (stageWidth/2)-(borderRect.width/2)+_logoX;
    logoDO.y = (stageHeight/2)-(borderRect.height/2)+_logoY;
    addChild(logoDO);
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex / AIR Development, Training, and Support Services

  • Preloader for xml file and stage assets

    I have a Flash app that shows a map with different regions
    colored depending on values in an external xml file. I also have a
    simple preloader that I want to appear until all the elements of
    the app are ready to be displayed. However, when I use the
    preloader, the results are the same as if I hadn't use it. My map
    comes up immediately with no colors, there is a pause, and then the
    colors come in (as calculated from the data in my xml file). Can
    anyone tell me what I'm doing wrong? Do I have to have code in my
    xml loader that tells the user what percent of the file is
    loaded?

    XML files are really small. If that is all you are loading,
    it should happen instantly, or close to it depending on the size.
    Also if you are running it on your local machine, it will load very
    fast unless you simulate the download.
    But incase that is not the issue, your code looks incomplete,
    or just headed down the wrong path. You should be useing a loader
    class that has a series of events associated with it. Events like
    "PROGRESS" and "COMPLETE". These events will fire automatically
    when a file loads, and when a file is done loading. The Enter frame
    event is not meant to handle loading. I would suggest using a class
    like BulkLoader to handle all your loading needs.
    http://code.google.com/p/bulk-loader/

  • Exporting library assets to frame 1 causes delay

    I'm fairly new to Actionscript 3, just trying to puzzle something out.
    I have several small movie clips saved in the library of myCS4 Flash.fla file, I want to make them available to dynamically add to the display list as children, based on the button clicks of the viewer. I can get it all to work fine via Symbol Properties > Linkage > Export for Actionscript.
    BUT - When the movie clips are set to "export for actionscript" from the  Library, playback seems to hang on frame 1 until all of these  exported assets have downloaded. The big problem is that I have an ultra-simple but totally custom preloader/progress animation coded in a loop in the second and third frames, which kicks out to frame 4 and continues playback as soon as the download is complete.
    Because of this, the preloader has essentially become useless - because all that can be seen is several seconds of empty stage, until the vast majority of the bulky assets have downloaded. Then the preloader flashes onstage for just an instant, and disappears because the content is already up.
    So, my questions are:
    A)  Is there a SIMPLE alternate method to load these library assets in such a way that it doesn't cause this major lag on frame 1?
    B)  Failing that, I suspect I may have to retool my preloader to run as an ENTER_FRAME event in frame 1.  Is this worth the effort (can this potentially resolve the lag issue and allow for a meaningful preload progress animation, despite the lag from the asset export?)
    Any advice, thoughts, ideas (sample code?) would be greatly appreciated!!
    Thanks in advance,
    </a>
    **Edit follows**
    OK, so after a little more research, I have basically answered this question for myself. I'm updating the post for the benefit of others who may find themselves in my shoes somewhere down the road.
    The solution (as far as I can see) is to pretty much just avoid using the "Export for Actionscript" option for exporting assets to the timeline, as much as possible. Maybe it's fine for a few small assets, but not the best choice for large stuff, which in my case was the lions' share of the content!!
    Or at least don't use the default setting of exporting to frame one!!  This will likely foul up ANY preloader, because essentially Flash player will not display any of the content on frame one until ALL of the content on that frame has fully downloaded - You'll be stuck staring at an empty stage for ages, then when the preloader finally does show up on the stage and run, it will zip by in an instant while (probably) doing its job properly, but it's really only updating on the load progress of the balance of the SWF file.
    The info I found suggested one easy method of making the assets available to Actionscript -- simply just place all of the required library assets into some unseen frame in the timeline, shortly AFTER your preloader runs.  Then Flash Player will load them after the preloader has done its thing, and they will be available to be accessed by Actionscript later in the timeline when you really need them.
    Also FYI -- I also tried changing the export settings to have Flash export the assets in question in frame four instead of frame one, with the unfortunate and unexpected result that my published SWF began skipping playback directly to frame four, which also effectively killed my preloader (which was running in frames two and three.) This glitch remained, even after reverting the export setting back to export the assets in frame one!!  It seems like my .FLA file was irreversibly altered (contaminated??) by changing the export frame setting?!?  Yikes!!
    Luckily I had an earlier version saved under a different file name, it was relatively easy to go back to that version and bring it up to date.
    Anyway - that's all for now. Hope this info can help someone else....
    </a>

    See edit at bottom of original post....

  • I'm looking for a script that preloads a Splash Screen on Android

    I've read all threads here already about this subject. For most AdobeAir projects for Android, no matter what size, it could take up to 20 sec to load the app, and while it loads, all you see is a black screen. As there's no support for a Default.png like there is for iPhone, we have to use a preloader.
    I've only found one for Flex, which is no good to me as I'm using Flash Pro 5.5 (IDE). I've tried doing some simple preload-a-swf-preloader but it just loads it to 100% before showing anything anyway.
    Anyone here that can share a script of a simple preloader for Flash CS5.5?
    I know that to reduce the loading time and show a splash screen on android we need to make a very small swf that will contain the loading screen image, and that same swf will also preload the maingame.swf (but can that be done? Appstore don't like code in more than one swf) into it. My tries have failed.
    Here's some quotes in case someone who reads this might be knowledgable enough to help me out:
    Yes its possible to get a splash to appear straight away (well within one to 2 seconds which is close enough) but
    (a) You have to create a small splash .SWF which loads your main .SWF (OK so that's fairly obvious but a "Default.PNG" splash screen facility as per the iPhone packager and FLEX projects is what you might expect)
    (b) Your splash .SWF must embed the splash image. If you try to dynamically load an image nothing will appear until the whole of the APK file is loaded ( and presumably initialised). That was what I was doing wrong.
    It takes 20 sec to load, it's all black before it's done loading and the runtime takes up 25mb!
    (1) Yes that is a bit of a problem but seems to be the cost of compiling in the AIR runtime.  I am sure that most mobile projects only use a subset of the entire AIR library - its a shame you can't just compile in the bits that you need and drop the rest.
    (2) This is partly because of (1) and the fact it takes so long to get a big file up and running with AIR.  You need to create a preloader that is very small and all it does is display a splashscreen and then loads in the main 25mb file that you embed in the assets of your preloader.  The small preloader appears quickly and then gives you time to do your 'work' loading the main app with something onscreen.  This gives an example / explanation and there are others out there :
    http://www.mcbrearty.me.uk/index.php/2011/05/09/actionscript-mobile-pr oject-splash-screen/

    Hi Nick,
    Using the FileSystemObject object to delete a folder will delete the profile directory, but it won't delete its associated registry path:
    HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\user's SID
    There are also two other complications: 1. you can't delete a profile for a user that's logged on; and 2. the user might have logged off, but the profile might not be completely unloaded (see
    http://support.microsoft.com/kb/837115 ).
    In the meantime, I recommend 'uphclean' and the 'delprof.exe' found in the Resource Kit utilities.
    HTH,
    Bill
    Can we combine FileSystemObject and deleting Reg Keys?
    ¯\_(ツ)_/¯

  • Preloader: Only works on first publish?

    Ok. I have a simple animation composed of two SVG's. The SVG's are quite simple (random dots simulating a starfield). This oam file will ultimately be added to a Muse project.
    I can successfully publish the animation.
    I can add the animation to the Muse project...
    Publish the Muse project
    On Publish, Muse launches a browser window and viola..
    I can see the preloader and Edge animation working ok on first publish...
    However, if I refresh my browser, the preloader just hangs the animation...
    This happens in a variety of browsers (*Our primary build out is Chrome)
    Things to note:
    The homepage containing the animation does also include Inserted HTML at the footer of the page. Notice the slow marching parade of accolade logos? This is separate HTML/CSS animation and outside of the Edge animation I am referring to above.
    I have tried both he "Immediate" and "Polite" options on the preloader setup
    The animation is not very large so my expectation at this time would be that the Preloader just blinks real quick and disappears. This would be a satisfactory result.
    I have been deleting browser cache during testing
    "Host runtime files on Adobe CDN" checked and unchecked; tested both... no change in outcome...
    No audio has been added to the project assets; audio is not being used in this project (unfortunately; I like this feature though)
    Links:
    http://praxidicelaw.businesscatalyst.com (animation should appear on homepage with a quick preloader and then starfield)
    http://praxidicelaw.businesscatalyst.com/testanim.html (a test page with nothing but the animation. No master file applied or other content)
    Thanks in advance to any help/assistance...

    Quote
    first time after I plug in my graphics card into my motherboard and it works pretty flawlessly (including gaming for hours)
    So should I RMA the graphics card?
    no
    Quote
    Or are there other settings I should check?
    My config includes i5-4670k, Asus Z87I-Pro, Silverstone ST70F-ES, Crucial Ballistix DDR3 4GBx2.
    could be anything, BIOS/mainboard issue, PSU issue, ram issue
    some kind of mainboard shorting issue
    to check the video card: test it in another PC

  • Problem with uploading assets

    Hi,
    I am following this tutorial: http://www.adobe.com/devnet/flash/articles/augmented_reality.html#ach-setscr for augmented reality.   The Sample files have been downloaded and when I open the .fla and run it in flash CS5 it works beautifully with the marker.
    However, I am trying to get it to work online or in a powerpoint presentation.  When I do so, the user is prompted to enable the camera, but the 3D image doesn't appear.
    As far as I can see, I have to upload a .swf to a html page.  The .swf is from a .fla and a .as (the actionscript is all in the .as which targets the .fla).
    When the .swf is run, it calls on a .dae file which is referenced in the .as file.
    Locally, when the .swf is run, it prompts the user to allow the webcam  to be enabled.  The user holds a marker image to the webcam and an  augmented reality 3d model is shown.  This works in flash cs5, but when I  try to upload it to html or insert it in a powerpoint page I get the  following error:
    Quote:
    Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: xxxxx /assets/models/tower/models/tower.dae
    (xxxx is either the document path on my desktop or h ttp://mysite.com if online)
    After googling, it seems that I have to somehow preload the flash assets but can't find how this is done.
    Basically what I am trying to do is to get an Augmented reality  application up and running on a website and I'm trying to do this with  the version available here:  htt p://ww  w.adobe.com/devnet/flash/articles/augmented_reality.html.
    If you look at the comments below the tutorial, this one from
    Srivello appears in answer to other posters who had the same issue (the model works locally but not online)
    Quote:
    RE:  Yefolio & MediocreNinjaStudios 
    Ensure that the *.dae  file is uploaded too and the URL used in the AS3  is correct.  If you are  sure of this, perhaps the model must be  preloaded.  Load, wait for it  to be 100% loaded, and then continue the  code execution.  How to preload  Flash assets can be found online and is outside the scope of this  article.
    Needless to say, I can't find how to preload them.  I get results for preloaders, but this doesn't seem to fit the problem.
    When I published the html & swf, I tried to upload them and got these messages:
    Please could someone shed some light on this.
    Thanks

    http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_19105
    The above link is no longer valid, but someone said that it solved their problem as they had a similar error  (from this page http://objectmix.com/macromedia-dreamweaver/737103-errors-load.html).
    Is there any way to find the article/solution?

  • Preload help

    Hi there,
    I will first admit that I use director mostly for moving
    sprites and playing sounds, but when it comes to the script, I
    suck. I am good at other types of scripting, and I have the general
    idea of how to get the formula of a script to fuction, but I can
    never get it going 100%. I am in desperate need of a preload
    script, I know It's a hassle to see these n00b requests all the
    time, but if someone could look at my script and tell me where I am
    going wrong, it would be a big help. I only need this script to
    work then I can apply it to all my work. Thanks in advance! :)
    Movie has 1900 frames.
    Here is my script, in frame 1:
    on exitFrame
    preLoad 0, 1900
    if preLoad(0, 1900) = true then
    go to "a"
    end if
    end
    It accepts the script, but when it runs it comes back with:
    Script Error: Function not defined
    if preLoad(0, 1900) = true then
    All i want to do is have this preload set up in frame 1, to
    load the total frames, then advance to frame 2 (with the marker "a"
    is) where a "play" button is on the stage.
    Regards,
    TMK.

    Total-MK wrote:
    > I just asumed this was the most lingo-basic way of
    making a "loading"
    > type preloader to load my full movie.
    That isn't usually necessary as Director is usually good at
    loading assets
    as needed, and it isn't usually desirable to potentially fill
    up the RAM on
    the user's computer - indeed, unloading members when they're
    finished with
    can be very helpful.
    If you're doing a Shockwave movie, google for "lingo
    preloader". In
    particular, the articles at lingoworkshop.com are useful.
    Then in the google
    results page click on "Groups" up near the top and have a
    browser through
    what's been written before in this ng.
    HTH
    Andrew

  • Preloader problem

    Dear,
    i have a problem in my preloader, i have 2 scenes, first one
    the preloader and the another is the content of the site ( 10
    frames )
    the preloader start showing the loader in 56% not from 0% so
    the user have to wait from 0% to 56% with blank stage.
    even though, if i used the same preload but in only 1 frame
    in the content scene its will work great.
    i don't load anything from external movies, all my content in
    one scene...
    Thanks a lot...
    my code:

    Oh. You have so many things wrong with this project.
    First unless you are publishing to Flash 5 you shouldn't be
    using onClipEvents(). That was a style of coding that went out in
    2001 when Flash 6 was introduced and has a lot of drawbacks and no
    advantages. (Well unless you need to publish to Flash 5!) Here is a
    really good blog on the issue:
    http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent
    Okay the next issue is that you really shouldn't use scenes.
    They were a great tool to help timeline animators organize their
    content. But when you start to use code it starts to breakdown.
    There are several tricky little problems that crop up when you
    start using code that moves the playhead and scenes. So it is
    better to not put them on scenes. Instead just put your first
    "scene" on frame one. And then maybe move over to frame 100 and
    start your second "scene." When you publish your swf all the scenes
    are strung together in one long timeline and the "scenes" are gone
    per se.
    Next issue is the one you actually are asking about. All the
    content in frame 1 (the actual frame one after all the scenes are
    strung together) must be loaded before any code on that screen can
    start to execute.
    So if you have any components, even if they are only in the
    library and you aren't using them, will put a lot of content into
    frame 1. If you have a bunch of library assets set to export for
    actionscript those usually are in frame one as well.
    Otherwise, you can go to the publish settings and switch to
    the flash tab. There is a check box for generate a size report.
    When you publish you will also get a text file that shows you how
    much content is in your file and where it is.

  • Cs4 as3 preloader

    Hi,
    Is there a surestarter preloader in AS3 with CS4? Meaning here, showing a progress bar or percentage value before loading the main swf, right away at the start of the  loading.
    I tried 3 different versions:
    1- I used the code from a video (and accompanying files), and simply changed the content.swf to my own swf file (rename my swf content.swf), so that the original code would load my swf instead of the original content.swf. (original content.swf was too small to see anything before loading, because my loading speed is too fast).
    Here is the code from the original preloader (loads a small swf which then loads the main swf file):
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    l.load(new URLRequest("content.swf"));
    function loop(e:ProgressEvent):void
    var perc:Number = e.bytesLoaded / e.bytesTotal;
    percent.text = Math.ceil(perc*100).toString();
    function done(e:Event):void
    removeChildAt(0);
    percent = null;
    addChild(l);
    and here is the link to the file:
    http://www.raidcanada.com/preloader-org-test.html
    2- used the code suggested, which does the preloading directly in the main swf file:
    stop(); 
    //Import the required assets
    import flash.display.*;
    //Stop the playhead while loading occurs
    this.stop();
    //Create a listener to call the loading function as the movie loads
    this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);
    /*This is the main function, basically it grabs the total and loaded bytes,
    calculates a percentage, and displays it by stretching the bar and adjusting
    the textfield display. If your bar/textbox instancenames are NOT lbar/lpc,
    you'll need to adjust this code to match your instance names*/
    function PL_LOADING(event:ProgressEvent):void {
    var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
    //Stretch the bar
    lbar.scaleX=pcent/100;
    //Display the % loaded in textfield
    lpc.text=int(pcent)+"%";
    //If the movie is fully loaded, kick to the next frame on the main timeline
    //You may wish to change the gotoAndStop(2) to a gotoAndPlay(2)
    if(pcent==100){
    this.gotoAndPlay(2);
    This one doesn't work either, and if you refresh the page, you get only the bar, instead of refreshing the main swf.
    http://www.raidcanada.com/test/test-2.html
    3- use the code suggested to replace the preceding version:
    stop();
    addEventListener(Event.ENTER_FRAME,checkLoad);
    function checkLoad(e:Event):void {
    var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;
    lbar.scaleX=pcent/100;
    lpc.text=int(pcent)+"%";
    if (pcent==100) {
    removeEventListener(Event.ENTER_FRAME,checkLoad);
    this.gotoAndPlay(2);
    This one loads correctly (without the percentage or progress bar) and the refresh is OK.
    http://www.raidcanada.com/test/test-1.html
    The idea is to have this page load correctly showing a percentage sign and a progress bar until the loading is complete for this page:
    http://www.raidcanada.com/entete-multi-hiver-1-test.html
    Every time I test the swf directly in Flash CS4 with the simulated download, I get the progress bar and percentage correctly.
    I also tried with Firefox and get the same results.
    FLAs are at:
    http://www.raidcanada.com/test/test-1.fla
    http://www.raidcanada.com/test/test-2.fla
    and screenshots of FLASH (showing the progress bar in "test movie" with simulated download):
    http://www.raidcanada.com/test/screenshot-test-1.jpg
    http://www.raidcanada.com/test/screenshot-test-2.jpg
    Am I missing something?
    THank you in advance

    Hi,
    I am using Internet Explorer 8, version 8.0.7600.16385 with Windows 7 Ultimate or Firefox 3 version 3.5.9
    If I flush the cache and load the page:
    http://www.raidcanada.com/entete-multi-hiver-1-test.html
    It takes about 5 seconds with a blank screen before I get the main swf displayed.
    If I load the page: http://www.raidcanada.com/test/test-1.html
    It takes about 1 second with a blank screen before I get the main swf displayed. The main swf file is much smaller.
    I also did a lot of tests, and still the same problem. Temporarely, on the production site, I ended up installing a static Image saying "Loading", without the code, which then loads the large swf. But some customers are seeing the "Loading" for 14 sec to 24 seconds, depending of the swf file.
    I know the code suggested is probably working with CS3 and AS2, but I need to make it work with CS4 and AS3, because my other code is all in AS3, built with CS4. As I said before, if I make a simulation, the simulation is perfect.
    Thanks

  • Pure AS3 self-preloader

    My project originally had everything on the timeline, but I have since moved all the code to the document class, but some of my assets are still in the library and some of them are embedded. I'm trying to make a self-preloader that doesn't use any external files, but I can't seem to find a good tutorial that doesn't involve using the timeline. Can anyone point me to a pure AS3 self-preloader tutorial or tell me where I'm supposed to put everything?

    If you mean by "self-preloader" a pure Standalone as3 preloader:
    var l:Loader = new Loader();
    l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
    l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
    //this line has to be adapted to the name of your document class
    l.load(new URLRequest("main.swf"));
    function loop(e:ProgressEvent):void
        var kBytesLoaded:int = Math.round(e.bytesLoaded/1024);
        var kBytesTotal:int = Math.round(e.bytesTotal/1024);
        var perc:Number = kBytesLoaded / kBytesTotal;
        trace("PERCENT:"+perc);
    function done(e:Event):void
        //this line for the stuff you might need to visually communicate the loading process and want to remove when loading is done
        removeChildAt(0);
        addChild(l);

  • Preloader and splash frame?

    I'm not sure how to approach this, but right now I have a
    preloader before my movie starts - and it works great. But it also
    works as a quick intro/splash screen. I'd also like it to remain on
    the screen for at least 5 seconds. Right now when I test it on
    high-speed internet it loads so fast that it doesn't give enough
    time for visitors to read what it says.
    Is there a way to make it remain on screen for at least 5
    seconds - even if the movie has completely loaded?
    I'm not sure how to approach this.

    here is a demo project set up similar to the main project having the problem.
    https://dl.dropboxusercontent.com/u/154782/assetMultiProjectTestfield.zip
    If you adjust the linkage on the directory ./export/normal/swc to external, on the web project it makes absolutely no difference. While in FB 4.6 or using ant build it is smaller and requires a swf to be loaded at runtime.
    That being said, I am now in the process of seeing if the method we are trying to use will actually work, since the iOS packager refuses to make a release build if it cannot find the class definitions at compile time. 
    The idea is basically that the compiler uses external linkage to flash assets, and then depending if the device is retina or not it loads the appropriate swf.

  • Using embedded library assets

    Hi,
    I've some movieclips in the library of an fla (all linked up
    properly) and published as an swf. Now I want to embed this swf in
    my flex app and instantiate the library items. But I get null
    objects.
    The size of the published flex app varies if I change the
    embed statements, so the objects are there. But they don't get
    instantiated when I try to.
    I've uploaded my code here as an actionscript project.
    http://akube.com/TestProject.zip
    Please help. I can't understand what I'm doing wrong. I've
    embedded fonts etc successfully but can't get around this.

    ...well, ah... :(
    I do not use Flash but rather SWiSHmax, a "poor mans flash."
    So I have no .fla, instead a .swi. Would that help?
    There is literally no code in the swi for Flex strips it out
    anyway. Instead I add any needed code at runtime from the Flex
    .swf.
    Basically, off the _root I have a MC called wrapper. In
    wrapper I make the "preloader" resource as another MC containing
    the progress bar, text filed, background, etc.. I name the "asset"
    wrapper MC as "Preloader" and export as SWF8.
    So in your code, candleAsset (MC) IS the wrapper MC. So in
    dot.dot language, we have:
    candleAsset.preloader.progressBar and
    candleAsset.preloader.progressText.text
    Hope this helps.

  • Using Preloader But Content Not Loading

    Hi.
    Here's the Cliffs Notes version:
    I've a 2 frame movie: Frame 1 is the preloader; Frame 2 a movie clip (web site).
    Both work fine individualy, but the dynamic content I want pre-loaded is not loaded into the movie clip (web site) after the preloader animations.
    Verbose version:
    I'm have a preloader on frame 1 of the timeline. Here's the code:
    stop ();
    this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, onLoading);
    this.loaderInfo.addEventListener (Event.COMPLETE, onComplete);
    function onLoading (evt:ProgressEvent):void
              var loaded:Number = evt.bytesLoaded / evt.bytesTotal;
              percent_txt.text = (loaded * 100).toFixed(0) + "%";
              var counter = (loaded * 100) * 3.6;
              masked_mc.mask = masking_mc;
              masked_mc.rotation = counter;
    //          trace (masked_mc.rotation);
              if (masked_mc.rotation < 0)
                        masked_mc.mask = null;
    function onComplete (event:Event):void
              this.loaderInfo.removeEventListener (ProgressEvent.PROGRESS, onLoading);
              this.loaderInfo.removeEventListener (Event.COMPLETE, onComplete);
              gotoAndStop (2);
    On frame 2 is only a movie clip (a web site).
    In this movie clip on frame 1, I have a dynamic text field into which gets loaded some external text, styled with HTML and CSS.
    At the moment, when a visitor comes to the site for the first time, he can actually see the text load, then see the CSS styles get applied. I would like to use my preloader so that this text loading and styling is completed before they get to see the home page.
    Trouble is the, while the preloader itself works, the HTML and CSS still does not get loaded until after the preloader. This makes sense as the code for calling and loading the HTML/CSS is in the movie clip.
    So I thought, put the code....
    //NEWS --------------------------
    // Load the external .swf "navidNews.swf".
    var navidNewsSWF:String = "assets/fla/navidNews.swf";
    var navidNewsURLRequest:URLRequest = new URLRequest(navidNewsSWF);
    var navidNewsLoader:Loader = new Loader();
    navidNewsLoader.load(navidNewsURLRequest);
    //Put "navidNews.swf" on the stage.;
    newsContainer_mc.addChild(navidNewsLoader);
    into frame 1, same as that for the code for the preloader. But because the empty movie clip into which navidNews.swf is loaded is not in the same frame as the preloader there are errors.
    Okay, move empty movie clip newsContainer_mc into frame 1 with preloader, which will hide the news container.
    What am I missing? Should I not put a movie clip of my web site on frame 2, but instead move the preloader into the web site movie clip, putting it on frame 1?
    I've been playing musical frames with this thing for two days now.......

    load the text and css in frame one (they need not be be used until frame 2) and incorporate those into your preloader.

Maybe you are looking for

  • How to get the last data point from a TDM file in LabVIEW?

    Hello, I am using LabVIEW to analyze some rather large TDM files, and I need a way to get only the last data point.  So far, the only way I have been able to accomplish this is by reading the entire file.  Is there a property in the TDM file or a fun

  • HPLaserjet P1102W Will No Longer Print But Is on Network

    Have had this printer for a while and it has been fine.  About 2 months ago, it stopped printing.  I was able to ping it from my desktop and other devices, it is on my network wirelessly and no other changes have been made.  The PC tries to send jobs

  • IBooks Author on Lion in VMWare Player

    I installed iBooks Author on my 10.7.2 VMWare install, but when I run it I get a blank panel where the editable area is supposed to be. The cursor even changes when I move over areas, but I can't see any of the text/images on a page.

  • Get Layout details during run time of the report

    Hi floks,           We are downloading the ALV ouput data through a customised button. Presently, it downloads all the data from the Internal table that is passing to the function module. But the requirement is it should download only those fields wh

  • Flash Playerが2つインストールされます.

    DesignPremiumCS5を使用中なのですが.インストールをした際に /Applications/Adobe Flash CS5.5/Players /Applications/Adobe Flash CS5.5/Players/Release の両方にバージョン10.2.153.1のフラッシュプレイヤーがインストールされるのですがこれは正常でしょうか? 見たところ2つとも同じものに見えるのでどちらかが不要であれば削除したいのと.こうなってしまう原因を知りたいです. よろしくお願いします.