2/19/2010 4:05:47 AM
Title:
display text in textbox
i m creating a class with a textbox and button and adding that class object in mainapplication with addchild function and when i m clicking that button another window like texteditor is opening where i can open a file and when i click ok button in that texteditor it should display the text in object's textbox from texteditor textbox
i m getting text from editor window textbox to the object textbox if i m writing a function in main application for that but how to do the same by writing that function in the class itself rather than writing that function in mainapplication.
Help please
2/19/2010 4:48:55 AM
From your question i understand that you have problem referring the objects for getting there value.
If you want to get the value of some text box from within the class then you must set the reference of the textbox. Say you want to set text from some textbox to your texteditor and need to do that from within the class. Then the class nust have reference of both the textbox.
The reference can be stored as properties that you can set from main application or from where ever the reference is available .
Since your scenario is difficult to visualize , I can help you out if you can upload your project files .
rani
Points: 310
Posts:10
2/19/2010 5:13:33 AM
hi luther
where can i upload my project
2/19/2010 6:09:04 AM
you can use this website to upload file and post the link here so i can download it .
http://www.2shared.com/
2/19/2010 7:27:41 AM
hi luther
u can get my uploaded file from
http://www.2shared.com/file/11504656/7411a279/feb21.html
2/19/2010 9:34:36 AM
HI got the file ,
do you want to copy the text from "Character Field window" to "txtcharfld" on ok press .
2/19/2010 9:50:18 AM
solved it ,
first of all you need to declare a public variable in "wincheck.mxml" as below . This variable will store reference to your base class which is "CharacterField.as"
public var baseClass:CharacterField;
On your ok press function "fnfillchar" you need to save text to textbox of baseClass :
public function fnfillchar():void
by adding this line inside fnfillchar() function
baseClass.txtcharfld.text=texteditor.text;
Now the final step to set the reference goto "CharacterField.as" and add this line to set the reference inside "public function fnshowtexteditor(event:Event)"
just after adding popup "a"
a.baseClass=this;
I hope you get it right , else ping me back and i will upload the code back to you .
2/22/2010 11:28:44 PM
thanks a ton.
it is working.