Each mxml is its own "document" with its own set of variables just like
HTML files.  If the custom component is a used in the main app, then
using parentDocument.teams should work.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Andrew
Sent: Saturday, September 22, 2007 2:03 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Custom Components & Data

 

Here i am kinda confused so here is the code so you can see what i mean.

Code of Main app.mxml
[Code]
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
creationComplete="teamRequest.send()" layout="absolute"
xmlns:ns1="bin.myComponents.*" xmlns:ns2="myComponents.*">

<mx:HTTPService 
id="teamRequest" url="./data.php" useProxy="false"/>
<mx:Script>

<![CDATA[
import mx.controls.Alert;
]]>
</mx:Script>
<mx:Panel width="35%" layout="absolute" id="teamDB" left="10"
top="10" height="50%">
<mx:DataGrid id="teams" width="100%" height="100%"
dataProvider="{teamRequest.lastResult.teams.item}" textAlign="center"
itemClick="currentState='details'">
<mx:columns>
<mx:DataGridColumn headerText="Teams Number"
dataField="team_number"/>
<mx:DataGridColumn headerText="Team Name"
dataField="team_name"/>

</mx:columns>
</mx:DataGrid>
</mx:Panel>
<mx:VBox y="10" width="60%" height="95%" borderStyle="solid"
cornerRadius="6" backgroundColor="#FFFFFF" backgroundAlpha="0.4"
right="10">
<ns2:details>
</ns2:details>

</mx:VBox>

</mx:Application> 

[/Code]

Now Details Component Code

[Code]
<?xml version="1.0" encoding="utf-8"?> 
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> " width="100%"
height="100%">
<mx:TextArea x="109.5" y="224" width="311" 
htmlText="{teams.selectedItem.info}" height="91"
editable="false"/>
<mx:Button x="6" label="&lt;- Back" id="back"
click="currentState=''" bottom="9"/>
<mx:Image x="265" y="10" width="200" height="200"
scaleContent="true" data="{teams.selectedItem.picture}"/>
<mx:Text x="2" y="48" text="Team Number:"
fontFamily="Verdana" fontWeight="bold"/>
<mx:Text x="2" y="74" text="Height / Weight:"
fontFamily="Verdana" fontWeight="bold"/>
<mx:Text x="2" y="100" text="Drivetrain:"
fontFamily="Verdana" fontWeight="bold" width="67"/>
<mx:Text x="2" y="126" text="Autonomous:"
fontFamily="Verdana" fontWeight="bold"/>
<mx:Text x="23.5" y="225" text="Extra Info:"
fontFamily="Verdana" fontWeight="bold"/>
<mx:TextArea x="10" y="10" width="225" 
htmlText="{teams.selectedItem.team_name}" 
height="29" editable="false" fontSize="21" fontWeight="bold"
borderStyle="solid" backgroundAlpha="0.0" color="#000000"/>
<mx:TextArea x="109.5" y="47" width="125.5" 
htmlText="{teams.selectedItem.team_number}" 
height="19" editable="false"/>
<mx:TextArea x="109.5" y="73" width="125.5" 
htmlText="{teams.selectedItem.autonomous}" 
height="19" editable="false"/>
<mx:TextArea x="109.5" y="99" width="125.5" 
htmlText="{teams.selectedItem.drivetrain}" 
height="19" editable="false"/>
<mx:TextArea x="109.5" y="125" width="125.5" 
htmlText="{teams.selectedItem.height_weight}" 
height="19" editable="false"/>

</mx:Canvas>
[/Code]

Now what i am trying to do is get it so that when i click on the
infomation in the main datagrid that i will show it in the custom
component.

Thanks.....

 

Reply via email to