package launcher.panel.buttonBar 
{
	import adobe.utils.CustomActions;
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFormat;
	import fonts.Fonts;
	import flash.events.MouseEvent;
	import flash.net.URLRequest;
	import flash.net.navigateToURL;
	import flash.geom.ColorTransform;
	import launcher.panel.buttonBar.icons.*;
	import launcher.panel.languagePanel

    public class quickPanel extends MovieClip 
    {
        public var home:icon_home = new icon_home();
		public var star:icon_star = new icon_star();
		public var comment:icon_comment = new icon_comment();
		public var money:icon_money = new icon_money();
		public var education:icon_education = new icon_education();
		
		
		public var homeURL:String = "https://home/";
        public var homeButton:MovieClip = new MovieClip();
		public var homeText:TextField = new TextField();
		public var hometextFormat:TextFormat = new TextFormat();
		public var textField:TextField = new TextField();

        public function quickPanel() 
        {
            Fonts.registerFonts();
            homeButton.addChild(home);
            homeButton.buttonMode = true;
			homeButton.addEventListener(MouseEvent.CLICK, onClickOnHome);
            homeButton.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHome);
            homeButton.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHome);
            homeButton.addEventListener(MouseEvent.MOUSE_DOWN, onHomeButtonDown);
            homeButton.addEventListener(MouseEvent.MOUSE_UP, onHomeButtonUp);
            addChild(homeButton);
            homeText.embedFonts = true;
            homeText.text = "Главная";
            homeText.width = 90; // установите ширину текстового поля
            homeText.height = 30; // установите высоту текстового поля
			homeText.x = 20;

           
           hometextFormat.font = "MyCustomFont";
		   hometextFormat.bold = true; // Делаем текст жирным
		   homeText.mouseEnabled = false;
           hometextFormat.size = 16; // установите размер текста
           hometextFormat.color = 0xFFFFFF; // установите цвет текста (белый)
           homeText.defaultTextFormat = hometextFormat;
           homeText.setTextFormat(hometextFormat);

           homeButton.addChild(homeText);
		   homeText.x = home.width + 5;
           homeText.y = home.height - 17;
		   
		   		           updateHeaderText();
        languagePanel.addEventListener("languageChanged", updateHeaderText);
		   
        }
		
		public function onClickOnHome(event:MouseEvent):void 
		{
            navigateToURL(new URLRequest(homeURL), "_blank");
            home.transform.colorTransform = new ColorTransform(0x00 / 0xFF, 0xa5 / 0xFF, 0xec / 0xFF);
            homeText.textColor = 0x00a5ec; 
        }
		
		////СЛУШАТЕЛИ КНОПКИ ДОМОЙ
        private function onMouseOverHome(event:MouseEvent):void
        {
            home.transform.colorTransform = new ColorTransform(0x75 / 0xFF, 0xD6 / 0xFF, 0xFF / 0xFF);
            homeText.textColor = 0x75d6ff; 
        }

        private function onMouseOutHome(event:MouseEvent):void
        {
            home.transform.colorTransform = new ColorTransform(); 
            homeText.textColor = 0xFFFFFF; 
        }

        private function onHomeButtonDown(event:MouseEvent):void
        {
            home.transform.colorTransform = new ColorTransform(0x00 / 0xFF, 0xa5 / 0xFF, 0xec / 0xFF); 
            homeText.textColor = 0x00a5ec; 
        }

        private function onHomeButtonUp(event:MouseEvent):void
        {
            home.transform.colorTransform = new ColorTransform(); 
            homeText.textColor = 0xFFFFFF; 
        }
        ///////////		
        private function updateHeaderText():void {
        if (languagePanel.selectedLanguage == "RU")
        {
            homeText.text = "Главная";
        }
        else if (languagePanel.selectedLanguage == "EN")
        {
            homeText.text = "Home";
        }
        }
		
    }
} текст не меняется когда я нажимаю на кнопку en package launcher.panel {
    import flash.display.MovieClip;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import flash.events.MouseEvent;
	import flash.events.Event;

    public class languagePanel extends MovieClip {
        public var ruButton:MovieClip = new MovieClip();
        public var enButton:MovieClip = new MovieClip();

        public var ruText:TextField = new TextField();
        public var rutextFormat:TextFormat = new TextFormat();
        //
        public var enText:TextField = new TextField();
        public var entextFormat:TextFormat = new TextFormat();
		
		public static var selectedLanguage:String = "RU";

        public function languagePanel() {
            ruButton.buttonMode = true;
            ruButton.addEventListener(MouseEvent.CLICK, onClickOnRU);
            addChild(ruButton);
            ruText.embedFonts = true;
            ruText.text = "RU";
            ruText.width = 90;
            ruText.height = 30;
            ruText.x = 20;

            rutextFormat.font = "MyCustomFont";
            rutextFormat.bold = true;
            ruText.mouseEnabled = false;
            rutextFormat.size = 16;
            rutextFormat.color = 0xFFFFFF;
            ruText.defaultTextFormat = rutextFormat;
            ruText.setTextFormat(rutextFormat);

            ruButton.addChild(ruText);

            enButton.buttonMode = true;
            enButton.addEventListener(MouseEvent.CLICK, onClickOnEN);
            addChild(enButton);
            enText.embedFonts = true;
            enText.text = "EN";
            enText.width = 90;
            enText.height = 30;
            enText.x = ruButton.x + ruButton.width;

            entextFormat.font = "MyCustomFont";
            entextFormat.bold = true;
            enText.mouseEnabled = false;
            entextFormat.size = 16;
            entextFormat.color = 0xFFFFFF;
            enText.defaultTextFormat = entextFormat;
            enText.setTextFormat(entextFormat);

            enButton.addChild(enText);
        }
		
        public static function setLanguage(language:String):void {
            selectedLanguage = language;
        }

        public function onClickOnRU(event:MouseEvent):void {
            languagePanel.selectedLanguage = "RU";
            updateLanguage();
			dispatchEvent(new Event("languageChanged"));
        }

        public function onClickOnEN(event:MouseEvent):void {
            languagePanel.selectedLanguage = "EN";
            updateLanguage();
			dispatchEvent(new Event("languageChanged"));
        }

        private function updateLanguage():void {
            if (languagePanel.selectedLanguage == "RU") {
                ruText.textColor = 0x00a5ec;
                enText.textColor = 0xFFFFFF;
            } else if (languagePanel.selectedLanguage == "EN") {
                ruText.textColor = 0xFFFFFF;
                enText.textColor = 0x00a5ec;
            }
        }
    }    
}