-
as3 evaluating
Hi
In the Rifle class I want to let its parent (Weapon class) to know which bullet class to use.
I was thinking of the following:
====
class Weapon extends MovieClip {
public var bulletClassName : String
public function fire () : void {
var bullet:Bullet = new bulletClassName();
}
}
class Rifle extends Weapon {
public function Rifle () {
bulletClassName = "RifleBullet";
}
}
var rifle:Rifle = new Rifle();
rifle.fire();
===
How can I do an evaluation on "new bulletClassName()"?
Or does anyone has another solution?
greetings
-
how bout making fire as a method of an interface?
-
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks