alors je ne comprend pas je n'arrive pas a faire un truc tout simple : ajouter un sprite a une hbox
dois y avoir un truc qui m'echappe
pourtant le addchild prend bien en parametre un DisplayObject et Sprite est bien herité de DisplayObject
mais j'obtient une erreur de conversion de type :
Main Thread (Suspended: TypeError: Error #1034: Echec de la contrainte de type : conversion de flash.display::Sprite@2fbdc91 en mx.core.IUIComponent impossible.)
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="doInit()">
<mx:Script>
<![CDATA[
private function doInit():void
{
var ligne:Sprite = new Sprite();
ligne.graphics.beginFill(0x000000);
ligne.graphics.drawRect(0, 0, 100, 100);
ligne.graphics.endFill();
hb.addChild(ligne);
}
]]>
</mx:Script>
<mx:HBox id="hb">
</mx:HBox>
</mx:Application>


Connexion
Inscription

Citer


