从AS2到AS3“它去了哪里”setRGB |[mck]
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从AS2到AS3“它去了哪里”setRGB |[mck]相关的知识,希望对你有一定的参考价值。
I really like the use of constants and the dollar sign ($) in this class. I have only used $ in jQuery to designate objects. Looks like one might use $ in AS3 classes to designate/differentiate passed-in variables from internal method/global vars.
/** * Color (AS3), version 1.0 * * Enter description here * * <pre> * ____ _ ____ * | __| _ __ ___ ___ | | __ |__ | * | | | '_ ` _ / __|| |/ / | | * | | | | | | | || (__ | < | | * | |__ |_| |_| |_| \___||_|\_ __| | * |____| |____| * * </pre> * * @class : Color * @author : Matthijs C. Kamstra [mck] * @version : 1.0 - class creation (AS3) * @since : 11-5-2008 0:22 * */ package nl.matthijskamstra.utils { import flash.display.*; import flash.events.*; import flash.geom.ColorTransform; public class Color { // Constants: public static var CLASS_REF = nl.matthijskamstra.utils.Color; public static var CLASS_NAME : String = "Color"; public static var LINKAGE_ID : String = "nl.matthijskamstra.utils.Color"; /** * Constructor * * @usage import nl.matthijskamstra.utils.Color; // import * var __Color:Color = new Color ( this ); * @param $targetObj a reference to a movie clip or object */ public function Color( $targetObj:DisplayObject=null, $colorValue:uint = 0xff3333) { // trace ( LINKAGE_ID + ' class instantiated'); if ($targetObj == null) { return; } var newColorTransform:ColorTransform = $targetObj.transform.colorTransform; newColorTransform.color = $colorValue; $targetObj.transform.colorTransform = newColorTransform; } //////////////////////////////////////// Static /////////////////////////////////////// static public function setRGB( $targetObj:DisplayObject = null, $colorValue:uint = 0xff3333) { return new Color ( $targetObj, $colorValue); } } // end class } // end package
以上是关于从AS2到AS3“它去了哪里”setRGB |[mck]的主要内容,如果未能解决你的问题,请参考以下文章