Actionscript 3, addChild to stage and addEventListener not working together -



Actionscript 3, addChild to stage and addEventListener not working together -

i wanna add together image library on stage , have event listener on when click on it, something. imgfrommylib set image want library. please help. easiest way ?

import flash.display.bitmap; import flash.events.*; import flash.display.sprite; function pwned(evt:mouseevent):void { trace ("a"); } var myimg:imgfrommylib = new imgfrommylib(); var mybitmap:bitmap = new bitmap(myimg); mybitmap.addeventlistener(mouseevent.click, pwned); addchild(mybitmap);

var myimg:imgfrommylib = new imgfrommylib(0,0); var mybitmap:bitmap = new bitmap(myimg); var mc:movieclip = new movieclip(); mc.graphics.beginfill(0x333333,1); mc.graphics.drawrect(0,0,mybitmap.width, mybitmap.height); mc.graphics.endfill(); addchild(mc); mc.addeventlistener(mouseevent.click, pwned); mc.addchild(mybitmap); function pwned(evt:mouseevent):void { trace ("a"); }

try this....

actionscript-3 addeventlistener addchild

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -