Hi guys,

I'm new at Flex3/AS3 and I'm already stuck at what I thought would be a
simple "hello world" script:

GOAL:
A flex app with a button. When the button is hit it a simple shape
(rectangle) would appear to the screen.

PROPOSAL (doesn't work):

draw.mxml:
"""
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">
<mx:Script>import DrawApp;</mx:Script>
<mx:Script>
    <![CDATA[
        function drawNow():void{
            var myRectangle:DrawApp = new DrawApp();
        }
    ]]>
</mx:Script>
<mx:Button label="draw" click="drawNow()"></mx:Button>
</mx:Application>
"""
DrawApp.as:
"""
package {

import flash.display.*;

class DrawApp extends Sprite
{
    public function DrawApp()
    {
         var rectAndCircle:Shape=new Shape();
        rectAndCircle.graphics.lineStyle(1);
        rectAndCircle.graphics.beginBitmapFill(0x0000FF,1);
        rectAndCircle.graphics.drawRect(125,0,150,75);
        addChild(rectAndCircle);
    }
}

}
"""
When I compile this in FB3 I've got 1067 error codes beginning with
rectAndCircle.graphics.beginBitmapFill(0x0000FF,1);

Any idea what I'm missing here?

Thanks

francois

Reply via email to