Forget about: Application.main(container_mc);
Application.main();
M On 11/22/06, Michael Nisi <[EMAIL PROTECTED]> wrote:
Hey Ricardo, just to give you a ruff idea, there are bazillion ways of doing this. You have two flas, shell.fla and section.fla. In each there's a clip on Stage called container_mc. In shell.fla on _root you do: Application.main(container_mc); In section.fla on _root you do: var section:Section = new Section(container_mc); Here are the classes: - Application - ViewLocator - Playable (Interface) - Section import ViewLocator; import Section; class Application { function Application() { var loader:MovieClipLoader = new MovieClipLoader(); loader.loadClip("section.swf", _root.container_mc); } public static function main():Void { var application:Application = new Application(); } } import Playable; import Application; class ViewLocator { public static function register(section:Playable):Void { // Store section or whatever... section.start(); } } interface Playable { function start(); } import Playable; import ViewLocator; class Section implements Playable { function Section(target:MovieClip) { ViewLocator.register(this); } public function start() { trace("Section.start"); } } Regards Michael On 11/22/06, Wade Arnold <[EMAIL PROTECTED]> wrote: > Where would you place a your "global" properties? This is a question that > has always got me. > > If the properties such as framerate, gatewayURL, styles, etc need to be in > the class application. They have to be there for two reasons. > 1. User defined inspectable properties. > 2. variables must be available for proper instantiation. > > > I have always wanted to have a config file, then a worker class that just > handles all the get setters. However I have never been able to pull this off > in order for the application class to wait for the variables to be > populated. Any ideas? I assume I will try again in AS3. > > Wade > > > > On 11/22/06 1:56 AM, "Miguel Angel Sánchez" <[EMAIL PROTECTED]> wrote: > > > There is another approach to communicate those swfs: > > - At your side: > > 1. Class Application (singleton) > > 2. Class LoadedSWF (or whatever), abstract class that every swf of the > > team development will have to extend. This class could implement any > > interface you like, and will have a constructor like this: > > > > public function LoadedSWF() { > > Application.getInstance().register(this); > > } > > > > 3. Your Application class will have a method register where you can > > subscribe to LoadedSWF events, or even store a reference to the object > > to call any of his methods. > > > > public function register(obj:LoadedSWF):Void { > > obj.addEventListener("event", Delegate.create(this, onEvent)); > > } > > > > - At the team development side: > > 1. intrinsic class Application > > 2. intrinsic class LoadedSWF > > 3. The class that controls the swf will have to extend LoadedSWF, and > > call super() in its constructor > > class Whatever extends LoadedSWF { > > public function Whatever() { > > super(); > > ... > > } > > } > > > > This way everytime you load an external swf of your team development it > > automatically notifies your Application class. > > > > PS: so many people from DMSTK around here these days :-) > > > > Ricardo Sánchez escribió: > >> Man! I must be very dumb, but I don't know how to refer to the class that > >> implements the interface from the main swf. > >> > >> > >> > >> On 11/21/06, Ricardo Sánchez <[EMAIL PROTECTED]> wrote: > >>> > >>> So, back to what you said earlier, this should be: > >>> > >>> container.loadMovie("externalMovie"); > >>> [after fully load] > >>> container.section.config() > >>> container.section.start(); > >>> > >>> wouldn't it? > >>> > >>> On 11/21/06, Zárate <[EMAIL PROTECTED]> wrote: > >>>> > >>>> No man, that's not my point. > >>>> > >>>> You cannot make a swf implement an interface, but you can make the > >>>> content of that swf implement it. Say you have in the _root of every > >>>> section swf something like this: > >>>> > >>>> ----------- > >>>> > >>>> var section:SectionClass = new SectionClass(this); > >>>> > >>>> ------------ > >>>> > >>>> "SectionClass" implements the interface, so you know which methods and > >>>> properties are going to be available in the "section" variable. > >>>> > >>>> You cannot "force" external developers in the strict mean of the word, > >>>> you'll need to _ask_ them to do so. Simply refuse any external swf not > >>>> implementing the interface. > >>>> > >>>> Makes more sense now? > >>>> > >>>> Cheers > >>>> > >>>> On 11/21/06, Ian Thomas <[EMAIL PROTECTED]> wrote: > >>>>>> For example, ensure that the container can do something like: > >>>>> Doh! I mean, of course, ensure that the _contained_ movie can do > >>>> something like: > >>>>> > >>>>> On 11/21/06, Ian Thomas <[EMAIL PROTECTED]> wrote: > >>>>>> The alternative (one I use a lot) is to do it backwards. > >>>>>> > >>>>>> Make the contained movie register its 'main' class with a known > >>>> point > >>>>>> in the container. > >>>>>> > >>>>>> For example, ensure that the container can do something like: > >>>>>> > >>>>>> _parent.registerMe(MyControllingClass); > >>>>>> > >>>>>> where MyControllingClass implements the PluginMovie interface (or > >>>>>> whatever your interface is called) and you've set up > >>>>>> _parent.registerMe() as something like: > >>>>>> > >>>>>> public function registerMe(movie:PluginMovie):Void; > >>>>>> > >>>>>> Does that make sense? The other advantage of doing it 'backwards' > >>>> like > >>>>>> this is that you could put off registering until all your > >>> assets are > >>>>>> loaded or some other action has happened; your child movie has > >>>>>> complete control of when it's ready to talk to the container. > >>>>>> > >>>>>> Hope that helps, > >>>>>> Ian > >>>>> _______________________________________________ > >>>>> Flashcoders@chattyfig.figleaf.com > >>>>> To change your subscription options or search the archive: > >>>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >>>>> > >>>>> Brought to you by Fig Leaf Software > >>>>> Premier Authorized Adobe Consulting and Training > >>>>> http://www.figleaf.com > >>>>> http://training.figleaf.com > >>>>> > >>>> > >>>> > >>>> -- > >>>> Juan Delgado - Zárate > >>>> http://zarate.tv > >>>> http://dandolachapa.com > >>>> _______________________________________________ > >>>> Flashcoders@chattyfig.figleaf.com > >>>> To change your subscription options or search the archive: > >>>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >>>> > >>>> Brought to you by Fig Leaf Software > >>>> Premier Authorized Adobe Consulting and Training > >>>> http://www.figleaf.com > >>>> http://training.figleaf.com > >>>> > >>> > >>> > >> _______________________________________________ > >> Flashcoders@chattyfig.figleaf.com > >> To change your subscription options or search the archive: > >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > >> > >> Brought to you by Fig Leaf Software > >> Premier Authorized Adobe Consulting and Training > >> http://www.figleaf.com > >> http://training.figleaf.com > >> > > _______________________________________________ > > Flashcoders@chattyfig.figleaf.com > > To change your subscription options or search the archive: > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > Brought to you by Fig Leaf Software > > Premier Authorized Adobe Consulting and Training > > http://www.figleaf.com > > http://training.figleaf.com > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com >
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com