Im in as3 and Im trying to add a MovieClip inside of a Class I don't get any errors but my image does not show up.
This is my Class Code, my MovieClip is called woopa1
package
{
import flash.display.MovieClip;
import woopa1;
public class koopa extends woopa1
{
public function koopa()
{
trace(woopa1);
var woopa:woopa1 = new woopa1();
addChild(woopa);
woopa.x=100;
woopa.y=100;
woopa.height = 60;
woopa.width = 38;
}
}
}
It traces [Class woopa1] this is my Code in the frame calling the class
function onenterEnemy(event:Event):void
{
var enemy:koopa = new koopa();
}
Why doesn't my image show up?
Have you added your
enemy
instance to the display list?Also since you create an instance of your
woopa1
class and add it tokoopa
, yourkoopa
class should probably extendMovieClip
orSprite
instead of yourwoopa1
class.On a separate note, you may also want to name your classes with names that start with an uppercase character. So
koopa
should beKoopa
andwoopa1
should beWoopa1
.