Показать сообщение отдельно
Старый 03.04.2008, 18:56
karakul вне форума Посмотреть профиль Отправить личное сообщение для karakul Найти все сообщения от karakul
  № 2  
Ответить с цитированием
karakul
 
Аватар для karakul

Регистрация: Jul 2007
Сообщений: 9
пробывал тоже самое зделать через класы но не могу зделать переменную picture для загрузки URLRequest штобы она читала .jpg который ей следует читать.

DoccumentClass.as
Код:
package {
	import flash.display.MovieClip;
	import flash.display.Loader;
	import flash.net.URLRequest;

	import Butt_01;//symbols in library art-hrymal_digitalgallery_eng.fla
	import Butt_02;


	public class DocumentClass extends MovieClip
	{
		private var _but01:Butt_01;//sets the values for the new-made symbols from the library
		private var _but02:Butt_02;

		public static  var _empty:Empty;//creates an empty window to load in
		private  var picture:String;//sets the name of the picture for URLRequest

		public static  var imageRequest:URLRequest = new URLRequest("01.jpg");//loads the first picture for the emty window
		public static  var imageLoader:Loader = new Loader();
		imageLoader.load(imageRequest);

		public function DocumentClass()
		{
			_empty = new Empty;//brings an emty window to load in into the scene
			addChild(_empty);
			_empty.x = 300;
			_empty.y = 100;
			trace(_empty);

			_empty.addChild(imageLoader);//imports picture fron imageLoader into the _empty simbol
			//_empty.removeChild(imageLoader);

			picture = "03.jpg";
			_but01 = new Butt_01();//bring symbol from the library to the stage
			addChild(_but01);// add symbol to the scene
			_but01.x = 10;
			_but01.y = 50;


			picture = "02.jpg";
			_but02 = new Butt_02();//bring symbol from the library to the stage
			addChild(_but02);// add symbol to the scene
			_but02.x = 10;
			_but02.y = 250;

			trace("DocumentButton working!!!");
		}
	}
}
ButtonClass.as
Код:
package {
	import flash.display.MovieClip;
	import flash.display.Loader;
	import flash.net.URLRequest;
	import flash.events.MouseEvent;//activates mouse events


	public class ButtonClass extends MovieClip {
		//private var _picture:String = DocumentClass.picture;// sets _Picture variable / gets Picture from ButtonClass
		private var _emptyLoad:Object = DocumentClass._empty;// sets _N variable / gets N from ButtonClass

		private var _imageRequest:* = DocumentClass.imageRequest;
		private var _imageLoader:* = DocumentClass.imageLoader;

		public function ButtonClass() {
			this.buttonMode = true;
			this.addEventListener(MouseEvent.CLICK, onClick);//event listener

			//trace(_picture);
			trace("ButtonClass class working!!!");
		}

		private function onClick(event:MouseEvent):void {

			//trace("_emptyLoad" + emptyLoad);
			
			_emptyLoad.removeChild(_imageLoader);

			//trace(imageLoader);
			//var imageRequest:URLRequest = new URLRequest(_picture);
			//var imageLoader:Loader = new Loader();
			_imageLoader.load(_imageRequest);
			_emptyLoad.addChild(_imageLoader);
			
			trace(_imageLoader);
		}
	}
}