Alright, I didn't see the runtime error (the environment suppresses them, but
try/catch works fine:

TypeError: Error #1034: Type Coercion failed: cannot convert
flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent.
        at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()
        at mx.core::Container/addChildAt()
        at mx.core::Container/addChild()
        at FormatExpandable/::setupExpandArea()
        at FormatExpandable/show()
        at Format/show()
        at AdScreen/VS_Change()
        at AdScreen/___ViewStack1_change()
        at
flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunc
tion()
        at flash.events::EventDispatcher/dispatchEvent()
        at mx.core::UIComponent/dispatchEvent()
        at mx.containers::ViewStack/::dispatchChangeEvent()
        at
mx.containers::ViewStack/mx.containers:ViewStack::commitProperties()
        at mx.core::UIComponent/validateProperties()
        at mx.managers::LayoutManager/::validateProperties()
        at mx.managers::LayoutManager/::doPhasedInstantiation()
        at Function/http://adobe.com/AS3/2006/builtin::apply()
        at mx.core::UIComponent/::callLaterDispatcher2()
        at mx.core::UIComponent/::callLaterDispatcher()

It does the same thing regardless of type flash.diplay.Sprite or
flash.display.MovieClip. "FormatExpandable" is a subclass of mx:Canvas

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Haygood
Sent: Monday, April 30, 2007 1:48 PM
To: [email protected]
Subject: RE: [AFFUG Discuss] drawing colored rectangle movieclips in Flex

I'm trying this:

var mc:MovieClip = new MovieClip();
this.addChild( mc );
mc.x = 50;
mc.y = 50;

mc.graphics.beginFill(0x0000FF);
mc.graphics.drawRect( 0, 0, 500, 500 );
mc.graphics.endFill();

It works flawlessly in Flash CS3 though...


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mike Britton
Sent: Monday, April 30, 2007 1:39 PM
To: [email protected]
Subject: Re: [AFFUG Discuss] drawing colored rectangle movieclips in Flex

var channelBar5 = new Sprite();
channelBar5.graphics.beginFill(0xFFFFFF);
channelBar5.graphics.drawRect(27,-20,5,30);
channelBar5.graphics.endFill();
addChild(channelBar5);  


hth,

Mike



On 4/30/07, Justin Haygood <[EMAIL PROTECTED]> wrote:
>
>
>
>
> I'm trying to draw two rectangles in Flex 2. In the Flash CS3 prototype, I
> used library instances, but I'm trying to do the same thing using pure
code,
> and I can't for the life of me figure out how to draw a colored rectangle
> that is a MovieClip (or subclass of one).
>
>
>
> Basically, I just want to draw a movieclip that has a blue background
inside
> Flex 2 using pure ActionScript 3.0
>
>
>
> Thanks In advance!
>
>
>
> --Justin Haygood
> -------------------------------------------------------------
> To unsubscribe from this list, simply email the list with unsubscribe in
the
> subject line
>
> For more info, see http://www.affug.com
> Archive @
> http://www.mail-archive.com/discussion%40affug.com/
> List hosted by FusionLink
> -------------------------------------------------------------


-- 
Mike
----------
http://www.mikebritton.com
http://www.mikenkim.com


-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------





-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------





-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the 
subject line

For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------


Reply via email to