header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Manoj
Points:0
Posts:0

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.



1
Manoj
Points: 0
Posts:0
8/22/2010 10:17:27 AM



Please anyone help me to solve this error.

2
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.

3
Manoj
Points: 0
Posts:0
8/22/2010 11:17:49 AM



Thankyou. Its working


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 8+2 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions