Wow I really should have thought of interfaces. That will work perfectly.
On Fri, Nov 21, 2008 at 9:11 AM, Ian Thomas <[EMAIL PROTECTED]> wrote:
> What I'd do to retain type-checking in this case is to define an interface:
>
> public interface IMyModule (or whatever)
> {
> function startUp():void;
> // and maybe other functions...
> }
>
> Make your document class implement IMyModule (i.e. it must define
> function startUp()).
>
> Then in your loading code:
>
> private function onInit(e:Event):void
> {
> addChild(loader);
> var myModule:IMyModule=loader.content as IMyModule;
> myModule.startUp();
> }
>
> Does that make sense? Each and every one of your loadable document
> classes MUST implement IMyModule. (Using interfaces like this to talk
> across module boundaries are very handy.)
>
> (Obviously, myModule.startUp() will still throw a runtime error if
> your document class doesn't implement IMyModule.)
>
> In terms of your preloader/loading different modules, I'm less sure
> exactly what you're after. I haven't done much with preloaders
> (because most of our content is desktop rather than web-based).
>
> Ian
>
> On Fri, Nov 21, 2008 at 1:56 PM, Joel Stransky <[EMAIL PROTECTED]>
> wrote:
> > I love this list so far. Thanks for highlighting that Ian.
> > I think you explained clearly that I'm bypassing good type checking so
> maybe
> > you could help me with an alternative.
> > The issue arose from Lee Brimelow's AS3 preloading
> > video<http://gotoandlearn.com/play?id=85>.
> > He basically defends that the best way to preload in as3 is by creating a
> > parent .swf who's only job is to load the main content movie into it
> > sighting issues with document classes being forced into frame 1. He
> doesn't
> > cover however how to call a function inside the newly loaded content so I
> > thought I'd dynamically cast one. Ok, it does sound nutty when I type it
> > out.
> >
> > What I'm struggling with is a clean way to preload a container who can
> turn
> > around and load content without the user having to see two sequential
> load
> > bars. Further, the nav in container should be switch out the content
> movies
> > preferably utilizing the parent preloader again. This was a piece of cake
> in
> > as2 by putting the preloader in frame 1 and the start of content a few
> > frames later.
> >
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
--
--Joel Stransky
stranskydesign.com
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders