actionscript 3 - As3 AddChild() in a Class -
im in as3 , im trying add movieclip inside of class don't errors image not show up.
this class code, movieclip 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] code in frame calling class
function onenterenemy(event:event):void { var enemy:koopa = new koopa(); }
why doesn't image show up?
have added enemy
instance display list?
var enemy:koopa = new koopa(); addchild(enemy);
also since create instance of woopa1
class , add koopa
, koopa
class should extend movieclip
or sprite
instead of woopa1
class.
on separate note, may want name classes names start uppercase character. koopa
should koopa
, woopa1
should woopa1
.
Comments
Post a Comment