This is my first post to the list in 2008 so hi and compliments of the
season to y'all.
So, here's the context...

I have an application framework built in AS3 and based on the MVC pattern.
One of my Views loads a compiled swf also built in AS3. When it is that
View's turn to be displayed, it gets added to the display list and then
needs to call a custom method on the loaded swf so that loaded swf does its
thing (it's a game).

Here's the problem...

Although I can invoke the required method on the loaded swf, I couldn't get
the compiler to stop complaining (it's compiling in Strict mode) so I had to
do a bit of a kludge to trick the compiler. I am sure there is a better and
proper way of doing this - can you tell me what it is?

Here's the code that loads the game swf (for the sake of context)...

gameLoader = new Loader();
// some listeners registered here
var request:URLRequest = new URLRequest( gameURL );
gameLoader.load(request);

The Document Class of the swf at 'gameURL' contains a method call 'startup'
and this is the one I want to invoke. So I tried this...
gameLoader.content.startup();

Predictably, the compiler utters the following...
"1061: Call to a possibly undefined method startup through a reference with
static type flash.display:DisplayObject."

I tried a few things (including casting gameLoader.content to the Document
Class) but the only thing I could get to work is this...
gameLoader.content["startup"]();

Any ideas? Thanks in advance.

Adrian Park
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to