Modify vectors at runtime
Is there any way to modify the vectors of a DisplayObject at runtim开发者_开发百科e? I import a Sprite or MovieClip on my application, and I want to be able to modify the vectors that composes it. A close approach is to use Graphic class, but it always renders below the Sprite, it can't clear the original graphic, and it can't modify the vectors, only draw new things.
And if this is totally impossible, I would like to know how I can call Sprite.graphics.drawXXX, so that the graphics are rendered above the Sprite.
Thanks.
Neither is possible. The graphics layer is always rendered beneath other objects in the Sprite's display list, and you can never change graphics once they have been drawn.
The only thing you can do about the latter is to create your own extension to the drawing mechanism, and manage all the vector information yourself. Then you can clear and re-draw the graphics every time values are changed.
To render graphics above other content, just create a new child Shape, draw inside of its graphics element, and then add it to the parent Sprite.
精彩评论