Flex 4.6 creates complex object in Mxml

Source: Internet
Author: User

Create complex object with Mxml as follows

<fx:object id= "Alex"  name= "Alex"  catlog= "Dog" >    <fx:size>         <fx:object length= "55cm"  height= "45cm" >             <fx:detail>                 <fx:object look= "Nice"   Sound= "Wang"  />            </fx:detail >        </fx:Object>    </fx:size> </fx:object><fx:object id= "Hello"  name= "Hello flex"  catlog= "book"  weight= " 0.8kg "&GT;&NBSP;&NBSP;&NBSP;&NBSP;&LT;FX:DETAIL&GT;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&LT;FX: Array>            <fx:object name= " Page1 " content=" { {tiLe1: ' intro ', price:87} } " />             <fx:object name= "Page2"  content= "{{words: ' intro ', Code:12}}"  />             <fx:object name= "Page3"  content= "{[' Keys ', 32,TRUE,{DW: ' sa ', Df:1},{tt: ' SDA ', Ew:false}]} " />        </ Fx:array>    </fx:detail></fx:object>

Create Object using <fx:Object> tags in mxml, simple type attributes can be written directly into attribute, complex attributes, can be written as sub-attributes with

<fx: Attribute name > < namespace prefix: Class name ></namespace prefix: Class name ></fx: Property name >

Format to create a complex object. This format can be nested continuously, creating complex multi-layered nested objects (of course, too complex object, rather than directly in the FX:SCRITPT block with the AS3 definition more intuitive)

If the complex object is an object or an array, it can also be declared with the "{}" Binding expression syntax in attribute, such as an object with the ID hello

The above code has passed the test without error.

Reference: http://blog.flexexamples.com/2010/10/20/creating-complex-data-provider-objects-in-mxml-using-flex-4/

Flex 4.6 creates complex object in Mxml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.