[Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread Manuel Saint-Victor
I've seen this done in a few tutorial where the code placed in the main time line is written as if it were in a class file. By this I mean things like writing addEventListener(this); and having the functions sitting in the main timeline that handles the event. I think this is a convenient

Re: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread JesterXL
What aren't you comfortable with? Some don't like extending the timeline, and do something like: class MyController { private var view:MovieClip; function MyController ( mc:MovieClip ) { view = mc; } } And then on _root; controller = new MyController(this); or:

Re: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread Manuel Saint-Victor
Okay- actually I like that approach. I had seen you do part of that in a tutorial before but not with actually setting the class as the view from the timeline. It actually makes it a lot clearer now. I guess it's not as much not being comfortable with it as much as sometimes during a quick

RE: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread Judah
There is another method we use. When you start your project create a movieclip and at it to the stage at 0,0. Open it up and add all your GUI to that as you would the stage. Then in your library assign your class to the movieclip. Judah -Original Message- From: [EMAIL PROTECTED]

Re: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread Manuel Saint-Victor
I've seen that technique used and wondered how well it would work. So then you would have that class extend MovieClip-right? Is there any weirdness that comes up that I would want to look out for in this case? Would you have the constructor in the class file just call init(); and do the setup

Re: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread JesterXL
Ignoring scope of _root level functions is fine. Ignoring duplication of efforts is not. You can always wrap your functions in a class in 5 minutes. Removing duplication in code, however, takes way longer and may cause unforseen problems if not solved early enough. - Original Message

Re: [Flashcoders] coding the main stage as if it were a class

2006-02-17 Thread JesterXL
I used to do that. It's great because you avoid _root altogether, and never have collisions with other content there. The downside I ran into is if your SWF is loaded into another one, you need to remember to do: MyLoader.content.someApp.method vs. MyLoader.content.method And since you