# \[AS3\]\[Flex\] new Resize() on Sprite object

**URL:** <https://forum.kirupa.com/t/as3-flex-new-resize-on-sprite-object/217602>\
**Category:** flash\
**Created:** [February 28, 2007, 8:16am UTC](https://forum.kirupa.com/t/as3-flex-new-resize-on-sprite-object/217602 "2007-02-28T08:16:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete\_zahut](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pete\_zahut](https://forum.kirupa.com/u/pete_zahut)\
**Post date:** [February 28, 2007, 8:16am UTC](https://forum.kirupa.com/t/as3-flex-new-resize-on-sprite-object/217602/1 "2007-02-28T08:16:27Z")

</div>

I’m making a resize function that has to resize a Project object that extends Sprite.

But I keep ketting a type coercion error:  
[COLOR=“Red”]TypeError: Error #1034: Type Coercion failed: cannot convert AS:: Project@318ff89 to mx.core.IUIComponent.[/COLOR]

I’ve tried casting the Project object to an UIComponent or DisplayObject, but this also throws a TypeError.

[AS]var resizeTarget:UIComponent = new UIComponent();  
resizeTarget = UIComponent(target.getChildAt(0));  
var myResize:Resize = new Resize(resizeTarget);[/AS]

So basically should I try avoiding the use of Sprites in Flex? Or are there solutions?

Thx.
