學(xué)習(xí)AS3:唯一的類變量_Flash教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:學(xué)習(xí)AS3:*新的變量類型AS3中有許多新的數(shù)據(jù)類型。其中有些類型是以前沒有出現(xiàn)的。AS3中的基本數(shù)據(jù)類型如下:簡單數(shù)據(jù)類型:BooleanintnullNumberStringuintundefined
(本文非直接翻譯,原文如下:)In ActionScript 2, variables defined within a class's body were defined in the class's prototype object. This was an efficient means to handle variable definitions but it also meant that complex data types (such as Arrays) had a tendency to be "shared" among instances if not explicitly defined for instances within the class constructor. This is no longer a problem with ActionScript 3. Class variables defined in the class body are now unique to each class instance so this problem no longer occurs.
在AS2中,復(fù)雜數(shù)據(jù)類型(比如數(shù)組),假如在類體之中,方法之外直接初始化,而不在構(gòu)造器中初始化,會(huì)被理解為“共享”的數(shù)據(jù),而被所有的實(shí)例共享使用(類似于static的效果)。但是在AS3中不存在這個(gè)問題。類變量是每個(gè)實(shí)例獨(dú)有的,唯一的變量。如下:
class myClass{
private var list:Array = [1,2,3]; //在AS2中會(huì)有一定問題,AS3中就很好
public function myClass(){
//在AS2中,應(yīng)該在這里初始化list
}
}
分享:學(xué)習(xí)做FLASH留言本:分頁技術(shù)這次是做留言板分頁ASASPACCESS,傳遞一個(gè)id,一個(gè)標(biāo)題title,作者author三種數(shù)據(jù),那么就定義一個(gè)allId,AllTitle,allAuthor,然后循環(huán)讀取數(shù)據(jù)庫把所有數(shù)據(jù)
/所屬分類:Flash教程/更新時(shí)間:2008-03-05
相關(guān)Flash教程:
Flash教程Rss訂閱網(wǎng)站制作教程搜索
Flash教程推薦
猜你也喜歡看這些
- 新東方王強(qiáng)口語Flash網(wǎng)絡(luò)課程第一、二冊
- flash運(yùn)動(dòng)規(guī)律與動(dòng)作實(shí)現(xiàn)
- 中科院新科海Flash培訓(xùn)視頻
- 課件\flash的多媒體教程
- 2008新東方趙麗詞匯5500(FLASH版)完全版
- Adobe Flash CS4 新增功能教程(中文視頻)更新完畢
- 北風(fēng)網(wǎng)web講師李炎恢老師網(wǎng)頁三劍客之flash從入門到精通59課時(shí)|已完結(jié)
- Flash 8完美動(dòng)畫設(shè)計(jì)與制作
- Flash as3.0視頻教程之聲音編程
- Flash CS4中文版入門與提高
- 相關(guān)鏈接:
- 教程說明:
Flash教程-學(xué)習(xí)AS3:唯一的類變量
。