If you dont have any options except Canvas and Panel (you can do it easily with 
Group spark component) then you can 
override createChildren() method in Canvas or Panel and as many rect you need 
with adding a new sprite in createChildren and update graphics it in 
updateDisplayList()

<mx:Canvas>

private var rect:Sprite;
override public function createChildren():void
{
 rect = new Sprite();
addChild(rect);
}

then you need to update the display list

override public function updateDisplayList():void
{
 rect.graphics.beginFill();
rect.graphics.drawRect(your values);

}


</mx:Canvas>

--- In flexcoders@yahoogroups.com, Chet Haase <cha...@...> wrote:
>
> 
> I can't tell what you're trying to do, but this code works:
> 
>     <s:Panel width="400" height="300">
>         <s:Rect width="100" height="100">
>             <s:fill>
>                 <s:SolidColor color="red"/>
>             </s:fill>
>         </s:Rect>
>         <s:Rect x="200" width="100" height="100">
>             <s:fill>
>                 <s:SolidColor color="blue"/>
>             </s:fill>
>         </s:Rect>
>     </s:Panel>
> 
> I can't tell if you are trying to use a Canvas or a Panel, since you mention 
> both. Note that Canvas does not spark equivalent, and you can't add Rect 
> objects directly to a halo container. But toss a Group in there and you can 
> add anything to the group.
> 
> Chet.
> 
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On 
> Behalf Of Nini7016 Nini7016
> Sent: Tuesday, April 20, 2010 4:19 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Draw three rectangles inside a canvas -----URGENT PLEASE
> 
> 
> 
> Hello
> 
> I have a canvas and I would like to add  within this canvas three rectangles 
> superimposed and just between two rectangles there will be space.
> 
> I used the panel and I put in rectangles but this was not the case.
> 
> you have any ideas please
> 
> Any help
> 
> do you think i must use any other component flex apart Panel ??
> 
> 
> Thank you very much
> 
> 
> ________________________________
> Envie de naviguer sur Internet sans laisser de trace? La solution avec 
> Internet Explorer 8<http://clk.atdmt.com/FRM/go/207186970/direct/01/>
>


Reply via email to