Okt
14
14
Problem with the Event-target and removeChild
Today i played a bit with a touchscreen and flash at the finish agency. I tried to program a simple game you have to remove clouds as fast as you can and a new cloud appears each 0.5 seconds. If you click on of the clouds it will disapear. The Code is really simple but i get a problem with removing the childs after clicking them.
function removeCloud(evt:MouseEvent):void{ evt.target.removeEventListener(MouseEvent.CLICK, removeCloud) this.removeChild(evt.target); }
The compiler always returend an error: 1118:Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
After a bit trail and error i mentioned the right syntax is:
function removeCloud(evt:MouseEvent):void{ evt.target.removeEventListener(MouseEvent.CLICK, removeCloud) this.removeChild(MovieClip(evt.target)); }
Maybe this helps somebody somday
Gib deinen Senf ab
Letzte Kommentare
Letzte Tweets
- 2 Stunden ago @tobboo @fylypfiasco wo sind nur deine Prioritäten? :P
- 6 Stunden ago @tobboo Klar. Aber erst heut abend. 5 bin ich noch nicht daheim :)
- 6 Stunden ago @fylypfiasco Das sollte an Tobi gehen :D
- 6 Stunden ago @tobboo Musst du net eh noch bissl was aufholen? :D
- 6 Stunden ago Was macht ihr eigentlich alle hier und nicht in Diablo 3?







