At 3:47 PM +0000 7/14/10, Ariel J wrote:
>my guess is that the 200x100 rect was working properly but the +5 stuff
>wasn't?
>
>I remember dealing with this and saw somewhere that sprites are sized only
>when content is there, so for example, if you just add pixels to the
>height, it won't get bigger, but if you draw a bigger rect, e.g. 200x105,
>it will.
>
In my test there is a child sprite - so I was expecting that to scale when
it's parent h/w changes.
It seems like the lack of scaling issue is due to my nesting of
SpriteVisualElement type containers. I started using SVEs because I
couldn't add a 'Sprite' instance to any of the Spark containers. So I just
started using them as my base class for a bunch of dynamic stuff I was
doing.
Coming to Flex from Flash this has been one of the most confusing things -
the addChild/addElement differences. I've been through the docs but haven't
seen a clear explanation aside from SVEs "implementing IVisualElement" -
but that's not registering well in my little brain.
>> 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/
>>
>
>
>
>
>------------------------------------
>
>--
>Flexcoders Mailing List
>FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
>Alternative FAQ location:
>https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
>Search Archives:
>http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>
>
>
--
-----------------------------------------------------------------
http://www.roypardi.com/