Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-30-2011, 08:20 PM   #1
Registered User
Join Date: May 2011
Posts: 1
Exclamation [AS3] Preloading Object Data/Move Inheritance

I'm working on a small Flash game that currently uses two *fla files: one for the preloader and one for the content. (I'm considering using more as it gets more complex.)

The preloader not only loads the content movie, but it also loads data from a database. It uses AMFPHP as a gateway to access my database and sends the information back for objects to be populated.

Since it takes time to access a PHP script, query the database, and return the data, it causes a delay in the load time. This is fine. That's what the preloader is for.

The problem is that these objects are, as far as I can tell, unknown to the *swf files that I play inside the preloader movie (once all loading is complete.)

Now, I'm pretty new to AS3, but is it even possible for child movies to access variable information stored in a parent movie? I probably could do it all in one movie, but I don't want to if I can keep everything separate.
Cookiebasher is offline   Reply With Quote
Old 05-30-2011, 09:47 PM   #2
tadster's Avatar
Join Date: Feb 2009
Location: Texas
Posts: 2,111

The preloader should do nothing more than preload, that would solve your problem. Let the preloader load the main app, and since its the main app that needs the data anyway (i'm assuming) have it be the one to send out requests to the AMFPHP gateway.

Another option is to have the preloader dispatch custom events that children would listen for.
www.actiontad.com - ActionScript and JavaScript sitting in a tree...
tadster is offline   Reply With Quote
Old 05-30-2011, 10:46 PM   #3
Senior Member
henke37's Avatar
Join Date: Mar 2009
Location: Sweden
Posts: 10,888
Send a message via Skype™ to henke37

It is just a matter of scope and value passing.

Remember, once a swf file is loaded, it is just another instance that you can work with. You can call methods and use properties just like normal.
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote

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 09:25 PM.

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.