Показать сообщение отдельно
Старый 15.06.2009, 01:01
Nirth вне форума Посмотреть профиль Отправить личное сообщение для Nirth Посетить домашнюю страницу Nirth Найти все сообщения от Nirth
  № 8  
Ответить с цитированием
Nirth
4AM Games
 
Аватар для Nirth

блогер
Регистрация: Nov 2002
Адрес: Sofia
Сообщений: 6,264
Записей в блоге: 1
Отправить сообщение для Nirth с помощью ICQ Отправить сообщение для Nirth с помощью AIM Отправить сообщение для Nirth с помощью MSN Отправить сообщение для Nirth с помощью Yahoo Отправить сообщение для Nirth с помощью Skype™
Код AS3:
package
{
	import flash.display.Sprite;
	import test.Test3;
	import flash.utils.getTimer;
	import flash.events.Event;
	import flash.utils.Timer;
	import flash.text.TextField;
	import flash.events.MouseEvent;
	import flash.display.StageScaleMode;
	import flash.display.StageAlign;
 
	public class Test extends Sprite
	{
		private var debugField:TextField;
 
		public function Test()
		{
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
 
			stage.addEventListener(MouseEvent.CLICK, debugClick);
			this.addEventListener(MouseEvent.CLICK, debugClick);
			var b1:SquareButton = addChild(new SquareButton(0, 0, 150, 150, 0xFF0000, 'Red')) as SquareButton;
				b1.addEventListener(MouseEvent.CLICK, debugClick);
			var b2:SquareButton = b1.addChild(new SquareButton(50, 50, 100, 100, 0x00FF00, 'Green')) as SquareButton;
				b2.addEventListener(MouseEvent.CLICK, debugClick);
			var b3:SquareButton = b2.addChild(new SquareButton(50, 50, 50, 50, 0x0000FF, 'Blue')) as SquareButton;
				b3.addEventListener(MouseEvent.CLICK, debugClick);
		}
 
		private function debugClick(event:MouseEvent):void
		{
			if(!debugField)
			{
				debugField = addChild(new TextField) as TextField;
				debugField.border = debugField.multiline = debugField.background = true;
				debugField.width = stage.stageWidth;
				debugField.height = stage.stageHeight - 200;
				debugField.x = 0;
				debugField.y = 200;
				debugField.text = 'Welcome' + '\r';
			}
 
			debugField.appendText('target=' + event.target + ' currentTarget=' + event.currentTarget + '\n');
		}
	}
}
 
	import flash.display.Sprite;
 
class SquareButton extends Sprite
{
	internal var id:String;
 
	function SquareButton(x:uint = 0, y:uint = 0,
						  width:uint = 20, height:uint = 20,
						  color:uint = 0xFFFFFF, id:String = null)
	{
		this.x = x;
		this.y = y;
 
		this.id = id;
 
		draw(width, height, color);
	}
 
	internal function draw(width:uint, height:uint, color:uint):SquareButton
	{
		graphics.beginFill(color);
		graphics.drawRect(0, 0, width, height);
		graphics.endFill();
 
		return this;
	}
 
	override public function toString():String
	{
		return '[SquareButton ' + id + ']';
	}
}
__________________
Я перестал переписывать, начал редактировать, еще лет 15 и я стану писателем ^_^