LOL, for a second there I thought I was looking at a J2ME java class.
Are you trying to port a J2ME game? I was thinking about porting a game
I wrote and it started out looking a lot like this. Then I got busy and
forgot about it. You've inspired me to pick it up again. :)
BTW, looks good to me,
James
--
James O'Reilly — Consultant
Adobe Certified Flash Expert
http://www.jamesor.com
Design • Code • Train
Haydn wrote:
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