A Flash Developer Resource Site

Results 1 to 13 of 13

Thread: Preloading in CS5 with an AS3 Document Class

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    15

    Question Preloading in CS5 with an AS3 Document Class

    I've been working on a little flash app for the last couple of months and now the final hurdle is strapping a preloader on to the front of it.

    The app is a fla/swf controlled by a Main.as document class written in AS3.

    I originally wrote it in CS3 but after hitting my head against a wall for several days trying to figure out how to add a preloader I upgraded to CS5 in the hopes it would be easier. Several webpages (eg http://www.flashconf.com/category/flash-cs5/) mention being able to just specify a preloader.swf in the actionscript settings. I've tried adding mine but it doesn't appear to do anything when I simulate download or check it online. Should it really be that easy or am I misunderstanding. There's a surprising lack of info about for CS5.

    The other option is to add one into the actual app swf, which I did find a guide for (http://active.tutsplus.com/tutorials...ngle-swf-file/) ...but its for CS3/4. I'm willing to give it a go as a last resort, but I wanted to check to see if there's an easier way for CS5.

    Any help would be much appreciated, thanks!
    Last edited by CartoonizeMyPet; 09-22-2010 at 05:05 PM.

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    Go to Publish settings - Flash - Actionscript 3 settings. In the bottom you see Preloader method. Set it to preloader.swf. Then a preloader is automatically added in form of little moving dots. Another possibility is to use Flex and load your Flash movie into Flex. Flex adds a preloader automatically.
    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    That's what I thought but I'm not seeing it when I try simulate download or view it online. Is it normally visible when you simulate download?

    I tried:
    1) Using the default path:
    $(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf

    2) Creating and targeting my own preloader.swf (placed in same dir as main.swf)

    3) and putting just "preloader.swf" in the box as you suggested.

    ...all I get is a blank screen while its loading.

    Here it is online: http://www.cartoonizemypet.com/catoonizer/index.html
    Does anyone see a loading screen?
    Last edited by CartoonizeMyPet; 09-22-2010 at 09:46 PM.

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    Not seeing a preloader on that either, it just loads straight up. I do have a pretty speedy connection... maybe I'm just missing it?

  6. #6
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You are missing it. The movie does not have that much kb. When testing your movie set your download to 56kb.
    - The right of the People to create Flash movies shall not be infringed. -

  7. #7
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    I did but all I got was 107s of white screen before it loads.

    I also tried adding a big image into a fresh as3 fla and testing it on 56kb too. Again just a white screen until it fully loads.

    The default path for the preloader.swf in a fresh fla is:
    $(AppConfig)/ActionScript 3.0/rsls/loader_animation.swf
    I searched my computer for loader_animation.swf and couldn't find it. Maybe I'm missing it from the download? Although that wouldn't explain why it doesn't seem to appear when I link to my own preloader.swf.

    I'll try releasing it to a few friends and see if the ones with slower connections see it.

  8. #8
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    I have attached the fla. Make a movie and place it in Adobe Flash CS5, Common, Configuration, Actionscript 3, rsls
    Attached Files Attached Files
    - The right of the People to create Flash movies shall not be infringed. -

  9. #9
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    Ah so that's where it's hiding! I'm not sure why my computer didn't find it before. There is a loader_animation.fla and swf there already. This is bizarre.

    So when you open a new fla, put a large image in it and do
    Control > Test Movie > In Flash Prof
    it does show the little dots when simulating the download?

  10. #10
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    Still stuck on this one. I tried loading my page from a slower connection and there's still nothing there. Is it because of the document class?

    I'm worried I'm losing traffic from people not willing to wait. Its only ~500k, but on slower connections that can be +10s

  11. #11
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    I could be wrong, but aren't those options in Publish Settings only applicable to Runtime Shared Libraries and not to the main movie itself?

    If you're just trying to preload your swf file, here's a quick and dirty version of a preloader, assuming a text field called loadDisplay is on frame 1 and everything else happens on frame 2 or later. If that's not the case, you could have the "complete" event trigger a init() function or the like:

    Code:
    this.loaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
    this.loaderInfo.addEventListener(Event.COMPLETE,doneLoading);
    function showProgress(evt) {
    	stop();
    	var percentLoad=Math.round((evt.bytesLoaded/evt.bytesTotal)*100);
    	loadDisplay.text=percentLoad+"%";
    }
    function doneLoading(evt){
    	play();
    	this.loaderInfo.removeEventListener(Event.COMPLETE,doneLoading);
    	this.loaderInfo.removeEventListener(ProgressEvent.PROGRESS,showProgress);
    }

  12. #12
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    Aha! I wondered what all that "Runtime Shared Library" stuff was about! Why the heck don't Adobe just make it so we have automatic preloaders for every movie?!

    Thanks for the code! I'll see if I can work something out with it. Unfortunately I'm using an external document class, which always seems to make preloaders that much harder to implement. At least now I know the "automatic" one in CS5 isn't so automatic, so I can concentrate on tracking down a solution.

  13. #13
    Junior Member
    Join Date
    Jul 2010
    Posts
    15
    Problem solved! I bought a ready made external preloader from here: http://activeden.net/item/as3-text-preloader/23640

    $4 is a bargain after all the troubles its given me!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center