Your example looks correct.  You can access
Application.application.parameters from a component.

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of CO_China_Girl
Sent: Monday, October 01, 2007 4:12 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Passing Application.application.parameters to a
Flex component



I'm working on a Flex application that has a tab navigator component.
To prevent my main MXML file from becoming huge I decided to make
each tab "page" a separate component. The problem I have now is that
one of my Flex components need to have access to
Application.application.parameters. How do I pass this information to
my component, or how do I make this information available to my
component?

===== Main MXML file =====

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
xmlns:pf2="*" layout="horizontal">
<mx:Canvas width="95%" height="95%">
<mx:TabNavigator x="10" y="10" width="100%" height="100%">
<pf2:tab1/>
<pf2:tab2/>
</mx:TabNavigator>
</mx:Canvas>
</mx:Application>

===== Component file =====
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
label="Properties" width="100%" height="100%">
<mx:Script>
<![CDATA[

[Bindable]
private var service:PropertyService;

private function init():void {
service = new
PropertyService(Application.application.parameters.psAddr);
service.makeInitialRequest();
addEventListener(DataChangedEvent.DATA_CHANGED, doneEdit);
}

]]>
</mx:Script>

<mx:Panel id="panel" label="Properties" width="100%" height="100%"
creationComplete="init()">

<!-- Layout code -->

</mx:Panel>
</mx:Canvas>

==========

Thanks.



 

Reply via email to