Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-23-2012, 11:17 AM   #1
thomas199922
Senior Member
 
Join Date: Dec 2010
Posts: 178
Default preloader

Hi,
Recently I have been trying to make a preloader but I am unsure about one thing: where should I put the code for the preloader so that it takes place while the .swf is loading. When I enter the code, the loading does not take place until the .swf has loaded and by then the preloader is useless. This is probably a very stupid question but I could not find a solution
thomas199922 is offline   Reply With Quote
Old 06-23-2012, 03:49 PM   #2
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,885
Send a message via Skype™ to henke37
Default

Put it as early as possible in the file. That is, in the first frame.

And most importantly: don't put anything else in the first frame.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Old 06-23-2012, 04:32 PM   #3
thomas199922
Senior Member
 
Join Date: Dec 2010
Posts: 178
Default

so i could not put it in one of the classes?
thomas199922 is offline   Reply With Quote
Old 06-23-2012, 05:18 PM   #4
[afz]snickelfitz
Senior Member
 
[afz]snickelfitz's Avatar
 
Join Date: Dec 2011
Location: Tucson, AZ
Posts: 2,406
Default

A common structure is to put the progress display within a main.swf.
Load other swf files into main.swf.
Add the progress display to the displaylist when loading a file; update it on progress; remove it on complete.

The main thing is for main.swf to be as small as possible in filesize; it should contain little other than a progress display movieclip, 1 frame only, and the document class code.
Navigation and pages should be separate files and classes.

>

BTW, check out the GAIA framework; all of the low level stuff (loading, progress display, transitions, depth management, etc...) is handled automatically.
All you really have to do is edit an XML file, build page displays and configure the navigation.
The real upside to learning this framework is that it provides an excellent example of OOP best practices and site organization. Not to mention saving hours of tedious project setup: <10 minutes to setup a functional site skeleton.
http://www.gaiaflashframework.com/
http://tv.adobe.com/watch/fitc/gaia-...r-adobe-flash/
[afz]snickelfitz is offline   Reply With Quote
Old 06-23-2012, 07:06 PM   #5
thomas199922
Senior Member
 
Join Date: Dec 2010
Posts: 178
Default

thanks!
thomas199922 is offline   Reply With Quote
Old 06-24-2012, 11:49 AM   #6
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,885
Send a message via Skype™ to henke37
Default

Technically, you have to put code in a class. Read my first article for the details.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Old 06-25-2012, 08:31 AM   #7
motrack
Registered User
 
Join Date: Jun 2012
Posts: 4
Default Separate project

You need to create a new project for the preloader.

This is your current application:
app.fla
main.as
example.as
etc..

When you build your app you get the app.swf file.

Your preloader has to be a separate project e.g.:
preloader.fla
main.as
example2.as
etc..

Your preloader should have code to load the app.swf from the server. That's where I believe you have been confusing things. The preloader code doesn't go inside the app but it's a separate project that loads the main swf.
motrack is offline   Reply With Quote
Old 06-25-2012, 11:42 AM   #8
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,885
Send a message via Skype™ to henke37
Default

No, he does not need to. It makes things easier, but it is not required.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:30 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.