TheAMM

Untitled

Mar 29th, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.display.BitmapData;
  2. import flash.display.Bitmap;
  3. import flash.utils.getDefinitionByName;
  4. import flash.events.KeyboardEvent;
  5. import flash.ui.Keyboard;
  6. import flash.filters.*;
  7. import flash.geom.*;
  8. import flash.events.MouseEvent;
  9. import flash.events.Event;
  10. import flash.display.StageAlign;
  11. import flash.display.StageScaleMode;
  12. import flash.events.SampleDataEvent;
  13. import flash.media.Sound;
  14.  
  15. stage.addEventListener(Event.RESIZE, onResizeListener);
  16. stage.align = StageAlign.TOP_LEFT;
  17. stage.scaleMode = StageScaleMode.NO_SCALE;
  18. var stageScale = 1;
  19. function onResizeListener(e : Event) {
  20.     trace(getTimer(),stage.stageWidth + "x" + stage.stageHeight);
  21.     stageScale = stage.stageHeight / 720
  22.     blackThing.width = stage.stageWidth
  23.     blackThing.height = stage.stageHeight
  24.     positionImage()
  25. }
  26. function positionImage() {
  27.     if (currentImage != null) {
  28.         var img = imageArray[imageIndex];
  29.  
  30.         imageContainer.width = currentImage.width * stageScale
  31.         imageContainer.height = currentImage.height * stageScale
  32.         var newX : Number;
  33.         if (img.a == 0) { // Center
  34.             newX = (stage.stageWidth - imageContainer.width) / 2
  35.         } else if (img.a == 1) { // Right
  36.             newX = 0
  37.         } else if (img.a == 2) { // Left
  38.             newX = stage.stageWidth - imageContainer.width
  39.         }
  40.         imageContainer.x = newX;
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment