差分発生行の前後
無視リスト:
コミット日時:
2008/09/19 02:33:36 (3 年前)
コミッタ:
saqoosha
ログメッセージ:

ええええい、こんどこそ。

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/OSCemote/branches/saqoosha/samples/Sample.as

    r1337 r1339  
    1 package 
    2 
    3         import flash.display.Sprite; 
    4          
     1package { 
    52        import uranodai.oscemote.OSCemote; 
    6         import uranodai.oscemote.event.OSCemoteEvent; 
    7          
     3        import uranodai.oscemote.event.OSCemoteAccelerationEvent; 
     4        import uranodai.oscemote.event.OSCemoteButtonEvent; 
     5        import uranodai.oscemote.event.OSCemoteSegmentEvent; 
     6        import uranodai.oscemote.event.OSCemoteSliderEvent; 
     7        import uranodai.oscemote.event.OSCemoteSwitchEvent; 
     8        import uranodai.oscemote.event.OSCemoteTouchEvent; 
     9 
     10        import flash.display.Sprite;     
     11 
    812        [SWF(width="400",height="300",frameRate="60",backgroundColor="#FFFFFF")] 
    9          
    10         public class Sample extends Sprite 
    11         { 
     13 
     14        public class Sample extends Sprite { 
     15 
    1216                private var oscemote:OSCemote; 
    13                  
    14                 public function Sample() 
    15                 { 
     17 
     18                public function Sample() { 
    1619                        oscemote = new OSCemote(); 
    17                         oscemote.addEventListener(OSCemoteEvent.UPDATE, handleUpdate); 
     20                        oscemote.addEventListener(OSCemoteButtonEvent.BUTTON_DOWN, this._onButtonDown); 
     21                        oscemote.addEventListener(OSCemoteButtonEvent.BUTTON_UP, this._onButtonUp); 
     22                        oscemote.addEventListener(OSCemoteSliderEvent.SLIDER_CHANGE, this._onSliderChange); 
     23                        oscemote.addEventListener(OSCemoteSegmentEvent.SEGMENT_CHANGE, this._onSegmentChange); 
     24                        oscemote.addEventListener(OSCemoteSwitchEvent.STATE_CHANGE, this._onSwitchStateChange); 
     25                        oscemote.addEventListener(OSCemoteTouchEvent.TOUCH, this._onTouch); 
     26                        oscemote.addEventListener(OSCemoteAccelerationEvent.ACCELERATION_CHANGE, this._onAccelChange); 
    1827                        oscemote.connect(); 
    1928                } 
    20                  
    21                 private function handleUpdate(e:OSCemoteEvent):void 
    22                 { 
    23                         trace(e.data); 
     29 
     30                public function _onButtonDown(e:OSCemoteButtonEvent):void { 
     31                        trace('_onButtonDown', e.button); 
    2432                } 
    25                  
     33 
     34                public function _onButtonUp(e:OSCemoteButtonEvent):void { 
     35                        trace('_onButtonUp', e.button); 
     36                } 
     37 
     38                public function _onSliderChange(e:OSCemoteSliderEvent):void { 
     39                        trace('_onSliderChange', e.index, e.value); 
     40                } 
     41 
     42                public function _onSegmentChange(e:OSCemoteSegmentEvent):void { 
     43                        trace('_onSegmentedChange', e.value); 
     44                } 
     45 
     46                public function _onSwitchStateChange(e:OSCemoteSwitchEvent):void { 
     47                        trace('_onSwitchStateChange', e.index, e.state); 
     48                } 
     49 
     50                public function _onTouch(e:OSCemoteTouchEvent):void { 
     51                        trace('_onTouch', e.count); 
     52                        for (var i:int = 0; i < e.count; i++) { 
     53                                trace('---', i, e.getPosition(i)); 
     54                        } 
     55                } 
     56 
     57                public function _onAccelChange(e:OSCemoteAccelerationEvent):void { 
     58                        trace('_onAccelChange', [e.x, e.y, e.z]); 
     59                } 
    2660        } 
    2761}