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.
rani
Points:0
Posts:0
Answered

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



Luther
Points: 0
Posts:0
Accepted Answer
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

Luther
Points: 0
Posts:0
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/

rani
Points: 0
Posts:0
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

Luther
Points: 0
Posts:0
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 .

Luther
Points: 0
Posts:0
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 .




rani
Points: 0
Posts:0
2/22/2010 11:28:44 PM



thanks a ton.
it is working.


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 5+7 



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