Hi all -
I've been doing due diligence to find an answer to this, as in I didn't come here first, but I'm not getting exactly how to apply visual coding to the mxml area.

For a quick example - I have a simple mxml file:

<?xml version="1.0" encoding="utf-8"?>
<customState:StateDev
        xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:customStates="dev.state.*"
        width="300"
        height="100%"
        creationComplete="drawContentArea();">

    <mx:Panel id="panelOne" layout="absolute" width="100%" height="100%" title="My Panel" x="0" y="0"/>

</customState:StateDev>

easy enough. this can run fine alone but I just want to dynamically draw something on the stage.

so I figured I could attached a sprite and use the drawing api. like so:

package dev.state
{
    import mx.containers.Canvas;
    import flash.display.Sprite;

   
    public class StateDev extends Canvas
    {
        public var contentBg:Sprite;
        public var panelOne:Panel;

       
        public function StateDev()
        {
            super();

        }
       
        public function drawContentArea ():void
        {
            contentBg = new Sprite();
            contentBg.graphics.beginFill(0xFF0000);
            contentBg.graphics.drawRoundRect(0, 0, 150, 400, 10, 10);
            contentBg.graphics.endFill();
            panelOne.addChild(contentBg);
        }
    }
}


obviously this isn't working. I get the errorr "TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::[EMAIL PROTECTED] to mx.core.IUIComponent."

can someone clue me in? or just point me in the direction of where maybe I can find the answer online since my searching and reading hasn't seemed to solve it.


Thanks -
cb


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail Beta. __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to