Looks pretty good to me! You might consider having the display classes
dispatch an event instead of calling a single function when they
close--then you can extend behavior more easily in the future, if
several things need to happen based on the same event.

―
Mike Keesey

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Haydn
> Sent: Sunday, November 05, 2006 11:31 PM
> To: [email protected]
> Subject: [Flashcoders] Have I got this OOP business right?
> 
> Hi,
> 
> I've got a simple little game that I'm trying to make with AS2, but
I'm
> not sure that I'm doing it right. Here's what I've got so far. I've
> used a 'document class' as described here:
> http://www.bit-101.com/blog/?p=857
> 
> Here's the code in the .fla:
> 
> Game.create(this);
> 
> In Game.as:
> 
> class Game extends MovieClip {
> 
>       private var splash:Splash;
>       private var preload:Preload;
>       private var mainMenu:MainMenu;
> 
>       private function Game() {
>               showSplash();
>       }
> 
>       public static function create(target:MovieClip):Void {
>               target.__proto__ = Game.prototype;
>               Function(Game).apply(target, null);
>       }
> 
>       public function showSplash():Void {
>               Splash.create(this, "splash", getNextHighestDepth());
>               splash.setEndFunction(this, showPreload);
>       }
> 
>       public function showPreload():Void {
>               Preload.create(this, "preload", getNextHighestDepth(),
this);
>               preload.setEndFunction(this, showMainMenu)
>       }
> 
>       public function showMainMenu():Void {
>               MainMenu.create(this, "mainMenu",
getNextHighestDepth());
>               // etc.
>       }
> 
> }
> 
> The Splash, Preload and MainMenu classes each have a static function
> called create that attaches an instance of their symbol to the stage.
> The two setEndFunction functions tell Splash and Preload what call
when
> they've finished doing their thing.
> 
> Is this a reasonable way of going about things, or am I just making
> life hard for myself?
> 
> Thanks,
> 
> Haydn.
> 
> _______________________________________________
> [email protected]
> 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

_______________________________________________
[email protected]
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

Reply via email to