1 Reply Latest reply on Aug 4, 2007 9:37 AM by John_Fact

    HTTPservice

    John_Fact
      Hello,

      I have this message in the problems box. I could not figure out the problem. I was following Sho Kuwamoto's photo search example.

      1119: Access of possibly undefined property result through a reference with static type mx.rpc.http.mxml:HTTPService.

      Here is the code.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:HTTPService id="service" url=" http://www.flickr.com/services/rest/?method=flickr.photos.search&amp;api_key=a7c643c2f86d8 baf1b511868f24e58d0&amp;per_pate=9&amp;tags={input.text}"/>
      <mx:states>
      <mx:State name="results">
      <mx:SetProperty target="{panel1}" name="width" value="100%"/>
      <mx:SetProperty target="{panel1}" name="x"/>
      <mx:SetStyle target="{panel1}" name="horizontalCenter" value="0"/>
      <mx:SetProperty target="{panel1}" name="y"/>
      <mx:SetStyle target="{panel1}" name="verticalCenter" value="0"/>
      <mx:SetProperty target="{panel1}" name="height" value="100%"/>
      <mx:AddChild relativeTo="{canvas1}" position="lastChild">
      <mx:TileList dataProvider="{service.result.rsp.photos.photo}" width="619" height="314" horizontalCenter="0" verticalCenter="14"></mx:TileList>
      </mx:AddChild>
      </mx:State>
      </mx:states>
      <mx:Panel x="147" y="10" width="338" height="82" layout="absolute" title="Photos" id="panel1" resizeEffect="Resize">
      <mx:Canvas height="100%" width="100%" id="canvas1">
      <mx:Label x="25" y="10" text="Tags"/>
      <mx:TextInput x="65" y="8" id="input"/>
      <mx:Button x="253.5" y="8" label="Find" click="currentState='results'; service.send()"/>
      </mx:Canvas>
      </mx:Panel>

      </mx:Application>

      Thank you.
        • 1. HTTPservice
          John_Fact Level 1
          I found a way to fix this. In dataProvider, use "lastResult" instead "result" so, like this:
          <mx:TileList dataProvider="{service.lastResult.rsp.photos.photo}" itemRenderer="thumnail"></mx:TileList>

          Also, listItemRenderer is not existing anymore, use "itemRenderer"