In flex, container children must be iuicomponents.  Use uitextfield

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Jonathan Lee
Sent: Wednesday, December 05, 2007 8:17 PM
To: [email protected]
Subject: [flexcoders] Add textfield error

 

Hello all,
I have a application to in creationComplete event to execute a function
called initApp();

This is initApp()..
import flash.text.TextField;
public var mtTXT:TextField;
public function initApp():void{
                myTXT = new TextField();
                myTXT.x = 343; myTXT.y = 10; 
                myTXT.width = 196; myTXT.height = 300;
                myTXT.wordWrap = true; myTXT.border = true;
                myTXT.multiline =true;
                
                     !        
                addChild(myTXT);
}

It compiles ok, but when it runs, it says TypeError: Error #1034: Type
Coercion failed: cannot convert flash.text::[EMAIL PROTECTED] to
mx.core.IUIComponent.
    at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChi
ld()



But that TextField is inherited from DisplayObject which suppose to be
abled to used within addChild() function.

Any thoughts.

Thanks.

  

________________________________

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
<http://us.rd.yahoo.com/evt=51733/*http:/mobile.yahoo.com/;_ylt=Ahu06i62
sR8HDtDypao8Wcj9tAcJ%20> 

 

Reply via email to