package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import launcher.background.Background_Main;
	import launcher.button.FightButton;
	import launcher.panel.social.socialPanel;
	import launcher.panel.buttonBar.quickPanel;
	import launcher.snow.Snow;
    import flash.display.StageAlign;
    import flash.display.StageDisplayState;
    import flash.display.StageQuality;
    import flash.display.StageScaleMode;
    import flash.display.NativeWindow;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flash.display.Screen;
	import zip.ZIPResourceLoader;
	import caurina.transitions.Tweener;
	import flash.display.SimpleButton;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author alekskart
	 */
	public class Main extends Sprite 
	{
		private var guiLayer:Sprite;
		public var background:Background_Main = new Background_Main();
		public var progressBar:ProgressBar;
		public var socialbar:socialPanel = new socialPanel();
		public var quickbar:quickPanel = new quickPanel();
		public var fightButton:FightButton = new FightButton();
		public var bgButton:bg_button = new bg_button();
		
		public function Main() 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
			//var ziploader:ZIPResourceLoader = new ZIPResourceLoader(progressBar);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			this.configureStage();
			this.createGUI();
			//это при запуске первом
            Tweener.addTween(bgButton, {alpha: 1, time: 2, transition: "easeOutCubic", onComplete: fadeOutButton});
		}
		
        private function setCenterPosition() : void
       {
            var appBounds:Rectangle = stage.nativeWindow.bounds;
            var screen:Screen = Screen.getScreensForRectangle(appBounds)[0];
            stage.stageWidth = 1034;
            stage.stageHeight = 680;
            stage.nativeWindow.maxSize = new Point(stage.nativeWindow.width,stage.nativeWindow.height);
            stage.nativeWindow.minSize = new Point(stage.nativeWindow.width,stage.nativeWindow.height);
            stage.nativeWindow.x = (screen.bounds.width - stage.nativeWindow.width) / 2;
            stage.nativeWindow.y = (screen.bounds.height - stage.nativeWindow.height) / 2;
        }
		
        private function configureStage() : void
        {
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.quality = StageQuality.BEST;
            stage.displayState = StageDisplayState.NORMAL;
            stage.stageWidth = 1034;
            stage.stageHeight = 680;
            this.setCenterPosition();
        }
		
		private function createGUI() : void
		{
            this.guiLayer = new Sprite();
            this.background.width = stage.stageWidth; 
            this.background.height = stage.stageHeight; 
            this.background.y = 0;
            this.guiLayer.addChild(this.background);
            this.socialbar.x = stage.stageWidth - this.socialbar.width - 15;
            this.socialbar.y = 29; 
            this.guiLayer.addChild(this.socialbar);
			
            this.quickbar.x = (stage.stageWidth - this.quickbar.width) / 2 + 20;
            this.quickbar.y = 29;
            this.guiLayer.addChild(this.quickbar);
			
            this.bgButton.x = stage.stageWidth / 2 - this.bgButton.width / 2;
            this.bgButton.y = stage.stageHeight / 2 - this.bgButton.height / 2 + 185;
            this.guiLayer.addChild(this.bgButton);
			
			
            this.fightButton.x = stage.stageWidth / 2 - this.fightButton.width / 2;
            this.fightButton.y = stage.stageHeight / 2 - this.fightButton.height / 2 + 185;
            this.guiLayer.addChild(this.fightButton);
			
			
			
            this.progressBar = new ProgressBar();
			this.progressBar.x = (stage.stageWidth - this.progressBar.width) / 2;
            this.progressBar.y = (stage.stageHeight - this.progressBar.height) / 2 + 280;
            this.guiLayer.addChild(this.progressBar);
			this.guiLayer.addChild(new Snow(25));
            addChild(this.guiLayer);
			
			var ruButton:SimpleButton = new SimpleButton();
ruButton.x = 10;
ruButton.y = 10;
addChild(ruButton);

var enButton:SimpleButton = new SimpleButton();
enButton.x = 60;
enButton.y = 10;
addChild(enButton);

// Добавление обработчиков событий для кнопок
ruButton.addEventListener(MouseEvent.CLICK, onLanguageButtonClick);
enButton.addEventListener(MouseEvent.CLICK, onLanguageButtonClick);

			

            stage.addEventListener(Event.RESIZE, onResize);
		}
		
		///Затухание
        private function fadeOutButton():void {
            Tweener.addTween(bgButton, {alpha: 0, time: 4, delay: 0, transition: "easeOutCubic", onComplete: fadeInButton});
        }
        
		//появление после затухания
        private function fadeInButton():void {
            Tweener.addTween(bgButton, {alpha: 1, time: 4, delay: 0, transition: "easeOutCubic", onComplete: fadeOutButton});
        }
		
        private function onResize(event:Event):void
        {
           var scale:Number = Math.min(stage.stageWidth / this.background.width, stage.stageHeight / this.background.height);
           this.background.width *= scale;
           this.background.height *= scale;
          var newHeight:Number = this.background.height * 0.86; 
          this.background.height = newHeight;
          this.background.x = (stage.stageWidth - this.background.width) / 2;
          // this.background.y = (stage.stageHeight - this.background.height) * 0.25; 
        }
		
        // Функция для смены языка
        private function changeLanguage(language: String): void {
            this.language = language;
            // Код для смены языка в вашем приложении
            // Например, изменение текста на кнопках, метках и т. д.
            if (language == "RU") {
                // Изменения для русского языка
                ruLanguageChanges();
            } else if (language == "EN") {
                // Изменения для английского языка
                enLanguageChanges();
            }
        }
		
		function onLanguageButtonClick(event:MouseEvent):void {
    var selectedLanguage:String = event.target.label;
    changeLanguage(selectedLanguage);
}

        private function ruLanguageChanges(): void {
            // Код для изменения элементов интерфейса при переключении на русский язык
        }

        private function enLanguageChanges(): void {
            // Код для изменения элементов интерфейса при переключении на английсий язык
        }
	}
	
} как исправить C:\Users\Alexander\Desktop\project\Preloader\src\Main.as(151): col: 18 Error: Access of possibly undefined property language through a reference with static type Main.
            this.language = language; жалуется на this.language