Yeah, the background is literally a fill using the drawing API that appears to 
have a z-order above the Canvas itself.  So you can not draw to it, it is a 
privately scoped object.  They call it blocker in the code, apt variable name 
in this case, eh?   It boils down to z-orders.  

for example, 

<Canvas id="below" />
<Canvas id="above" backgroundColor="0x00ff00" />

use the drawing API to draw into below and you will not see it.  THe order in 
which child display objects are added to the display list defines the 
z-ordering.


Douglas Knudsen
[email protected]



On Nov 16, 2010, at 3:10 PM, <[email protected]> 
<[email protected]> wrote:

> I noticed the background color worked when I put it in the application. 
> However I still don’t understand why.
> 
> I looked around container...@2844 . Do you mean the comment header above 
> updateDisplayList
> 
> I really want to understand this.
> 
>  
> 
>  
> 
> From: [email protected] [mailto:[email protected]] On Behalf Of Douglas Knudsen
> Sent: Tuesday, November 16, 2010 2:36 PM
> To: [email protected]
> Subject: Re: [AFFUG Discuss] Very Basic code issue.
> 
>  
> 
> check around line 2844 in Container.as and you can see why.
> 
>  
> 
> Set no background or backgroundAlpha=0 on your drawing Canvas.  Layer your 
> containers if you want a background color, or set it on Application in his 
> case.  It maybe possible to add a Sprite on top of the Canvas and draw into 
> that too, maybe.
> 
>  
> 
>  
> 
> Douglas Knudsen
> 
> [email protected]
> 
>  
> 
>  
> 
>  
> 
> On Nov 16, 2010, at 1:36 PM, Eric DeCoff wrote:
> 
> 
> 
> 
> Could it be as simple as the the draw canvas having no height / width defined 
> ;)
> 
> sent via droid
> 
> On Nov 16, 2010 10:04 AM, "Darin Kohles" <[email protected]> wrote:
> > also, set childCompletion="all" it's possible the canvas hasn't been fully
> > rendered. You could also move the creationComplete init() to fire from the
> > Canvas, instead of the Application
> > 
> > On Tue, Nov 16, 2010 at 9:02 AM, Darin Kohles <[email protected]> wrote:
> > 
> >> I doubt this will help, but inline styles override css styles. But since
> >> clearly you are adding the graphic at runtime this shouldn't be an issue.
> >> Have you tried setting the fillStyle as well (even though it's not being
> >> used)?
> >>
> >> Also you might do graphics.clear(), before you start drawing.
> >>
> >>
> >> On Tue, Nov 16, 2010 at 8:53 AM, Chris Morrow <[email protected]>wrote:
> >>
> >>> Not sure why, but I always use a nested canvas; one for the bgcolor and
> >>> one for graphics and other elements.
> >>> - Chris Morrow
> >>>
> >>>
> >>> <?xml version="1.0" encoding="utf-8"?>
> >>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> >>> layout="absolute" creationComplete="init()">
> >>> <mx:Script>
> >>> public function init():void
> >>> {
> >>> drawing_canvas.graphics.lineStyle(3,0xffffff, 1.0);
> >>> drawing_canvas.graphics.moveTo(10,10);
> >>> drawing_canvas.graphics.lineTo(100,100);
> >>> }
> >>> </mx:Script>
> >>> <mx:Canvas width="100%" height="100%" backgroundColor="0x000000">
> >>> <mx:Canvas id="drawing_canvas" />
> >>> </mx:Canvas>
> >>> </mx:Application>
> >>>
> >>>
> >>> On Tue, Nov 16, 2010 at 9:29 AM, Atlanta Geek 
> >>> <[email protected]>wrote:
> >>>
> >>>> I have the following code and the line is not visible. If I remove
> >>>> the background color from the canvas the line is visible.
> >>>> Would anyone know why this is happening? I am on Flex 3.5
> >>>>
> >>>> <?xml version="1.0" encoding="utf-8"?>
> >>>> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> >>>> layout="absolute" creationComplete="init()">
> >>>> <mx:Script>
> >>>> public function init():void
> >>>> {
> >>>> drawing_canvas.graphics.lineStyle(3,0xffffff, 1.0);
> >>>> drawing_canvas.graphics.moveTo(10,10);
> >>>> drawing_canvas.graphics.lineTo(100,100);
> >>>> }
> >>>> </mx:Script>
> >>>>
> >>>> <mx:Canvas id="drawing_canvas" width="100%" height="100%"
> >>>> backgroundColor="0x000000" />
> >>>> </mx:Application>
> >>>>
> >>>>
> >>>> -------------------------------------------------------------
> >>>> 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
> >>>> -------------------------------------------------------------
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >>
> >> --
> >> Darin Kohles
> >>
> >>
> > 
> > 
> > -- 
> > Darin Kohles
> 
>  
> 
> 
> ------------------------------------------------------------- 
> 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 
> -------------------------------------------------------------

Reply via email to