Hi, I'm a rookie at Actionsript 3. I'm trying to make a player class with a parameter to create an object related to the class name that was passed by this parameter in the constructor method.
PHP Code:
package
{
import flash.display.MovieClip;
public class Player extends MovieClip
{
private var _player:MovieClip;
public function Player(n)
{
_player = new n();
createPlayer();
}
private function createPlayer():void
{
stage.addChild(_player);
}
}
}
PHP Code:
package
{
import flash.display.MovieClip;
import Player;
public class Main extends MovieClip
{
private var _player:MovieClip;
public function Main()
{
_player = new Player(LiuKang);
}
}
}