Показать сообщение отдельно
Старый 02.08.2009, 22:31
dixlofos вне форума Посмотреть профиль Отправить личное сообщение для dixlofos Найти все сообщения от dixlofos
  № 1  
Ответить с цитированием
dixlofos
 
Аватар для dixlofos

Регистрация: Apr 2009
Сообщений: 167
Записей в блоге: 1
Attention Помогите с разделением кода

попытался я разбить один кусок кода на 2 и у меня нечего не вышло..
вот код целого куска:
Код AS3:
package CaptureUserInput {
 
	import flash.events.*;
	import flash.text.*;
	import flash.display.Stage;
	import flash.display.*;
 
	public class CaptureUserInput extends Sprite {
 
		private var myTextBox:TextField = new TextField();
		private var myOutputBox:TextField = new TextField();
		private var myText:String = "Type your text ";
 
		public function CaptureUserInput() {
 
			captureText();	
			greetingapp();
		}
		public function captureText():void {
 
			myTextBox.type = TextFieldType.INPUT;
			myTextBox.x = 10;
			myTextBox.y = 10;
			myTextBox.backgroundColor=0xFF0000;
			myTextBox.background = true;
			addChild(myTextBox);
			myTextBox.text = myText;
			myTextBox.addEventListener(TextEvent.TEXT_INPUT, textInputCapture);
		}
 
		public function textInputCapture(event:TextEvent):void  {
 
			var str:String = myTextBox.text;
			createOutputBox(str);
		}
 
		public function createOutputBox(str:String):void {
 
			myOutputBox.background = true;
			myOutputBox.backgroundColor=0x00FF00;
			myOutputBox.x = 200;
			myOutputBox.y = 10;
			addChild(myOutputBox);
			myOutputBox.text = str;			
		}
		public function greetingapp () {
               var circle:Sprite = new Sprite();
               circle.graphics.lineStyle (1);
               circle.graphics.beginFill (0xFF00CC, 1);
               circle.graphics.drawCircle (50, 100, 50);
               circle.x = 275;
               circle.y = 235;               
               circle.addEventListener (MouseEvent.CLICK, onMouseClick);
               addChild(circle);
          }
          private function onMouseClick (event:MouseEvent):void {
               trace("sss");
 
          }		
	}
}
я хотел вынести код функции greetingapp в отдельный файл, но у меня нечего не вышло..
что мне нужно добавить в основной код, что бы он запускал код из соседнего файла?