6 Replies Latest reply on Jan 21, 2010 6:53 AM by invisibleBlade

    e4x - Variable is not defined

    invisibleBlade Level 1

      Hi all,

      I built an AIR app to store the contact info everyon in my office. The data comes from an XML file and it was all working until I started tinkering and broke it. To trace the problem I built a 20 line test app but still cant get it to work.

       

      I have an xml file with the following structure (it has about 100 contact nodes):

      <contactSheet>
         <contact>
            <firstName>Joe</firstName>
            <secondName>Bloggs</secondName>
            <country>UK</country>
            <office>Office Towers</office>
            <extension>000</extension>
            <directDial>000 000 000</directDial>
            <email>@work.com</email>
            <mobile>0123456789</mobile>
         </contact>

      </contactSheet>

       

      In my app I have an HTTPService with a result type of 'e4x'. On creationComplete I send this service and the result is processed by a method that sets up a var called contactData:

      contactData = new XML(e.target.lastResult);

       

      If I then trace contactData..contact or contactData..contact.country I get the results I would expect but then I try to trace only the contacts from a certain country using contactData..contact.(country == "UK") and I get an error saying Error #1065: Variable country is not defined.

       

      I am sure that I have had this working before and there is nothing else happening in the build to break it so I am puzzled.

      Any suggestions gratefully accepted.

       

      Cheer