- Timestamp:
- 07/03/08 15:33:30 (5 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/actionscript/FPazzle/trunk/src/net/suztomo/FPazzle/RotateController.as
r14949 r15097 4 4 import flash.display.Sprite; 5 5 import flash.events.*; 6 7 import mx.managers.CursorManager; 6 8 7 9 public class RotateController extends Sprite … … 19 21 private var arrow1:RotationArrow; 20 22 private var arrow2:RotationArrow; 23 private var type:int; 24 25 private const ON_OUT_ALPHA:Number = 0.0; 21 26 22 23 public function RotateController(_target:DisplayObject, p_width:Number, p_height:Number) 27 public function RotateController(_target:DisplayObject, p_width:Number, p_height:Number, _type:int = 0) 24 28 { 25 29 super(); 26 30 target = _target; 27 31 init_rot = target.rotation; 32 type = _type; 28 33 //addEventListener(MouseEvent.MOUSE_DOWN, onClick); 29 34 //addEventListener(MouseEvent.MOUSE_UP, onRelese); … … 31 36 //this.x = - target.width / 2; 32 37 //this.y = - target.height / 2; 33 x = + p_width / 2; 34 y = + p_height / 2; 35 38 if (type == 0 || type == 3) { 39 x = + p_width / 2; 40 } else { 41 x = - p_width / 2; 42 } 43 44 if (type == 0 || type == 1) { 45 y = + p_height / 2; 46 } else { 47 y = - p_height / 2; 48 } 49 50 rotation = 90 * type; 51 36 52 graphics.beginFill(0xFFFFFF, 1); 37 53 graphics.drawCircle(0, 0, 20); … … 48 64 addEventListener(MouseEvent.MOUSE_OUT, onOut); 49 65 50 arrow1.addEventListener(MouseEvent. CLICK, rotate90);51 arrow2.addEventListener(MouseEvent. CLICK, rotate270);66 arrow1.addEventListener(MouseEvent.MOUSE_DOWN, rotate90); 67 arrow2.addEventListener(MouseEvent.MOUSE_DOWN, rotate270); 52 68 53 alpha = 0.5;69 alpha = ON_OUT_ALPHA; 54 70 } 55 71 … … 57 73 { 58 74 alpha = 1.0; 75 CursorManager.removeAllCursors(); 76 event.stopPropagation(); 59 77 } 60 78 61 79 private function onOut(e:Event):void 62 80 { 63 alpha = 0.5;81 alpha = ON_OUT_ALPHA; 64 82 } 65 83 … … 81 99 { 82 100 target.rotation += 90; 101 e.stopPropagation(); 83 102 } 84 103 … … 86 105 { 87 106 target.rotation -= 90; 107 e.stopPropagation(); 88 108 } 89 109
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)