forked from: Chapter 14 Example 1
forked from Chapter 14 Example 1 (diff: 6)
ActionScript3 source code
/**
* Copyright devtrain23 ( http://wonderfl.net/user/devtrain23 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/eIVO
*/
// forked from actionscriptbible's Chapter 14 Example 1
package {
import com.actionscriptbible.Example;
import flash.geom.Point;
public class ch14ex1 extends Example {
public function ch14ex1() {
var p1:Point = new Point();
trace(p1); //(x=0, y=0)
p1.x = 1;
p1.y = 1;
trace(p1); //(x=1, y=1);
var p2:Point = new Point(4, 3);
trace(p2); //(x=4, y=3)
trace(p2.length); //5 (the hypotenuse of a right triangle with edges 3,4)
var p3:Point = p1.add(p2);
trace(p3); //(x=5, y=4)
var p4:Point = p3.add(p2);
trace(p4.length);
p4.offset(8, 8);
trace(p4);
trace(p4.length);
}
}
}
