Flash MX 2004新特性實(shí)例(5)_Flash教程
推薦:Flash MX 2004新特性實(shí)例(4)實(shí)例四、DeviceFontMasking一、涉及特性本實(shí)例主要涉及遮照效果的制作和ScrollPane組件的利用,都是一些有趣的特性,跟之前在FlashMX中的制作思路有比較
實(shí)例五、News Reader一、涉及特性
本實(shí)例主要涉及數(shù)據(jù)綁定和組件的編程。數(shù)據(jù)綁定是在Flash MX 2004中才有的新功能,據(jù)稱(chēng)不用編程,只需設(shè)置幾個(gè)組件的屬性,就可以實(shí)現(xiàn)與服務(wù)器端的數(shù)據(jù)交互功能,也算是一大突破了。另外,由于在實(shí)例中沒(méi)有提供相應(yīng)的xml文件,所有字段都要手工輸入,所以本實(shí)例的制作過(guò)程顯得有些繁瑣,請(qǐng)?jiān)谥谱鬟^(guò)程中仔細(xì)檢查每一個(gè)字段。
二、制作過(guò)程
1、從組件面板中拖一個(gè)List組件到場(chǎng)景中,命名為“articles”,設(shè)置“multipleSelection”為false,“rowHight”為20。
2、從組件面板中拖一個(gè)TextArea組件到場(chǎng)景中,命名為“title”,各種參數(shù)設(shè)置不變。
3、從組件面板中拖一個(gè)Label組件到場(chǎng)景中,命名為“author”,設(shè)置“text”為空。
4、從組件面板中拖兩個(gè)TextArea組件到場(chǎng)景中,分別命名為“desc”和“l(fā)ink”,都設(shè)置“text”為空。
5、從組件面板中拖一個(gè)XMLConnector組件到場(chǎng)景中,命名為“feed”,設(shè)置參數(shù)如下:“URL”為“http://www.macromedia.com/go/devnet_rss”,“direction”為receive。
6、用文本工具在場(chǎng)景中輸入幾處文字,此時(shí)的效果如圖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。此時(shí)的Schema面板如圖2所示。
12、選取“feed”組件,選取“Component Inspector”中的Bindings面板,點(diǎn)擊“Add Bindings”按鈕,添加一個(gè)“results.RDF.item”字段,點(diǎn)擊“Bound to”按鈕,在彈出的對(duì)話(huà)框中選取“List”,設(shè)置“formatter”為“Rearrange Field”,設(shè)置“formatter option”為“l(fā)abel='< creator>: < title>'”。
13、同樣在“feed”的Bingdings面板,點(diǎn)擊“Add Bindings”按鈕,添加一個(gè)“results.RDF.item.[n].title”字段,點(diǎn)擊“Bound to”按鈕,在彈出的對(duì)話(huà)框中選取“Text Area< title>”,設(shè)置“Index of item”為articles : selected Index。
14、點(diǎn)擊“Add Bindings”按鈕,添加一個(gè)“results.RDF.item.[n].link”字段,點(diǎn)擊“Bound to”按鈕,在彈出的對(duì)話(huà)框中選取“Text Area< link>”,設(shè)置“Index of item”為articles : selected Index。
15、點(diǎn)擊“Add Bindings”按鈕,添加一個(gè)“results.RDF.item.[n].creator”字段,點(diǎn)擊“Bound to”按鈕,在彈出的對(duì)話(huà)框中選取“Text< author>”,設(shè)置“Index of item”為articles : selected Index。
16、點(diǎn)擊“Add Bindings”按鈕,添加一個(gè)“results.RDF.item.[n].description”字段,點(diǎn)擊“Bound to”按鈕,在彈出的對(duì)話(huà)框中選取“Text Area< desc>”,設(shè)置“Index of item”為articles : selected Index。此時(shí)的Bindings面板如圖3所示。
17、在Time Line中增加一層,命名為Action,在此層的Action面板上增加下面的語(yǔ)句:
/* 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();
上面這些語(yǔ)句是為articles組件增加偵聽(tīng)鼠標(biāo)動(dòng)作的語(yǔ)句,讓feed開(kāi)始通訊。
三、實(shí)際用途
本實(shí)例主要涉及的是數(shù)據(jù)綁定功能,用途相當(dāng)廣泛,主要用來(lái)與服務(wù)器端的數(shù)據(jù)交互。以前相對(duì)繁瑣的編程實(shí)現(xiàn),現(xiàn)在只要設(shè)定幾個(gè)組件的屬性即可實(shí)現(xiàn)相應(yīng)的功能。注重本實(shí)例中只涉及在Flash端的實(shí)現(xiàn),沒(méi)有涉及在服務(wù)器端的實(shí)現(xiàn)。
另外,7-11步可以通過(guò)導(dǎo)入一個(gè)xml文件來(lái)實(shí)現(xiàn),但系統(tǒng)提供的幫助文件中沒(méi)有相應(yīng)的xml文件,只能手工輸入,因此顯得有點(diǎn)復(fù)雜。
分享:Flash MX 2004新特性實(shí)例(3)實(shí)例三、CustomizingContextMenu一、涉及特性這個(gè)實(shí)例反映了FlashMX2004在編程方面的重大改進(jìn)。其中包括了as文件的應(yīng)用,系統(tǒng)的_global.$clipboard變量的
- as中禁用ESC鍵
- AS3.0 圖片變黑白 圖片彩色變黑白代碼
- flash as3.0 跨域的解決辦法
- 模板無(wú)憂(yōu)FLASH透明代碼
- Flash教你制作卡通MM眨眼睛動(dòng)畫(huà)
- Flash從零開(kāi)始學(xué)習(xí)創(chuàng)建單選按鈕
- Flash繪制小龍與花插畫(huà)場(chǎng)景
- Flash程序的測(cè)試方法
- Flash CS4文字顏色緩動(dòng)特效
- 網(wǎng)頁(yè)中演示類(lèi)FLASH動(dòng)畫(huà)制作規(guī)范
- Flash CS3循環(huán)背景的運(yùn)用技巧
- Flash鼠繪技巧教你制作紅綠色的樹(shù)葉
Flash教程Rss訂閱網(wǎng)站制作教程搜索
Flash教程推薦
- flash form 中關(guān)于alert框的應(yīng)用
- 用Flash AS消除位圖鋸齒的實(shí)現(xiàn)方法
- Flash逐幀和補(bǔ)間制作小野人搖滾動(dòng)畫(huà)(1)
- flash內(nèi)置類(lèi)Sound的一個(gè)小問(wèn)題及解決方法
- Flash教程:AS 3.0代碼實(shí)現(xiàn)甲蟲(chóng)跟隨鼠標(biāo)
- Flash制作動(dòng)漫中常用的眨眼效果動(dòng)畫(huà)
- 基礎(chǔ)教程:在Flash中鼠繪線(xiàn)圈頁(yè)面
- Silverlight vs Flash的技術(shù)比較
- Flash MX2004入門(mén)與進(jìn)階實(shí)例——?jiǎng)幼髂_本進(jìn)階(15)
- Flash MX2004入門(mén)與進(jìn)階實(shí)例--動(dòng)畫(huà)基礎(chǔ)(25)
猜你也喜歡看這些
- Flash8全實(shí)例學(xué)習(xí)手冊(cè)原書(shū)配套光盤(pán)
- 中文版Flash CS4標(biāo)準(zhǔn)教程
- 金鷹FlashMX視頻教程
- flash實(shí)例教程-遮罩動(dòng)畫(huà)
- Swift 3D--Flash 第三方軟件 及視頻教程
- Flash 8中文版MV及課件制作基礎(chǔ)培訓(xùn)百例
- 金鷹FLASH CS3活學(xué)活用
- 新東方劍橋商務(wù)英語(yǔ)BEC flash教程 初+中+高 (現(xiàn)已穩(wěn)定供源)
- Flash CS3動(dòng)畫(huà)設(shè)計(jì)入門(mén)提高與技巧(光盤(pán)).
- Adobe Flash CS5新功能視頻教程
- 相關(guān)鏈接:
- 教程說(shuō)明:
Flash教程-Flash MX 2004新特性實(shí)例(5)
。