Skip to content

Array - sortOn fails for XML data #1203

@yishayw

Description

@yishayw

In this app

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                applicationComplete="init()"
                width="100%"
                height="100%"
                xmlns:s="library://ns.apache.org/royale/spark"
                xmlns:mx="library://ns.apache.org/royale/mx">
                
     <fx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;
            private function init():void
            {
                var arr:Array = [<node label="b"/>, <node label="a"/>];
                arr.sortOn(["@label"]);
                trace(((arr[0] as XML).@label).toString());
            }
        ]]>
    </fx:Script>
</mx:Application>

I would expect the trace output to be 'a' (as it is in Flex), but instead it is 'b'.

Apparently flash player knows how to parse XML and can sort an array of XML objects, but Language.as does assumes the objects are simple and does not read @label correctly.

As, in Royale, XML is a separate library the question is whether Language.as where this sortOn function is location, is, or even should be, made aware of XML objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions