1 Reply Latest reply on Jul 6, 2006 10:15 AM by ntsiii

    Coulnd not resolve <mx:script> "or" <mx:operation> to a component implementation

    KntLHiyn
      i'm execising flex builder 2's help lessons step by step. i'm coding what the guide tell but i've problem when i use <mx:script> tag or <mx:operation> tag. i couldn't find why it is like that and so i couldn't solve the problem. i'm giving you the 2 codes (first one is with mx:Script, second one is with mx:operation). please help me about what is wrong.

      here is the codes :


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="createListener();">
      <mx:Script>
      <![CDATA[

      public function createListener():void {
      btnConvert.addEventListener(MouseEvent.CLICK, convertCurrency);
      }

      public function convertCurrency(e:Event):void {
      var rate:Number = 120;
      var price:Number = Number(txtPrice.text);
      if (isNaN(price)) {
      lblResults.text = "Please enter a valid price.";
      } else {
      price = price * rate;
      lblResults.text = "Price in Yen: " + String(price);
      }
      }

      ]]>
      </mx:Script>
      <mx:Panel x="20" y="20" width="450" height="150" layout="absolute"
      title="Currency Converter">
      <mx:Label x="25" y="37" text="Price in Dollars"/>
      <mx:Label x="120" y="65" id="lblResults"/>
      <mx:TextInput x="120" y="35" id="txtPrice"/>
      <mx:Button x="290" y="35" label="Convert to Yen" id="btnConvert"/>
      </mx:Panel>
      </mx:Application>
      ----------------------------------------------------------------------------
      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="wsBlogAggr.getMostPopularPosts.send()">
      <mx:WebService id="wsBlogAggr" wsdl=" http://weblogs.macromedia.com/mxna/webservices/mxna2.cfc?wsdl" useProxy="false">
      <mx:operation name="getMostPopularPosts">
      <mx:request>
      <daysBack>30</daysBack>
      <limit>{cbxNumPosts.value}</limit>
      </mx:request>
      </mx:operation>
      </mx:WebService>
      <mx:Panel x="10" y="10" width="475" height="400" layout="absolute" title="Most Popular Posts">
      <mx:ComboBox x="10" y="10" id="cbxNumPosts" change="wsBlogAggr.getMostPopularPosts.send()">
      <mx:Object label="Top 5" data="5"/>
      <mx:Object label="Top 10" data="10"/>
      <mx:Object label="Top 15" data="15"/>
      </mx:ComboBox>
      <mx:DataGrid x="10" y="40" id="dgTopPosts" width="400" dataProvider="{wsBlogAggr.getMostPopularPosts.lastResult}">
      <mx:columns>
      <mx:DataGridColumn headerText="Top Posts" dataField="postTitle"/>
      <mx:DataGridColumn headerText="Clicks" dataField="clicks" width="75" />
      </mx:columns>
      </mx:DataGrid>
      <mx:LinkButton x="10" y="190" label="Select an item and click here for full post"/>
      </mx:Panel>
      </mx:Application>