topical media & game development

talk show tell print

#graphic-player-10-cube-be-nascom-flash10-tests-widgets-MouseRotationTracer.mx

#graphic-player-10-cube-be-nascom-flash10-tests-widgets-MouseRotationTracer.mx [swf] [flash] flex


  <?xml version="1.0" encoding="utf-8"?>
  <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" addedToStage="startMouseFollow()">
  
          <mx:Script>
                  <![CDATA[
                          
                          public static var offsetx:uint=10;
                          public static var offsety:uint=0;
                          
                          protected function startMouseFollow():void{
                                  stage.addEventListener(Event.ENTER_FRAME,followMouse);
                          }
                          
                          protected function followMouse(e:Event):void{
                                  x=stage.mouseX+offsetx;
                                  y=stage.mouseY+offsety;
                          }
                          
                          public function update(rx:Number,ry:Number,rz:Number):void{
                                  x_rotation_label.text=String(rx);
                                  y_rotation_label.text=String(ry);
                                  z_rotation_label.text=String(rz);
                          }
                          
                  ]]>
          </mx:Script>
  
          <mx:HBox>
                  <mx:Label text="x_rotation" />
                  <mx:Label id="x_rotation_label" />
          </mx:HBox>
          <mx:HBox>
                  <mx:Label text="y_rotation" />
                  <mx:Label id="y_rotation_label" />
          </mx:HBox>
          <mx:HBox>
                  <mx:Label text="z_rotation" />
                  <mx:Label id="z_rotation_label" />
          </mx:HBox>
  </mx:VBox>
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.