Adobe Dreamweaver Forums



Last 10 THreads :         Re: Colour differences on the web (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 0 - Views : 1 )           »          cs4 full screen mode isn't saved in workspaces, unlike cs3 (Last Post : Ann_Shelbourne@adobeforums.com - Replies : 1 - Views : 2 )           »          help me with adjustments layers in CS4 (Last Post : eddie caruso - Replies : 5 - Views : 6 )           »          delete all channels previously created by "save selection" (Last Post : John_A_Horner@adobeforums.com - Replies : 2 - Views : 3 )           »          Just a small 3D project I have completed (Last Post : Ziggi - Replies : 0 - Views : 1 )           »          Change custom Vector class to new Vector class in player10 (Last Post : VarioPegged - Replies : 3 - Views : 4 )           »          CS4 Motion Editor issues (Last Post : aaronlyon - Replies : 2 - Views : 9 )           »          Looping through results with "Next" button (Last Post : Fetch - Replies : 1 - Views : 2 )           »          Writing a Dreamweaver Extension, where to start? (Last Post : Randy Edmunds - Replies : 1 - Views : 2 )           »          Focus, Browsers & Spry Accordion (Last Post : Randy Edmunds - Replies : 6 - Views : 7 )           »         


User Info Statistics
Go Back   Adobe Dreamweaver Forums > Macromedia Software > Flex
 
Tags:



Reply
  #1 (permalink)  
Old 11-03-2008, 04:38 AM
SiHoop
 
Posts: n/a
Diggs:
Default Extracting text from a child

In the problem I am working on, container1 (a Sprite) will contain some number
of text fields. I want to be able to access the text stored in each text field
but don't know how to get to it. In the code below, I can get to the name of
the text field, but I know that getChildAt does not have a text property, so
how should I get the values tf1.text and tf2.text from container1?

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
creationComplete="init()">
<mx:Script>
<![CDATA[
public function init():void{
var tf1:TextField = new TextField();
var tf2:TextField = new TextField();
tf1.text="xxxxx"
tf2.text="yyyyy"
tf1.name = "text 1";
tf2.name = "text 2";
var container1:Sprite = new Sprite();
container1.addChild(tf1);
container1.addChild(tf2);
for(var i:int=0;i<container1.numChildren;i++){
trace(container1.getChildAt(i).name);
//trace(container1.getChildAt(i).text);
}

}
]]>
</mx:Script>
</mx:Application>



Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-03-2008, 04:38 AM
SiHoop
 
Posts: n/a
Diggs:
Default Re: Extracting text from a child

for(var i:int=0;i<container1.numChildren;i++){
var newTf:TextField = container1.getChildAt(i) as TextField;
trace(newTf.text)
}
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:34 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk