actionscript 3 - How to add/get Sprite to/from UIComponent -


how add sprite bordercontainer (uicomponent)?

var sprite:sprite = new sprite(); sprite.graphics.linestyle(10,0); sprite.graphics.moveto(40,40); sprite.graphics.lineto(60,60);            mybordercontainer.addchild(sprite);    //mybrodercontainer id of bordercontainer created in mxml 

this code doesnt work. cant see sprite on bordercontainer. how can add sprites on uicomponents, can see them? tried , kinda worked:

var comp:uicomponent = new uicomponent(); comp.addchild(sprite); myborderconteiner.addelement(comp);  

but dont think, right way add sprites uicomponents. there method that?


second problem:

when have few sprites added uicomponent (lines/circles/images or others) how can receive object sprite uicomponent, containing sprites added before uicomponent?

i need create bitmap sprite , things.

i hope make myself clear

use spritevisualelement container. should serve nicely container or sprite substitute. draw in uicomponent itself.


Comments