package
{

 import flash.display.Sprite;
 import flash.geom.Rectangle;
 import net.hires.debug.Stats;
 import starling.events.Event;
 import starling.text.TextField;
 
 
 import flash.events.Event;
 
 import screens.InGame.*;
 //import screens.Logo;
 import starling.core.Starling;
 
 import flash.display.StageAlign;
 import flash.display.StageScaleMode;
 
 import flash.desktop.NativeApplication;

 import flash.net.URLLoader;
 
 import flash.net.URLRequest;
 import flash.net.URLVariables;
 
 import flash.media.StageWebView;
 import flash.events.ErrorEvent;
 import flash.events.LocationChangeEvent;
 import flash.events.Event;
 
 /*
 CONFIG::MOBILE
 {
 import com.sticksports.nativeExtensions.SilentSwitch;
 }
 */
 
 /*
 CONFIG::ANDROID
 {
  import com.milkmangames.nativeextensions.*;
  import com.milkmangames.nativeextensions.events.GoogleGamesEvent;
  import com.milkmangames.nativeextensions.events.*;
  
  import com.milkmangames.nativeextensions.GoogleGames;
 }
 */
 
 import flash.display.StageDisplayState;
 

 //import pl.mllr.extensions.contactEditor.ContactEditor;
 import flash.geom.Point;
 import starling.utils.RectangleUtil;
 import starling.utils.ScaleMode;
 import flash.system.Capabilities;
 import Game;
 import   flash.media.AudioPlaybackMode;
 import   flash.media.SoundMixer;

 
 //[SWF(frameRate="60", width="1024", height="748", backgroundColor="0x333333")]e87474
 [SWF(frameRate="60",  width="320", height="568" ,backgroundColor="0xffffff")] //0xffffff //0x2a2a2d
 public class Main extends Sprite
 {
  
  //private var stats:Stats;
  
  //private var myStarling:Starling;
  
  //1136
  //640
  
  //320;
  // 568;
  
  private const SCREEN_WIDTH:int = 320;
  private const SCREEN_HEIGHT:int = 568;
  
  private function onResize(event:starling.events.Event, size:Point):void
  {
   RectangleUtil.fit(
    new Rectangle(0, 0, stage.stageWidth, stage.stageHeight),
    new Rectangle(0, 0, size.x, size.y),
    ScaleMode.SHOW_ALL, false,
    Starling.current.viewPort
   );
  }

  public  function Main()
  {
   //super();
  
  
   
   var isMobile:Boolean = false;
   CONFIG::MOBILE
   {
    isMobile = true;
   }
   
   
   
   if ( isMobile == false)
   {
    /*
    stats = new Stats();
    stats.y = 200;
    stats.scaleX = 1;
    stats.scaleY = 1;
    */
    //this.addChild(stats);
   }
   
   
  
  
   //stage.scaleMode = StageScaleMode.NO_SCALE;
   //stage.align = StageAlign.TOP_LEFT;
   
   /*
   CONFIG::MOBILE
   {
   SilentSwitch.apply();//진동모드 일때 무음
   }
   */
 
   var screenWidth:int = stage.fullScreenWidth;
   var screenHeight:int = stage.fullScreenHeight;
   
   Assets.fullScreenWidth = screenWidth;
   Assets.fullScreenHeight = screenHeight ;
   
   var viewport:Rectangle =  //new Rectangle( 0, 0, stage.stageWidth, stage.stageHeight);
   new Rectangle( 0, 0, screenWidth, screenHeight);
   
   //멀티터치 사용여부
   Starling.multitouchEnabled = true;
   Starling.handleLostContext = true; // deactivate on
  
   stage.quality = "high";
   
   //stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
    
   Assets.myStarling = new Starling( Game , stage, viewport);
   stage.quality = "high";
   //stage.frameRate = 60;
   
  
   
   if ( screenHeight == 1136)
    Assets.isIPHONE5 = true;
   else
   {
    Assets.isIPHONE5 = true;
    //Assets.isIPHONE5 = false;
   }
   
 
   //Assets.isIPHONE5 = true;
   
   if ( Assets.isIPHONE5 == true)
   {
    Assets.myStarling.stage.stageWidth = SCREEN_WIDTH;
    Assets.myStarling.stage.stageHeight = SCREEN_HEIGHT; 
    
   }
   else
   {
    Assets.myStarling.stage.stageWidth = SCREEN_WIDTH;
    Assets.myStarling.stage.stageHeight = SCREEN_HEIGHT;
   }
   
   Assets.stageWCenter = SCREEN_WIDTH / 2;//stage.stageWidth / 2;
   Assets.stageHCenter = SCREEN_HEIGHT / 2;// stage.stageHeight / 2;
   Assets.itemSpwaningArea =  SCREEN_WIDTH + SCREEN_WIDTH / 3;//stage.stageWidth + stage.stageWidth / 3;
   Assets.stageWidth  = SCREEN_WIDTH;//stage.stageWidth;
   Assets.stageHeight = SCREEN_HEIGHT;// stage.stageHeight;
   
   
   //Assets.flashStage = stage;

   
   Assets.myStarling.antiAliasing = 0;
   //Assets.myStarling.simulateMultitouch = true;
   Assets.myStarling.start();
   //Assets.myStarling.simulateMultitouch = true;
   
   SoundMixer.audioPlaybackMode  =  AudioPlaybackMode.AMBIENT;
 
   stage.quality = "high";

  } 

 }
}

 

 

'Programing > flash' 카테고리의 다른 글

texturepacker license post  (0) 2015.11.20
starling main frame  (0) 2015.11.20
starling moviebutton  (0) 2015.11.20
coineff  (0) 2015.11.20
baseEff  (0) 2015.11.20
objectMgr  (0) 2015.11.20
Posted by 패스맨

댓글을 달아 주세요