0 Replies Latest reply on Sep 2, 2008 8:28 AM by CBrasfield

    XML Node access via httpservice

    CBrasfield Level 1
      I'm getting a string of errors, and I'm not quite sure why. Code attached.

      [[[[[ MXML FILE ]]]]

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application
      xmlns:mx=" http://www.adobe.com/2006/mxml"
      xmlns:utils="nl.fxc.utils.*"
      xmlns:controls="nl.fxc.controls.*"
      layout="vertical"
      creationComplete="m.send();"
      backgroundColor="#000000"
      backgroundImage="">

      <mx:HTTPService id="m" url="myXML.php"
      showBusyCursor="true" resultFormat="object" result="InitApp(event)" useProxy="false"/>


      <mx:Script>
      <![CDATA[
      import mx.controls.Button;
      import mx.controls.Alert;
      import mx.collections.ArrayCollection;
      import mx.events.ItemClickEvent;
      import mx.rpc.events.*;


      [Bindable]private var orgData:ArrayCollection = new ArrayCollection();
      [Bindable]private var nav:ArrayCollection = new ArrayCollection();
      [Bindable]private var currentPage:Number = 0;
      [Bindable]private var pageSize:uint = 10;
      [Bindable]private var navPage:uint = 1;
      [Bindable]private var navSize:uint = 10;


      private function InitApp(evt:ResultEvent):void{
      var obj:Object = evt.result;
      for( var x:uint = 1; x <= 30; x++ ){
      obj.Id = obj.myArtist.myAlbum[x].myNum;

      orgData.addItem(obj);
      }


      }
      ]]>
      </mx:Script>

      <utils:FXCPager id="fxcPager" pageIndex="{currentPage}" pageSize="{pageSize}" dataProvider="{orgData}" />

      <mx:VBox verticalGap="0">

      <mx:DataGrid id="fxc_dg" dataProvider="{fxcPager.pageData}" width="600"/>

      <mx:VBox horizontalAlign="center" width="{fxc_dg.width}" >

      <controls:FXCPagerBar
      id="fxc_pageNav2"
      pager="{fxcPager}"
      totalPages="{Math.ceil(orgData.length/pageSize)}"
      maxVisiblePages="{navSize}"
      buttonWidth="40"
      buttonMode="true"/>

      <mx:NumericStepper value="{this.pageSize}" change="this.pageSize = event.target.value" maximum="500"/>
      </mx:VBox>

      </mx:VBox>

      </mx:Application>

      [[[[ /// END ]]]]]

      For the dg paging, I'm using: http://labs.flexcoders.nl/samples/Paging/001/srcview/index.html

      I know the httpservice works and I've tested the nodes. However, I'm getting an out of range error in the ListCollection.as of Adobe and errors at the http line and obj.Id line. What I want to do is send a specific node from the generated xml into the obj value. Any ideas??

      Thank you!!