[
https://issues.apache.org/jira/browse/FLEX-35070?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15235361#comment-15235361
]
Alex Harui commented on FLEX-35070:
-----------------------------------
If I'm reading the code correctly (I didn't put through the compiler), the code
is trying to iterate over the "list" variable which is of type '*'. This is
one of the caveats about E4X in JS. Without runtime support, we have to have
stricter type information at compile time in order to generate enough magic to
make it work; in this case, by replacing the standard for-each pattern with a
call to elementNames because we can tell at compile time that the variable is
of type XMLList.
So, you might have to "convert" list via:
var xmlList:XMLList = list;
for each (item in xmlList)
In theory you can "cast" as well, but I haven't tested it in the compiler.
for each (item in XMLList(list))
or
for each (item in (list as XMLList))
> "for each" not working in XMLList
> ---------------------------------
>
> Key: FLEX-35070
> URL: https://issues.apache.org/jira/browse/FLEX-35070
> Project: Apache Flex
> Issue Type: Bug
> Components: FalconJX
> Affects Versions: Apache FalconJX 0.6.0
> Reporter: Harbs
>
> I don't have a full test case right now, but I believe the following will
> fail.
> var newList:XMLList = new XMLList();
> newList.appendChild(<foo/>);
> var xmlItem:XML;
> for each(xmlItem in oldList)
> newList.appendChild(xmlItem);
> If necessary, I can put together a (non)working test case.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)