At 3:14 PM +0200 7/13/10, Oleg Sivokon wrote:
>These properties may be overridden. My gut feeling says there should be
>something like commitProperties / validate or some similar method to apply
>all changes to the changed display object.
>

Thanks for the reply. Still tinkering here - I changed the type of the
'childSprite' var to be an instance of 'Sprite' - and then it works:
changing the width/height of 'testSprite" (SpriteVisualElement) results in
a resizing of its child content.

Guess I am not clear on when to use 'SpriteVisualElement' - I started using
it in place of 'Sprite' because I could not add a Sprite to any of the
Spark containers. Much of my app's content is generated through code.



public var testSprite:SpriteVisualElement

protected function creationCompleteHandler(event:FlexEvent):void
{

        testSprite = new SpriteVisualElement();

        var childSprite:Sprite = new Sprite();
        childSprite.graphics.beginFill(0xFFFF00, 1);
        childSprite.graphics.drawRect(0, 0, 200, 100);
        childSprite.graphics.endFill();
        childSprite.name = "child";

        testSprite.addChild(childSprite);

        container.addElement(testSprite);
        testSprite.addEventListener(MouseEvent.CLICK, grow);
}


public function grow(event:MouseEvent):void
{
        event.target.width += 5;
        event.target.height += 5;
        trace("grow",  event.target.width);
}
-- 
-----------------------------------------------------------------
http://www.roypardi.com/



Reply via email to