RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Gordon Smith












> Although, my example works too, but
can you tell why that is?

 

Rich's code threw an RTE because he added
the TextField as a child of some Container, and Containers require their
children to be IUIComponents. Your example doesn't throw an RTE because you are
adding the TextField as a child of the Button, which is not a Container. Non-containers
allow any kind of DisplayObject to be added as a child.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Joost Nuijten
Sent: Monday, August 07, 2006 3:14
PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Simple
TextField Question



 







Yeah, that should work. Although, my
example works too, but can you tell why that is?

 

Anyway, I think the documentation of
TextField has to be updated. I added a comment to the livedocs.

 

~joost

 







Van:
[EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] Namens Gordon Smith
Verzonden: maandag 7 augustus 2006
23:54
Aan: [EMAIL PROTECTED]ups.com
Onderwerp: RE: [flexcoders] Simple
TextField Question







Try creating an mx.core.UITextField instead of a flash.display.TextField.
UITextField implements the IUIComponent interface.

- Gordon











From: [EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com]
On Behalf Of richmcgillicuddy
Sent: Monday, August 07, 2006
10:11 AM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Simple
TextField Question











I have a
simple app that I want to have text show up using a TextField.

public function onTest() : void {
var myText:TextField = new TextField();
myText.x = 100;
myText.y = 100;
myText.width = 75;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.height = 50;
myText.width = 200;
myText.backgroundColor = 0x849383;
myText.text = "Test Test Test Test Test Test";
var format1:TextFormat = new TextFormat();
format1.color = 0xFF;
myText.setTextFormat(format1);
addChild(myText); 
}

I click on the button and get the error:

TypeError: Error #1034: Type Coercion failed: cannot convert
flash.text::TextField@11551769 to mx.core.IUIComponent.
at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at Step5/onTest()
at Step5/___Button1_click()

The addChild does not like that it is not a UIComponent. The addChild
works for text, Label and other UIComponents. I cannot get the
textField to show up. Eventually I want to have a component that
includes one or two text areas that are read only to the user, what is
the best way to do this?

Rich
















__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Joost Nuijten





Yeah, that should work. Although, my example works too, but 
can you tell why that is?
 
Anyway, I think the documentation of TextField has to be 
updated. I added a comment to the livedocs.
 
~joost


Van: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] Namens Gordon 
SmithVerzonden: maandag 7 augustus 2006 23:54Aan: 
flexcoders@yahoogroups.comOnderwerp: RE: [flexcoders] Simple 
TextField Question




Try creating an 
mx.core.UITextField instead of a flash.display.TextField. UITextField 
implements the IUIComponent interface.

- 
Gordon





From: 
[EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] 
On Behalf Of 
richmcgillicuddySent: Monday, August 07, 2006 10:11 
AMTo: 
[EMAIL PROTECTED]ups.comSubject: [flexcoders] Simple TextField 
Question




I have a 
simple app that I want to have text show up using a TextField.public 
function onTest() : void {var myText:TextField = new 
TextField();myText.x = 100;myText.y = 100;myText.width = 
75;myText.autoSize = TextFieldAutoSize.CENTER;myText.height = 
50;myText.width = 200;myText.backgroundColor = 
0x849383;myText.text = "Test Test Test Test Test Test";var 
format1:TextFormat = new TextFormat();format1.color = 
0xFF;myText.setTextFormat(format1);addChild(myText); 
}I click on the button and get the error:TypeError: Error 
#1034: Type Coercion failed: cannot 
convertflash.text::TextField@11551769 to 
mx.core.IUIComponent.atmx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()at 
mx.core::Container/addChildAt()at 
mx.core::Container/addChild()at Step5/onTest()at 
Step5/___Button1_click()The addChild does not like that it is not a 
UIComponent. The addChildworks for text, Label and other UIComponents. I 
cannot get thetextField to show up. Eventually I want to have a component 
thatincludes one or two text areas that are read only to the user, what 
isthe best way to do this?Rich


__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



Re: [flexcoders] Simple TextField Question

2006-08-07 Thread Daniel Freiman



You're trying to add the TextField to a Container which only takes IUIComponent objects.  However, I believe UIComponent takes DisplayObjects.  So you have two choices: (1) add the TextField to a UIComponent and then add that component to the container, (2) use UITextField which is basically the same except it is a UIComponent.
On 8/7/06, Joost Nuijten <[EMAIL PROTECTED]> wrote:







Hmm the addChild should accept every object that is an 
instance of DisplayObject. And TextField is an instance of DisplayObject. They 
example code for TextField shows almost the same code as 
yours...
 
And the funny thing is that the example code doesn't 
work...
 
 


Van: flexcoders@yahoogroups.com 
[mailto:flexcoders@yahoogroups.com] Namens 
richmcgillicuddyVerzonden: maandag 7 augustus 2006 
19:11Aan: flexcoders@yahoogroups.comOnderwerp: 
[flexcoders] Simple TextField Question


I have a simple app that I want to have text show up using a 
TextField.public function onTest() : void {var myText:TextField = 
new TextField();myText.x = 100;myText.y = 100;myText.width = 
75;myText.autoSize = TextFieldAutoSize.CENTER;myText.height = 
50;myText.width = 200;myText.backgroundColor = 
0x849383;myText.text = "Test Test Test Test Test Test";var 
format1:TextFormat = new TextFormat();format1.color = 
0xFF;myText.setTextFormat(format1);addChild(myText); 
}I click on the button and get the error:TypeError: Error 
#1034: Type Coercion failed: cannot 
convertflash.text::[EMAIL PROTECTED] to 
mx.core.IUIComponent.atmx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild
()at 
mx.core::Container/addChildAt()at 
mx.core::Container/addChild()at Step5/onTest()at 
Step5/___Button1_click()The addChild does not like that it is not a 
UIComponent. The addChildworks for text, Label and other UIComponents. I 
cannot get thetextField to show up. Eventually I want to have a component 
thatincludes one or two text areas that are read only to the user, what 
isthe best way to do this?Rich





__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Gordon Smith












Try creating an mx.core.UITextField
instead of a flash.display.TextField. UITextField implements the IUIComponent
interface.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of richmcgillicuddy
Sent: Monday, August 07, 2006
10:11 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Simple
TextField Question



 







I have a simple app that I want to have text show up
using a TextField.

public function onTest() : void {
var myText:TextField = new TextField();
myText.x = 100;
myText.y = 100;
myText.width = 75;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.height = 50;
myText.width = 200;
myText.backgroundColor = 0x849383;
myText.text = "Test Test Test Test Test Test";
var format1:TextFormat = new TextFormat();
format1.color = 0xFF;
myText.setTextFormat(format1);
addChild(myText); 
}

I click on the button and get the error:

TypeError: Error #1034: Type Coercion failed: cannot convert
flash.text::TextField@11551769 to mx.core.IUIComponent.
at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at Step5/onTest()
at Step5/___Button1_click()

The addChild does not like that it is not a UIComponent. The addChild
works for text, Label and other UIComponents. I cannot get the
textField to show up. Eventually I want to have a component that
includes one or two text areas that are read only to the user, what is
the best way to do this?

Rich






__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Gordon Smith












> addChild should accept every object
that is an instance of DisplayObject

 

No. You must pass an IUIComponent to a
Container's override of the addChild() method. The parameter is typed as
DisplayObject because AS3 doesn't allow an override to change a method
signature.

 

- Gordon

 









From:
flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Joost Nuijten
Sent: Monday, August 07, 2006
11:55 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Simple
TextField Question



 







Hmm the addChild should accept every
object that is an instance of DisplayObject. And TextField is an instance of
DisplayObject. They example code for TextField shows almost the same code as
yours...

 

And the funny thing is that the example
code doesn't work...

 

 

 







Van:
[EMAIL PROTECTED]ups.com [mailto:flexcoders@yahoogroups.com] Namens richmcgillicuddy
Verzonden: maandag 7 augustus 2006
19:11
Aan: [EMAIL PROTECTED]ups.com
Onderwerp: [flexcoders] Simple
TextField Question



I have a simple app that I want to have text show up
using a TextField.

public function onTest() : void {
var myText:TextField = new TextField();
myText.x = 100;
myText.y = 100;
myText.width = 75;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.height = 50;
myText.width = 200;
myText.backgroundColor = 0x849383;
myText.text = "Test Test Test Test Test Test";
var format1:TextFormat = new TextFormat();
format1.color = 0xFF;
myText.setTextFormat(format1);
addChild(myText); 
}

I click on the button and get the error:

TypeError: Error #1034: Type Coercion failed: cannot convert
flash.text::TextField@11551769 to mx.core.IUIComponent.
at
mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at Step5/onTest()
at Step5/___Button1_click()

The addChild does not like that it is not a UIComponent. The addChild
works for text, Label and other UIComponents. I cannot get the
textField to show up. Eventually I want to have a component that
includes one or two text areas that are read only to the user, what is
the best way to do this?

Rich








__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___






RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Joost Nuijten





Hmm the addChild should accept every object that is an 
instance of DisplayObject. And TextField is an instance of DisplayObject. They 
example code for TextField shows almost the same code as 
yours...
 
And the funny thing is that the example code doesn't 
work...
 
 


Van: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] Namens 
richmcgillicuddyVerzonden: maandag 7 augustus 2006 
19:11Aan: flexcoders@yahoogroups.comOnderwerp: 
[flexcoders] Simple TextField Question


I have a simple app that I want to have text show up using a 
TextField.public function onTest() : void {var myText:TextField = 
new TextField();myText.x = 100;myText.y = 100;myText.width = 
75;myText.autoSize = TextFieldAutoSize.CENTER;myText.height = 
50;myText.width = 200;myText.backgroundColor = 
0x849383;myText.text = "Test Test Test Test Test Test";var 
format1:TextFormat = new TextFormat();format1.color = 
0xFF;myText.setTextFormat(format1);addChild(myText); 
}I click on the button and get the error:TypeError: Error 
#1034: Type Coercion failed: cannot 
convertflash.text::TextField@11551769 to 
mx.core.IUIComponent.atmx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()at 
mx.core::Container/addChildAt()at 
mx.core::Container/addChild()at Step5/onTest()at 
Step5/___Button1_click()The addChild does not like that it is not a 
UIComponent. The addChildworks for text, Label and other UIComponents. I 
cannot get thetextField to show up. Eventually I want to have a component 
thatincludes one or two text areas that are read only to the user, what 
isthe best way to do this?Rich
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



RE: [flexcoders] Simple TextField Question

2006-08-07 Thread Joost Nuijten





Hmm now I see. You should do this:
 

 
and then your function will be like 
this:
public function onTest(event:Event) : 
void {var myText:TextField = new TextField();myText.x = 100;myText.y 
= 100;myText.width = 75;myText.autoSize = 
TextFieldAutoSize.CENTER;myText.height = 50;myText.width = 
200;myText.backgroundColor = 0x849383;myText.text = "Test Test Test 
Test Test Test";var format1:TextFormat = new 
TextFormat();format1.color = 
0xFF;myText.setTextFormat(format1);event.currentTarget.addChild(myText); 
}
 


Van: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] Namens 
richmcgillicuddyVerzonden: maandag 7 augustus 2006 
19:11Aan: flexcoders@yahoogroups.comOnderwerp: 
[flexcoders] Simple TextField Question


I have a simple app that I want to have text show up using a 
TextField.public function onTest() : void {var myText:TextField = 
new TextField();myText.x = 100;myText.y = 100;myText.width = 
75;myText.autoSize = TextFieldAutoSize.CENTER;myText.height = 
50;myText.width = 200;myText.backgroundColor = 
0x849383;myText.text = "Test Test Test Test Test Test";var 
format1:TextFormat = new TextFormat();format1.color = 
0xFF;myText.setTextFormat(format1);addChild(myText); 
}I click on the button and get the error:TypeError: Error 
#1034: Type Coercion failed: cannot 
convertflash.text::TextField@11551769 to 
mx.core.IUIComponent.atmx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()at 
mx.core::Container/addChildAt()at 
mx.core::Container/addChild()at Step5/onTest()at 
Step5/___Button1_click()The addChild does not like that it is not a 
UIComponent. The addChildworks for text, Label and other UIComponents. I 
cannot get thetextField to show up. Eventually I want to have a component 
thatincludes one or two text areas that are read only to the user, what 
isthe best way to do this?Rich
__._,_.___





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








   






  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  
  
Software development best practice
  

   
  







  
  
  YAHOO! GROUPS LINKS



   Visit your group "flexcoders" on the web. 
   To unsubscribe from this group, send an email to: [EMAIL PROTECTED] 
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



  






__,_._,___



[flexcoders] Simple TextField Question

2006-08-07 Thread richmcgillicuddy
I have a simple app that I want to have text show up using a TextField.

  public function onTest() : void {
var myText:TextField = new  TextField();
myText.x  = 100;
myText.y  = 100;
myText.width  = 75;
myText.autoSize = TextFieldAutoSize.CENTER;
myText.height = 50;
myText.width  = 200;
myText.backgroundColor = 0x849383;
myText.text   = "Test Test Test Test Test Test";
var format1:TextFormat = new TextFormat();
format1.color = 0xFF;
myText.setTextFormat(format1);
addChild(myText);  
  }


I click on the button and get the error:

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::addingChild()
at mx.core::Container/addChildAt()
at mx.core::Container/addChild()
at Step5/onTest()
at Step5/___Button1_click()


The addChild does not like that it is not a UIComponent. The addChild
works for text, Label and other UIComponents. I cannot get the
textField to show up. Eventually I want to have a component that
includes one or two text areas that are read only to the user, what is
the best way to do this?


Rich






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/