I've been playing around with the drawing API in Flex 2, and managed 
to draw a shape without too much bother, using the Graphics property 
of the UIComponent object. The problem arises when I try to then 
animate this shape using the Resize class. For some reason, only the 
container holding the shape resizes, but the shape itself isn't 
affected at all. If I draw my shape in a Sprite object, rather than a 
UIComponent, I get a nasty runtime error in my browser, as you can't 
resize a Sprite.

Here's some code:

// create container for graphic
var _nuComp:UIComponent = new UIComponent();
var cBase:int = 300;
var cWidth:int = 80;
var color:unit = 0x666666;

// set colours
_nuComp.graphics.lineStyle(2,color,100);
_nuComp.graphics.beginFill(color,1);

// draw ellipse
_nuComp.graphics.drawEllipse(0+1,_cBase-(_ellipseHeight/2)-1,cWidth-
2,_ellipseHeight-2);

// draw lines
_nuComp.graphics.moveTo(0+1,_cBase);
_nuComp.graphics.lineTo(0+1,_cBase);
_nuComp.graphics.lineTo(cWidth-1,_cBase);
_nuComp.graphics.lineTo(cWidth-1,_cBase);
_nuComp.graphics.lineTo(0+1,_cBase);
_nuComp.graphics.endFill();

// add comp to stage
addChild(_nuComp);

// do resize effect
var tweenChild:Resize = new Resize();
tweenChild.heightBy = 1000;
tweenChild.duration = 3000;
tweenChild.target = _nuComp;
tweenChild.play();


This is a key part to the development of an illustrative component 
I'm trying to build. There must be some way of doing this, I just 
haven't got a clue! I've search LiveDocs and countless forums with no 
joy.

If any one has any pointers, please shout!

Thanks,






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to