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

Регистрация: Jul 2008
Адрес: Gamburg
Сообщений: 108
Код:
package
{
	import flash.display.*;
	import flash.events.Event;
	import flash.utils.ByteArray;
	
	public class ObjectSWF extends Sprite{
		
		private var loader:Loader;
		private var byte:ByteArray;
		private var thisObj:MovieClip;
		private var _scale:Number;
	
		public function ObjectSWF(Obj:Class,scale:Number=1){
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadBytes);
			byte = new Obj() as ByteArray;
			loader.loadBytes(byte);	
			_scale= scale;
		}
	//-------------------------------------------------------------------------------------
		private function onLoadBytes(evt:Event):void{			
			this.thisObj = loader.content as MovieClip;
			this.gotoFrameStop(1)
			
			this.thisObj.scaleX= _scale;
			this.thisObj.scaleY= _scale;
			this.thisObj.x=-Math.round(this.thisObj.width/2);
			this.thisObj.y=-Math.round(this.thisObj.height/2);
			addChild(this.thisObj);
		}	
	//-----------------------------------------------------------------------------------------
	    public function gotoFrameStop(num:uint):void{
	    	 this.thisObj.gotoAndStop(num)
	    }
	//-------------------------------------------------------------------------------------------
		public function gotoFramePlay(num:uint):void{
			this.thisObj.gotoAndPlay(num);
		}
	//-------------------------------------------------------------------------------------------	
		public function nextFrame():void{
			this.thisObj.nextFrame();
		}
	//------------------------------------------------------------------------------------------	
		public function prevFrame():void{
			this.thisObj.prevFrame();
		}
	//-----------------------------------------------------------------------------------------
		public function RemoveObjectSWF():void{
			removeChild(this.thisObj);
		}	
	}
}
Далее
Код:
....
[Embed('flashContainer.swf')]
private static var FLASH_CONTAINER:Class;
var n_swf:ObjectSWF= new ObjectSWF(FLASH_CONTAINER)