Показать сообщение отдельно
Старый 03.05.2014, 23:03
ZackMercury вне форума Посмотреть профиль Отправить личное сообщение для ZackMercury Найти все сообщения от ZackMercury
  № 7  
Ответить с цитированием
ZackMercury
 
Аватар для ZackMercury

блогер
Регистрация: Jul 2013
Адрес: Север
Сообщений: 1,921
Записей в блоге: 23
Отправить сообщение для ZackMercury с помощью ICQ Отправить сообщение для ZackMercury с помощью Skype™
Код AS3:
package com.ui
{
	/**
	 * ...
	 * @author Scorpion
	 */
	import flash.display.*;
	import flash.events.*;
 
	public class Button
	{
		[Embed(source="Z:/home/test1.ru/www/img/but.png")] private static const Embed: Class;
 
		public static function addButton(x: int, y: int): Sprite
		{
			var button: Bitmap;
 
			button = new Embed();
 
			button.x = x;
			button.y = y;
 
			button.addEventListener(MouseEvent.CLICK, funButton);
 
			return (new Sprite()).addChild(button);
		}
	}
}
Код AS3:
package {
	/**
	 * ...
	 * @author Scorpion
	 */
	import flash.events.*;
	import flash.display.*;
	import flash.text.*;
	import com.ui.*;
 
	public class Main extends Sprite {
		public function Main() {
			if (stage) 
				init();
			else
				addEventListener(Event.ADDED_TO_STAGE, init);
		}
 
		private function init(): void {
			addChild(Image.addImage(0, 0, "background"));
			addChild(Image.addImage(0, 0, "head"));
			addChild(Image.addImage(0, 200, "menuline"));
 
			var text1: TextF = new TextF;
			addChild(text1.addText("Text", 100, 200));
 
			var button:Sprite = button.addButton(200,200);
			addChild(button);
			button.addEventListener(MouseEvent.CLICK, btnClickHandler);
		}
 
		private function btnClickHandler(e:MouseEvent):void
		{
			...
		}
	}
}
__________________
There is no thing in this world that is not simple.