Показать сообщение отдельно
Старый 23.05.2013, 17:20
PesaDelo вне форума Посмотреть профиль Отправить личное сообщение для PesaDelo Найти все сообщения от PesaDelo
  № 7  
Ответить с цитированием
PesaDelo

Регистрация: May 2013
Сообщений: 8
Объявил переменные на уровне класса:
Код AS3:
package 
{
	import flash.display.*;
	import flash.events.*;
	import flash.text.*;
 
	public class btnInputMl1 extends MovieClip
	{
		public static var e:qwerty;
		public static var r:window;
		public static var t:winpass;
		public static var u:PassTxt;
		public static var muu:TextField;
		public static var a:vx;
		public static var wx:bbbtttnnn;
 
		public function btnInputMl1()
		{
			this.addEventListener(MouseEvent.CLICK, clickHandler);
 
		}
		public function clickHandler(e:MouseEvent):void
		{
			pasword();
		}
		public function pasword()
		{
			this.removeEventListener(MouseEvent.CLICK,clickHandler);
			var textFormat:TextFormat = new TextFormat();
			textFormat.font = "Calibri";
			textFormat.color = 0x000000;
			textFormat.size = 30;
			btnInputMl1.e = new qwerty();
			addChild(btnInputMl1.e);
			btnInputMl1.r = new window();
			addChild(btnInputMl1.r);
			btnInputMl1.t = new winpass();
			btnInputMl1.t.x = 65;
			btnInputMl1.t.y = -100;
			addChild(btnInputMl1.t);
			btnInputMl1.u = new PassTxt();
			btnInputMl1.u.x = -120;
			btnInputMl1.u.y = -100;
			addChild(btnInputMl1.u);
			btnInputMl1.muu = new TextField();
			muu.defaultTextFormat = textFormat;
			addChild(muu);
			muu.type = TextFieldType.INPUT;
			muu.height = 42;
			muu.width = 167;
			muu.x = -20;
			muu.y = -122;
			muu.displayAsPassword = true;
			btnInputMl1.a = new vx();
			btnInputMl1.a.x = 0;
			btnInputMl1.a.y = 0;
			btnInputMl1.a.buttonMode = true;
			addChild(btnInputMl1.a);
			btnInputMl1.wx = new bbbtttnnn();
			addChild(btnInputMl1.wx);
			btnInputMl1.wx.x = 190;
			btnInputMl1.wx.y = -157;
			btnInputMl1.wx.addEventListener(MouseEvent.CLICK, exit);
			btnInputMl1.a.addEventListener(MouseEvent.CLICK, loginFunction);
		}
		public function exit(e:MouseEvent):void
		{
			removeChild(btnInputMl1.e);
			removeChild(btnInputMl1.r);
			removeChild(btnInputMl1.t);
			removeChild(btnInputMl1.u);
			removeChild(btnInputMl1.muu);
			removeChild(btnInputMl1.a);
			removeChild(btnInputMl1.wx);
			this.addEventListener(MouseEvent.CLICK, nnn);
			function nnn(e:MouseEvent):void
			{
				pasword();
				this.removeEventListener(MouseEvent.CLICK,nnn);
			}
			wx.removeEventListener(MouseEvent.CLICK, exit);
			a.removeEventListener(MouseEvent.CLICK, loginFunction);
			trace("myau!!!!!");
		}
		public function loginFunction(e:MouseEvent):void
		{
			if (muu.text == "qwerty")
			{
				trace("Complit!");
			}
			else
			{
				var lkj:qwerty = new qwerty();
				addChild(lkj);
				var ghj:ancorrectPassword = new ancorrectPassword();
				addChild(ghj);
				var ert:bbbtttnnn = new bbbtttnnn();
				addChild(ert);
				ert.x = 150;
				ert.y = -70;
				ert.addEventListener(MouseEvent.CLICK, kkk);
				function kkk(e:MouseEvent):void
				{
					removeChild(lkj);
					removeChild(ghj);
					removeChild(ert);
					ert.removeEventListener(MouseEvent.CLICK,kkk);
					ert.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
				}
				ert.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
				function onKeyboardDown(event:KeyboardEvent):void
				{
					if (event.keyCode == 27)
					{
						removeChild(lkj);
						removeChild(ghj);
						removeChild(ert);
						ert.removeEventListener(MouseEvent.CLICK,kkk);
						ert.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);
					}
				}
			}
		}
	}
}
Но всё равно появляется ошибка:
TypeError: Error #1006: removeEventListener не является функцией.
at MethodInfo-31()

как в nnn добавить this?

а если сделать так:
Код AS3:
public function exit(e:MouseEvent):void
		{
			removeChild(btnInputMl1.e);
			removeChild(btnInputMl1.r);
			removeChild(btnInputMl1.t);
			removeChild(btnInputMl1.u);
			removeChild(btnInputMl1.muu);
			removeChild(btnInputMl1.a);
			removeChild(btnInputMl1.wx);
			wx.removeEventListener(MouseEvent.CLICK, exit);
			a.removeEventListener(MouseEvent.CLICK, loginFunction);
			trace("myau!!!!!");
			this.addEventListener(MouseEvent.CLICK, nnn);
		}
		public function nnn(e:MouseEvent):void
		{
			pasword();
			this.removeEventListener(MouseEvent.CLICK,nnn);
		}
то при нажимании на кнопку закрытия окна входа ничего не происходит.


Последний раз редактировалось PesaDelo; 23.05.2013 в 17:33.