8/22/2010 7:49:29 AM
Title:
Error
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="initApp()">
<mx:Script>
<![CDATA[
public function initApp():void
{
var squareSize : uint = 100;
var square : Shape = new Shape();
square.graphics.beginFill(0xFF0000, 0.5);
square.graphics.drawRect(0, 0, squareSize, squareSize);
square.graphics.beginFill(0x00FF00, 0.5);
square.graphics.drawRect(200, 0, squareSize, squareSize);
square.graphics.beginFill(0x0000FF, 0.5);
square.graphics.drawRect(400, 0, squareSize, squareSize);
square.graphics.endFill();
addChild(square);
}
]]>
</mx:Script>
<mx:HBox x="10" y="10" width="100%" height="433" id="hbox">
</mx:HBox>
</mx:WindowedApplication>
I am getting this error.
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Shape@2b64a51 to mx.core.IUIComponent.Help please to solve this error. I am new to ActionScript.
8/22/2010 10:17:27 AM
Please anyone help me to solve this error.
Rayan
Points: 700
Posts:0
8/22/2010 10:55:49 AM
use rawChildren.addchild(square) directly using addChild wont work because shape is not flex component or display object.