Hi evryone,

I'm trying to display a linkButton in a flex application for wich the displayed 
text and the link are loaded from an external xml file. 
I can't get the link to be passed at my function. here is the code :

I get a {extLinkURL} in my alert box. Something must be wrong with the quotes.

any ideas?

Thanks,
Vincent

<?xml version="1.0" encoding="utf-8"?>

    <mx:Script>
        <![CDATA[
            import flash.net.navigateToURL;
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
            
            private var myXMLList:XMLList;
            
            [Bindable]
            private var extLink:String;
            
            [Bindable]
            private var extLinkURL:String;
            
            private function init():void
            {
                fiche2Service.send();
            }
            
            private function resultHandler(event:ResultEvent):void
            {
                myXMLList = event.result..fiche;
                extLink = myXMLList.lienexterne.intitule;
                extLinkURL = myXMLList.lienexterne.lien;    
            }
            
            private function loadXternalURL(theURL:String):void
            {
                Alert.show("theURL "+theURL);
                var urlReq:URLRequest = new URLRequest(theURL);
                navigateToURL(urlReq,"_blank");
            }
        ]]>
    </mx:Script>
    
    <mx:HTTPService id="fiche2Service" url="xmlfile.xml" resultFormat="e4x" 
result="resultHandler(event)"/>
    <mx:VBox left="20" top="20">
        <mx:LinkButton label="{extLink}" click="loadXternalURL('{extLinkURL}')" 
id="LinkBtn2" />
    </mx:VBox> 
</mx:Canvas>


and the xml :

<?xml version="1.0" encoding="UTF-8"?>
<fiche2>
    <fiche>
        <titre><![CDATA[Title?]]></titre>
        <texte><![CDATA[o bolo bolo bolo bolo bolo bolo bolo bolo ]]></texte>
        <lieninterne>
            <intitule><![CDATA[>> Lire la suite]]></intitule>
            <lien></lien>
        </lieninterne>
        <lienexterne>
            <intitule><![CDATA[>> external link text to display]]></intitule>
            
        </lienexterne>
    </fiche>
</fiche2>




      
_____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
http://mail.yahoo.fr

Reply via email to