4 Replies Latest reply on Apr 14, 2011 2:15 PM by cmcgrud

    Trying to use actionscript to pull a click url from an XMLList node and call navigateToURL

    cmcgrud

      Admission: I'm a greenhorn to Flex and can't figure out what I'm doing wrong here. Please help!

      =-=-=-=-=-=-=-=-=-=-=-=-=-=-=

       

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

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="610" minHeight="410">

       

       

      <mx:Script>

           <![CDATA[

                var url:String = "http://www.google.com/";

                var request:URLRequest = new URLRequest(url);

                try {

                     navigateToURL(request, '_blank'); // second argument is target

                } catch (e:Error) {

                     trace("Error occurred!");

                }

           ]]>

      </mx:Script>

       

           <mx:Accordion x="10" y="10" width="600" height="400">

                <mx:Canvas label="Accordion Pane 1" width="100%" height="100%">

       

                         <mx:Tree x="10" y="10" width="302" height="305">

                               <mx:XMLListCollection>

                                    <mx:XMLList>

                                         <menuitem label="Google" >

                                              <menuitem label="Google News" click="navigateToURL(new URLRequest('news')"/>

                                              <menuitem label="Google Finance" click="navigateToURL(new URLRequest('finance')"/>

                                         </menuitem>

                                    </mx:XMLList>

                               </mx:XMLListCollection>

                          </mx:Tree>

       

                </mx:Canvas>

       

                <mx:Canvas label="Accordion Pane 2" width="100%" height="100%">

                </mx:Canvas>

       

                <mx:Canvas label="Accordion Pane 3" width="100%" height="100%">

                </mx:Canvas>

       

           </mx:Accordion>

      </mx:Application>