Advertisement
Guest User

Untitled

a guest
Nov 20th, 2012
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package
  2. {
  3.     import flash.display.Sprite;
  4.     import flash.events.Event;
  5.    
  6.     public class Main extends Sprite
  7.     {   [Embed(source = "../lib/Doctor.svg")]
  8.         private var Doctor:Class;
  9.        
  10.         private var container:Sprite = new Sprite();
  11.        
  12.         public function Main():void
  13.         {
  14.             container = new Sprite();
  15.             for (var i:int = 0; i < 10; i++) {
  16.                 for (var j:int = 0; j < 10; j++) {
  17.                     var s:Sprite = new Doctor();
  18.                     s.x = i * 20;
  19.                     container.addChild(s);                 
  20.                 }
  21.             }
  22.             this.addChild(container);
  23.             this.parent.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
  24.             this.parent.addEventListener(KeyboardEvent.KEY_DOWN, onKey);
  25.             this.addChild(new Stats());
  26.         }
  27.        
  28.         private function onKey(event:KeyboardEvent):void
  29.         {
  30.             container.x += 0.25;
  31.         }
  32.        
  33.         private function onMouseWheel(event:MouseEvent):void
  34.         {                              
  35.             if (event.delta > 0) {
  36.                 container.scaleX += 0.1;
  37.                 container.scaleY += 0.1;
  38.             }else {
  39.                 container.scaleX -= 0.1;
  40.                 container.scaleY -= 0.1;
  41.             }
  42.            
  43.         }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement