aharui commented on issue #977:
URL: https://github.com/apache/royale-asjs/issues/977#issuecomment-737583397


   In Flash, when it is time to execute obj[prop], the runtime figures out the 
type of the object and makes the correct access (for XML, call the .property() 
or .attribute(), for Proxy, call getProperty() or callProperty()).
   
   There is no such support in Royale for JS targets.  Royale could have output 
some general property access code but that would slow everything down, so for 
now (and maybe forever) folks have to strongly-type access to types that 
require special access.
   
   So, if you have an ICollectionView, you could test if it is a 
ListCollectionView and then cast/coerce it and then the compiler should 
generate the getProperty
   
   ```
   var myICollectionView:ICollectionView;
   if (myICollectionView is ListCollectionView) 
   {
       var myListCollectionView = myICollectionView as ListCollectionView;
       trace(myListCollectionView[0]);
   }
   ```
   
   RoyaleArrayLike lets you do that for the more general case where things are 
not Proxy or XML, but as you say, if you are not sure of the concrete type you 
might get an error and probably should do a type-check anyway.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to