Apr
13
2011

Flex object vs AS3 object

The object in Flex 4 is defined with <fx:Object/>, and the object in AS3 is defined with new Object() or {}. They are essentially the same, but there are slightly differences between them.

1. In Flex 4, if the object property value includes left angle quote, double quotes or &, you must use their corresponding XML character entities, such as &quot; for double quotes; In AS3, you can use these special characters directly;

2. In the Flex 4, the object property value will ignored escape character, such as \ n, \ t; In AS3, these escape characters have special meanings.

3. In Flex 4, if the attribute value is a hexadecimal  color or ends with number+ d (D), it will be automatically converted to the corresponding numbers; In AS3, there is no such kind of issues. I didn’t find this until last week. See the following code:

<s:ButtonBar>
    <s:ArrayList>
        <fx:Object label="5D" value="5d"/>
        <fx:Object label="#99D" value="#99d"/>
    </s:ArrayList>
</s:ButtonBar>

You will find, both button labels on the button bar have been automatically converted to the corresponding numbers, which is not what we want. So if you meet some issues using Flex Object, please use AS3 Object instead.

原文:http://www.riafan.com/article/as/flex-object-vs-as3-object.html

Add comment




  Country flag
biuquote
  • Comment
  • Preview
Loading


Month List