2 Replies Latest reply on Dec 4, 2009 9:05 AM by Gregory Lafrance

    A style question, and a Cairngorm question!

    andrewthorp Level 1

      Style - When I draw on a component with a backgroundColor, why can't I see it?

       

      Cairngorm -

       

      Sometimes I want to use the result directly in a module that I am showing on the screen. For instance, when I query the server for a group of items in a category. However, I can not add an event listener to the cairngorm result in the module (view) itself. Is the appropriate way to achieve this:

       

      1) Dispatch my Event

      2) In the result, populate an arraycollection with the items from the category (using a setter, so I can dispatch event)

      3) In module, listen for said event

      4) Populate tile from this eventhandler

       

      Is this correct?

        • 1. Re: A style question, and a Cairngorm question!
          Gregory Lafrance Level 6

          For the style issue, might be a timing issue, such that the background is rendered after the drawing. Maybe post simplified yet "complete" code that exhibits the issue?

           

          If this post helps, please mark it as such.


          Greg Lafrance
          www.ChikaraDev.com

          Flex Development and Support Services

          • 2. Re: A style question, and a Cairngorm question!
            andrewthorp Level 1

            Well it's pretty simple:

             

            <mx:Canvas id="mainCanvas" backgroundColor="0x000000">

                 <mx:creationComplete>

                      <[CDATA[

                           var g:Graphics = mainCanvas.graphics;

                           g.beginGradientFill( GradientType.LINEAR, [0xffffff,0xffffff], [1.0,0.0], [0,255], verticalGradientMatrix( 0, 0, mainCanvas.width, mainCanvas.height );

                           g.drawRect( 0, 0, mainCanvas.width, mainCanvas.height );

                           g.endFill();

                      ]]>

                 </mx:creationComplete>

            </mx:Canvas>

             

            If I remove the backgroundColor, I can see the gradient. If I leave backgroundColor, I can only see black.