~zodiacsohma/armagetronad/vectron

« back to all changes in this revision

Viewing changes to src/ToolBase.as

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-01-22 02:46:23 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140122024623-1dyhnemuhogi23gp
Converted all tab characters into spaces (4 gaps).

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
package
27
27
{
28
 
        import flash.display.SimpleButton
29
 
 
30
 
        import flash.events.MouseEvent
31
 
 
32
 
        import orfaust.Debug
33
 
 
34
 
        public class ToolBase extends SimpleButton implements ToolInterface
35
 
        {
36
 
                protected var _aamap:Aamap;
37
 
                protected var _cursorStart;
38
 
                protected var _snapCursorStart;
39
 
                protected var _connected:Boolean = false;
40
 
 
41
 
                public function connect():void
42
 
                {
43
 
                        if(_connected)
44
 
                                return;
45
 
 
46
 
                        _aamap = Home.currentMap;
47
 
 
48
 
                        stage.addEventListener(MouseEvent.MOUSE_DOWN,begin);
49
 
                        _connected = true;
50
 
                }
51
 
 
52
 
                public function disconnect():void
53
 
                {
54
 
                        if(!_connected)
55
 
                                return;
56
 
 
57
 
                        stage.removeEventListener(MouseEvent.MOUSE_DOWN,begin);
58
 
                        _connected = false;
59
 
                        close();
60
 
                }
61
 
 
62
 
                public function close():void
63
 
                {
64
 
                        forceOverride('close()');
65
 
                }
66
 
 
67
 
                protected function begin(e:MouseEvent):void
68
 
                {
69
 
                        forceOverride('begin()');
70
 
                }
 
28
    import flash.display.SimpleButton
 
29
 
 
30
    import flash.events.MouseEvent
 
31
 
 
32
    import orfaust.Debug
 
33
 
 
34
    public class ToolBase extends SimpleButton implements ToolInterface
 
35
    {
 
36
        protected var _aamap:Aamap;
 
37
        protected var _cursorStart;
 
38
        protected var _snapCursorStart;
 
39
        protected var _connected:Boolean = false;
 
40
 
 
41
        public function connect():void
 
42
        {
 
43
            if(_connected)
 
44
                return;
 
45
 
 
46
            _aamap = Home.currentMap;
 
47
 
 
48
            stage.addEventListener(MouseEvent.MOUSE_DOWN,begin);
 
49
            _connected = true;
 
50
        }
 
51
 
 
52
        public function disconnect():void
 
53
        {
 
54
            if(!_connected)
 
55
                return;
 
56
 
 
57
            stage.removeEventListener(MouseEvent.MOUSE_DOWN,begin);
 
58
            _connected = false;
 
59
            close();
 
60
        }
 
61
 
 
62
        public function close():void
 
63
        {
 
64
            forceOverride('close()');
 
65
        }
 
66
 
 
67
        protected function begin(e:MouseEvent):void
 
68
        {
 
69
            forceOverride('begin()');
 
70
        }
71
71
 
72
72
 
73
73
 
74
74
 
75
75
/* errors */
76
76
 
77
 
                protected function forceOverride(f:String):void
78
 
                {
79
 
                        error(f + ' should be overridden');
80
 
                }
81
 
                protected function error(e:String):void
82
 
                {
83
 
                        throw new Error(e);
84
 
                }
85
 
        }
 
77
        protected function forceOverride(f:String):void
 
78
        {
 
79
            error(f + ' should be overridden');
 
80
        }
 
81
        protected function error(e:String):void
 
82
        {
 
83
            throw new Error(e);
 
84
        }
 
85
    }
86
86
}
 
 
b'\\ No newline at end of file'