Hi allenyoungsjtu,

When I run your code, this is what I get returned:

<block id="001">
 <point x="0" y="0"/>
 <point x="50" y="0"/>
 <point x="0" y="50"/>
</block>

Is this what you meant by "the <block id='001' /> node"?  If not, could you
please cut and paste in the return value that you would expect given the
value of blockXML.  Or what are you seeing that leads you to conclude "it
turned out that as cannot recognise block as blockXML's property"?

Here is my MXML:

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

   <mx:Script>
       <![CDATA[

       [Bindable]
       private var blockXML:XML =
        <blocks>
          <block id='001'>
            <point x='0' y='0' />
            <point x='50' y='0' />
            <point x='0' y='50' />
          </block>
        </blocks>;

       ]]>
   </mx:Script>

   <mx:TextArea text="{blockXML.block[0]}"
       height="100%"
       width="90%"/>

</mx:Application>

hth,

g

On 3/4/07, allenyoungsjtu <[EMAIL PROTECTED]> wrote:

Hi all,

I want to process some xml documents using actionscript. The document
is something like this:

[code]
private var blockXML:XML =
  <blocks>
    <block id='001'>
      <point x='0' y='0' />
      <point x='50' y='0' />
      <point x='0' y='50' />
    </block>
  </blocks>;
[/code]

I thought I could use the statement as follows:

[code]
blockXML.block[0]
[/code]

to get the <block id='001' /> node, but it turned out that as cannot
recognise block as blockXML's property.

Is there something wrong with my approach? Or I just cannot write it
in this way? Thanks a lot!

Reply via email to