大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 网络媒体 -> FLASH -> Flash MX 2004新特性实例学习四

Flash MX 2004新特性实例学习四

时间: 2021-07-31 作者:daque

    范例五、news reader

  一、波及个性

  本范例重要波及数据绑定和组件的编制程序。数据绑定是在flash mx 2004中才有的新功效,据称不必编制程序,只需树立几个组件的属性,就不妨实行与效劳器端的数据交互功效,也算是第一次全国代表大会冲破了。其余,因为在范例中没有供给相映的xml文献,一切字段都要细工输出,以是本范例的创造进程显得有些烦琐,请在创造进程中提防查看每一个字段。

  二、创造进程

  1、从组件面板中拖一个list组件加入景中,定名为“articles”,树立“multipleselection”为false,“rowhight”为20。

  2、从组件面板中拖一个textarea组件加入景中,定名为“title”,百般参数树立静止。

  3、从组件面板中拖一个label组件加入景中,定名为“author”,树立“text”为空。

  4、从组件面板中拖两个textarea组件加入景中,辨别定名为“desc”和“link”,都树立“text”为空。

  5、从组件面板中拖一个xmlconnector组件加入景中,定名为“feed”,树立参数如次:“url”为“http://www.macromedia.com/go/devnet_rss”,“direction”为receive。

  6、用文本东西在场景中输出几处笔墨,此时的功效如图1所示。

  7、采用“feed”组件,采用“component inspector”中的schema面板,在results字段底下减少如次的子字段:field name为rdf,data type为object,storage type为complex。

  8、在rdf字段底下减少如次的子字段:a、field name为xmlns,data type为string,storage type为attribute;b、field name为dc,data type为string,storage type为attribute;c、field name为rdf,data type为string,storage type为attribute;d、fieldname为channel,data type为object,storage type为complex;e、field name为item,data type为array,storage type为array。

  9、在channel字段底下减少如次的子字段:a、field name为about,data type为string,storage type为attribute;b、field name为title,data type为string,storage type为simple;c、field name为link,data type为string,storage type为simple;d、field name为description,data type为string,storage type为simple;e、field name为date,data type为string,storage type为simple;f、field name为language,data type为string,storage type为simple;g、field name为items,data type为object,storage type为complex。

  10、在channel字段的items子字段底下减少子字段:field name为seq,data type为object,storage type为complex;在seq字段底下减少子字段:field name为li,data type为array,storage type为array;在li字段底下减少子字段:field name为[n],data type为int,storage type为simple;在[n]字段底下减少子字段:field name为resource,data type为string,storage type为attribute。

  11、回到rdf字段底下,在item字段底下减少如次子字段:field name为[n],data type为object,storage type为complex;在[n]字段底下减少如次的子字段:a、field name为about,data type为string,storage type为attribute;b、field name为title,data type为string,storage type为simple;c、field name为link,data type为string,storage type为simple;d、field name为description,data type为string,storage type为simple;e、field name为creator,data type为string,storage type为simple;f、field name为subject,data type为string,storage type为simple;g、field name为date,data type为string,storage type为simple;h、field name为type,data type为string,storage type为simple。此时的schema面板如图2所示。

  12、采用“feed”组件,采用“component inspector”中的bindings面板,点击“add bindings”按钮,增添一个“results.rdf.item”字段,点击“bound to”按钮,在弹出的对话框中采用“list”,树立“formatter”为“rearrange field”,树立“formatter option”为“label='< creator>: < title>'”。

  13、同样在“feed”的bingdings面板,点击“add bindings”按钮,增添一个“results.rdf.item.[n].title”字段,点击“bound to”按钮,在弹出的对话框中采用“text area< title>”,树立“index of item”为articles : selected index。

  14、点击“add bindings”按钮,增添一个“results.rdf.item.[n].link”字段,点击“bound to”按钮,在弹出的对话框中采用“text area< link>”,树立“index of item”为articles : selected index。

  15、点击“add bindings”按钮,增添一个“results.rdf.item.[n].creator”字段,点击“bound to”按钮,在弹出的对话框中采用“text< author>”,树立“index of item”为articles : selected index。

  16、点击“add bindings”按钮,增添一个“results.rdf.item.[n].description”字段,点击“bound to”按钮,在弹出的对话框中采用“text area< desc>”,树立“index of item”为articles : selected index。此时的bindings面板如图3所示。

  17、在time line中减少一层,定名为action,在此层的action面板上减少底下的语句:   

  /* copyright 2003 macromedia, inc. all rights reserved.

  the following is sample code and is 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();

  上头那些语句是为articles组件减少侦听鼠标举措的语句,让feed发端通信。

  三、本质用处

  本范例重要波及的是数据绑定功效,用处十分普遍,重要用来与效劳器端的数据交互。往日对立烦琐的编制程序实行,此刻只有设定几个组件的属性即可实行相映的功效。提防本范例中只波及在flash端的实行,没有波及在效劳器端的实行。

  其余,7-11步不妨经过导出一个xml文献来实行,但体例供给的扶助文献中没有相映的xml文献,只高手工输出,所以显得有点搀杂。

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.