Sử dụng Class màu Để sử dụng một đối tượng màu, trước tiên bạn phải tạo nó bằng cách sử dụng constructor lớp màu. Đây là cú pháp để tạo một đối tượng màu mới: var myColor: Color = new Color (shirt_mc); Kịch bản này tạo ra một trường hợp mới của lớp màu được đặt tên myColor và các cộng nó với một ví dụ movie clip đặt tên shirt_mc. | Using the Color Class To use a Color object you must first create it using the Color class constructor. Here s the syntax for creating a new Color object var myColor Color new Color shirt_mc The script creates a new instance of the Color class named myColor and associates it with a movie clip instance named shirt_mc. You can create the object anywhere. The constructor accepts one parameter the path to the movie clip it should modify. If you want to create a Color object with ActionScript from within a movie clip that will reference itself you would use this as the path. For example this script var myColor Color new Color this creates a new instance of the Color object on the movie clip instance that contains this script. NOTE As with any class instance you can create many instances of the Color class in a single project and associate them with various timelines providing you with dynamic control over the color of many instances simultaneously. The most common Color object method is setRGB which changes the color of the movie clip instance specified as the parameter when the object was created. Here s an example of one use of setRGB var myColor Color new Color shirt_mc 0xFF3300 The script creates a new Color object named myColor and then uses the setRGB method to change the color of the shirt_mc movie clip instance to red. This method accepts a parameter 0x followed by the hex value for a color. The 0x parameter is a reserved character combination that tells Flash that a hexadecimal number follows. The number system we re accustomed to using is called base 10 which means 10 numbers are used for all values 0 through 9 . In other words all other numbers 28 6 403 496 300 439 and so on can be described using a combination of these 10. Hexadecimal numbers in contrast are base 16 which means their values are expressed using numbers and letters 0 through 9 and A through F. Using this method you can create hexadecimal values of 00 to FF with 00 being a base .