Monday, September 27, 2010

Flash5 ActionScript Advanced Programming Guide (8)


Third, the use of custom functions

Third, understanding: the essence of the object structure. This is already mentioned in section I passed, but made no specific explanation. Familiar with object-oriented language friends all know that the object is in the class of pre-defined, and is scheduled to die, can not be changed. However, as 3.1-style as, FAS method of the object as if it was strong from the outside added to object to, and use the assignment form, and the function body must be able to access the object through this subject.鐜板湪锛屽鏋滄垜浠妸FAS涓殑瀵硅薄姒傚康鐞嗚В涓篊璇█涓殑缁撴瀯浣擄紝鑰屾妸瀵硅薄鏂规硶鐞嗚В涓虹粨鏋勪綋涓殑鍑芥暟鎸囬拡鍙橀噺锛屽啀鏉ョ湅鐪?.1寮忥紝鏄笉鏄氨鍙戠幇鍘熸潵鎵?皳鐨勫畾涔夋柟娉曞彧涓嶈繃鏄湪缁欏嚱鏁版寚閽堝彉閲忚祴鍊肩舰浜嗐?鍐嶈仈鎯充竴涓嬶紝鏄笉鏄張鍙戠幇鍏跺疄涓嶇敤浠?箞鏃犲悕鍑芥暟锛屼笉鐢ㄤ粈涔?prototype涔熷彲浠ヤ竴鏍峰畾涔夊璞℃柟娉曠殑锛?br />銆??function myMethod() {
銆??銆??return 1;
)
銆??function myObject() {
this.method = myMethod;
)
銆??myobj = new myObject; // 3.2寮?br />銆??trace(myobj.method()); // 杈撳嚭 1
涓嶈繃鏈変竴鐐规槸鐗规畩鐨勶紝FAS閲岀殑瀵硅薄鍙互闅忔椂浠绘剰娣诲姞鎴愬憳銆傚叾瀹炶鐧戒簡鎵?皳鏋勯?鍑芥暟灏辨槸鍦ㄤ负涓?釜宸插畾涔夊ソ鐨勫璞℃坊鍔犳垚鍛樿?宸层?杩欎篃灏辨槸璇磋薄涓婇潰杩欐绋嬪簭鎴戜滑鍙互杩炴瀯閫犲嚱鏁颁篃鐪佷簡锛?br />銆??function myMethod() {
銆??銆??return 1;
)
銆??myobj = new Object; // 3.3寮?br />銆??myobj.method = myMethod;
銆??trace(myobj.method());
涓嶈繃鍦ㄤ负瀵硅薄娣诲姞鎴愬憳鏃跺繀椤昏淇濊瘉瀹冨凡缁忓叿鏈変簡瀵硅薄鐨勭被鍨嬶紝濡備笂3.3寮忔槸涓嶈兘鐪佺暐鐨勩?褰撶劧锛屾垜浠湪鏋勯?鍑芥暟閲岄櫎浜嗕负瀵硅薄娣诲姞鎴愬憳澶栬繕鍙互瀵规垚鍛樿祴鍒濆?鍜屽姞鍏ュ叾浠栫殑鎿嶄綔锛屽湪鏋勯?瀵硅薄鏃惰嚜鍔ㄦ墽琛屻?浠庤繖涓?剰涔変笂璁诧紝瀹氫箟涓?釜鏋勯?鍑芥暟杩樻槸鏈夌敤鐨勩?






相关链接:



Evaluation Management And Distribution



Web Development COMPARISON



Specialist Puzzle And Word Games



H.264 to AVI



DIFFERENT opinions



FLV to iPod



Top FTP CLIENTS



Teach you how to make bubble drift



Semiconductor India vied with NEW Deal



The founding of sailing



MTS To MP4



Oracle 39 s legacy the beginning from ibm



Overcome Stage Fright Interview The 10 Candidates Recruited Nirvana



CEO Online: Yan Huang star CEO Chang on August 15 guest Sina



Production of glass filter with Layer Style button (1)



Process