The function never runs.
AFAIK you need to add this to a component implementation and then
instantiate the component. Something like this...
MyComponent.as:
package
{
import mx.core.UIComponent;
public class MyComponent extends UIComponent
{
public function MyComponent()
{
super();
}
override protected function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
graphics.clear();
graphics.beginFill(0xD3D3D3);
graphics.drawRect(0, unscaledHeight/3, unscaledWidth, 2 *
unscaledHeight/3);
graphics.drawRect(0, 0, unscaledWidth,unscaledHeight);
graphics.endFill();
graphics.moveTo(0, 15);
graphics.lineStyle(1, 0xFF0000);
graphics.lineTo(50, 15);
}
}
}
Now instantiate it...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute" xmlns:MyComps="*">
<MyComps:MyComponent x="100" y="100"/>
</mx:Application>
--- In [email protected], "gmoniey22" <gmonie...@...> wrote:
>
> I'm sure its something stupid, but I cant figure out why this doesnt
draw anything.
>
> I followed the example found here:
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.\
htm?context=LiveDocs_Parts&file=00001738.html
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute">
> <mx:Canvas height="75" width="100">
> <mx:Script>
> <![CDATA[
> protected override function
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
> super.updateDisplayList(unscaledWidth, unscaledHeight);
> graphics.clear();
>
> graphics.beginFill(0xD3D3D3);
> //graphics.drawRect(0, unscaledHeight/3, unscaledWidth, 2 *
unscaledHeight/3);
> graphics.drawRect(0, 0, unscaledWidth,unscaledHeight);
> graphics.endFill();
>
> graphics.moveTo(0, 15);
> graphics.lineStyle(1, 0xFF0000);
> graphics.lineTo(50, 15);
> }
> ]]>
> </mx:Script>
> </mx:Canvas>
> </mx:Application>
>