Chapter 10 Example 1
♥0 |
Line 14 |
Modified 2009-06-09 02:35:44 |
MIT License
archived:2017-03-10 21:57:34
ActionScript3 source code
/**
* Copyright actionscriptbible ( http://wonderfl.net/user/actionscriptbible )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/hRo2
*/
package {
import com.actionscriptbible.Example;
public class ch10ex1 extends Example {
public function ch10ex1() {
var shape:Object = new Object();
shape.name = "hexagon";
shape.sides = 6;
shape["color"] = 0x00ff00;
shape["stroke weight"] = 2;
shape["describe"] = function():String {return "A " + this.name;};
trace(shape.describe() + " has " + shape.sides + " sides.");
// Displays: A hexagon has 6 sides.
}
}
}