Flash MX 2004 New features example learning four

Source: Internet
Author: User
Tags date array empty new features
example Five, News Reader

I. Characteristics involved

This example mainly involves data binding and component programming. Data binding is a new feature in Flash MX 2004, it is said that without programming, just set the properties of several components, you can achieve with the server-side data interaction functions, but also a major breakthrough. In addition, because the corresponding XML file is not provided in the instance, all fields have to be entered manually, so the production process of this example is a bit cumbersome, please check each field carefully during the production process.

Second, the production process

1, drag a list component from the palette to the scene, named "Articles", set "Multipleselection" to False, "rowhight" to 20.

2, from the palette to drag a textarea component to the scene, named "title", the various parameters set unchanged.

3, drag a label component from the palette to the scene, named "Author", set "text" is empty.

4, from the palette to drag two textarea components to the scene, respectively named "desc" and "link", all set "text" is empty.

5, from the palette to drag a xmlconnector component to the scene, named "Feed", set the parameters as follows: "URL" for "Http://www.macromedia.com/go/devnet_rss", "direction" For receive.

6, with the text tool in the scene to enter a few text, at this time the effect as shown in Figure 1.

7. Select the Feed component, select the schema panel in Component Inspector, and add the following child fields below the Results field: Field name is Rdf,data type is object,storage Type is complex.

8. Add the following child fields under the RDF field: A, field name is Xmlns,data type is string,storage type is attribute;b, field name is Dc,data type is string, Storage type is attribute;c, field name is Rdf,data type is string,storage type is attribute;d, FieldName is Channel,data Type is object,storage type is complex;e, field name is Item,data type is array,storage type is array.

9, add the following child fields under the Channel field: A, field name is About,data type is string,storage type is attribute;b, field name is Title,data Type is string,storage type is simple;c, field name is Link,data type is string,storage type is simple;d, field name is description, The data type is String,storage type is simple;e, field name is Date,data type is string,storage type is simple;f, field name is language, The data type is String,storage type is simple;g, field name is Items,data type is object,storage type is complex.

10. Add the child fields below the items child fields in the Channel field: Field name is Seq,data type Object,storage type is complex; Add the child fields under the SEQ field: Field name is Li, The data type is array,storage type array, and the field name is added below the Li field: the N],data type is simple int,storage type; Add the child fields below the field: Field name is attribute to Resource,data type String,storage type.

11, back to the RDF field, under the Item field, add the following child fields: field name is [N],data type is object,storage type is complex; Add the following child fields under [n] Fields: A, field Name is About,data type is string,storage type is attribute;b, field name is Title,data type is string,storage type is simple;c, field Name is Link,data type is string,storage type is simple;d, field name is Description,data type is string,storage type is simple;e, Field name is Creator,data type is string,storage type is simple;f, field name is Subject,data type is string,storage type is simple;g, Field name is Date,data type is string,storage type is simple;h, field name is Type,data type is string,storage type is simple. The schema panel at this point is shown in Figure 2.

12, select the "Feed" component, select the "Component Inspector" in the Bindings panel, click the "Add Bindings" button, add a "results." Rdf.item "field, click" Bound to "button, select" List "in the pop-up dialog box, set" formatter "as" rearrange field ", set" formatter option "as" label= "< Creator>: < title> ' ".

13, the same in the "feed" bingdings panel, click the "Add Bindings" button, add a "results." Rdf.item. [N].title field, click the "Bound to" button, in the pop-up dialog box select "Text area< title>", set "index of item" for articles:selected index.

14, click the "Add Bindings" button, add a "results." Rdf.item. [N].link field, click the "Bound to" button, in the pop-up dialog box select "Text area< link>", set "index of item" for articles:selected index.

15, click the "Add Bindings" button, add a "results." Rdf.item. [N].creator field, click the "Bound to" button, in the pop-up dialog box select "text< author>", set "index of item" for articles:selected index.

16, click the "Add Bindings" button, add a "results." Rdf.item. [N].description field, click the "Bound to" button, in the pop-up dialog box select "Text area< desc>", set "index of item" for articles:selected index. The bindings panel at this point is shown in Figure 3.

17, add a layer in time line, named action, add the following statement to the action panel on this layer:

/* Copyright 2003 Macromedia, Inc. All rights reserved.

The following is Sample Code and are subject to all restrictions

On such code as contained in the end User License agreement

Accompanying this product.

*/

function bindingexecuted () {

Articles.selectedindex = 0;

Articles.refreshdestinations ();

}

Articles.addeventlistener ("bindingexecuted", this);

Feed.trigger ();

The above statements are statements that increase the listener's mouse action for the articles component, allowing the feed to start communicating.

Iii. Practical uses

This example mainly involves the data binding function, the use is quite extensive, mainly uses in the server side data interaction. Before the relatively cumbersome programming implementation, now just set a few components of the properties can achieve the corresponding functions. Note that this example only involves implementation in the Flash end, not on the server side of the implementation.

In addition, the 7-11 steps can be implemented by importing an XML file, but there is no corresponding XML file in the Help file provided by the system, which can only be entered manually, so it is somewhat complicated.



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.