Hi, all, I’m new to the list and to Flex, but a long-time Flash-er.  I’ve been lurking a couple of days and finally noticed a question I might actually be able to help out on!

 

I think if you bind the url attribute to an object’s property, instead of a function, you may have more success.  At this point, it doesn’t know when to fire the getLanguage() function.  If it is bound to an object’s property, which you could update on button presses, etc., it would be able to “watch” that property and call the service when it changes.  I’m fairly new to Flex, so I won’t guarantee it’ll work, but that method works with other objects (data grids, charts, etc.)

 

Tracy’s solution should work too (although, I’ve never done it myself), and you’ll have to set the property on an event, i.e.:

 

<Button id=”myButton” click=”loadXML();” />

 

 

function loadXML() {

   // …

   // set your url string here

   // …

   my_service.url = "">

}

 

 

/******************************************
* Jeff Beeman
******************************************/


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt
Sent: Thursday, April 28, 2005 10:05 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] HTTPService and dynamic url

 

Have you tried setting it programmatically instead of binding?

Tracy

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of david_gal-reyniez
Sent: Thursday, April 28, 2005 12:09 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] HTTPService and dynamic url

 

Hello everyone!

 

My problem is the following:

I try to affect dynamically the url of my HTTPService component. But even if the value of the url that I generate is good, the url property of my HTTPService is not affected.

I'm interested by any kind of suggestions. Thanks for your help!

 

Special thanks to Abdul for the link he mentioned concerning the multi-language feature and for Manish for his article...

 

 

****************

The function which initialize my HTTPService call

 

<mx:Application width="100%" height="100%" xmlns:mx="http://www.macromedia.com/2003/mxml" initialize="initAppli()">

 

public function initAppli() {
    srvLocaleService.send();


}***************

Script defining the HTTService in my Application

 

It works correctly

<mx:HTTPService id="srvLocaleService" url="" result="resultHandler_H1_R(event.result)" fault="resultHandler_H1_F(event.fault)" />
<mx:Model id="locale">
 { srvLocaleService.result.strings }
</mx:Model>

 

But this one not

<mx:HTTPService id="srvLocaleService" url="" getLanguage() }" result="resultHandler_H1_R(event.result)" fault="resultHandler_H1_F(event.fault)" />
<mx:Model id="locale">
    { srvLocaleService.result.strings }
</mx:Model>

 

****************

Script defining the language I desired

 

public function getLanguage():String {
    var item:Object = accUSA.cbLstLanguages.selectedItem; // The selected language come from one ComboBox
    var itemLabel:String = item.toString();
    language = "xml/lg_"+itemLabel+".xml";
    return language;
  }

 

 

***************

The xml I call to define the button's label I want

 

<?xml version="1.0" encoding="iso-8859-1"?>
<strings>
 <btnFindLabel>find</btnFindLabel>
</strings>

 

 

***************

The code I use to affect the label of the concerned button

 

<mx:Button styleName="btn" label="{ locale.btnFindLabel }">

 

Bye

David

*********************************************************************************

Coface facilite les echanges entre les entreprises partout dans le monde. Pour cela, elle offre a toutes les entreprises des solutions pour gerer, financer et proteger leur poste client, en leur permettant d'externaliser tout ou partie de la gestion et des risques lies a leurs relations commerciales. Coface est notee AA par Fitch Ratings et Aa3 par Moody's.

Pour en savoir plus, http://www.coface.fr

Coface facilitates business-to-business commerce worldwide. It offers all size companies an array of solutions to manage, finance, and protect their accounts receivables affording them the option of fully or partly outsourcing trade relationship management and attendant risks. Coface is rated AA by Fitch ratings and Aa3 by Moody's.

More about Coface, http://www.coface.com

WARNING :

- Soyez conscient que notre systeme Anti-Spam peut parfois rejeter des messages, soit parce que certains mots et types de fichiers ne sont pas acceptes, ou bien parce que le mail n'a pas ete identifie correctement.

- Be aware that from time to time our Anti-Spam system may reject mails either because some words and types of files are not allowed or because mails are misidentified.

*********************************************************************************

 



Yahoo! Groups Links

Reply via email to