This may be for Harbs as I think he did a lot of the work for XML.

 

I am working on some existing Flex code and trying to convert portions of it
to FlexJS.  As part of the application it loads a lot of XML files and uses
E4X to parse them.  I was able to get this working quickly in swf format, so
that was awesome!

 

However, I am having a problem with the hasOwnProperty method.  It works
fine running in swf format, but when I export to HTML/JS the Javascript
bombs on the hasOwnProperty method calls.  If I remove them the code
executes as it should.

 

I checked here
(https://cwiki.apache.org/confluence/display/FLEX/E4X+Observations) and it
seems like they should be working but I wanted to check if I am doing
something I should not.

 

 

Typically these checks look like this in AS:

 

if (resourceXML.hasOwnProperty("@collapsible") == true){

globalCollapsible = toBoolean(resourceXML.@collapsible);

}else{

      _globalCollapsible = false;

}

 

And look like this in the JS (the last alert I message I see is the
'checking global property'):

 

  alert('TextViewer checking global property');

  if (resourceXML.hasOwnProperty("@collapsible") == true) {

                alert('TextViewer.init found global property');

    this._globalCollapsible =
this.toBoolean(resourceXML.attribute('collapsible'));

  } else {

                alert('TextViewer.init global property not found');

    this._globalCollapsible = false;

  }

 

 

I have a ton of these types of checks in my code so any insight you may have
into either 1) what is wrong, or 2) what I should do instead would be a lot
of help.

 

 

Thanks,

 

Jim

Reply via email to