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

Регистрация: Aug 2008
Адрес: 53 E
Сообщений: 60
подумаешь...Меняем его на DisplayObjectContainer и все ништяк.
Код AS3:
package 
{
	/*BASED ON 
	* http://onflex.org/flexapps/applicati...iew/index.html 
	* CODE EXAMPLE
	* Flash modification by LOST'овчанин
	*/
 
	import flash.net.URLStream;
	import flash.net.URLRequest;
	import flash.utils.*;
	import flash.display.*;
	import flash.events.*;
 
 
	public class ProgressiveLoader
	{
 
		private var loader:Loader;
 
		private var imageStream:URLStream;
 
		private var imageData:ByteArray;
 
		private var mainSprite:Sprite;
 
 
 
 
 
        /**
		 * Constructor for ProgressiveLoader class
		 *
		 * @Does not request arguments
		 * @langversion ActionScript 3.0
		 * @playerversion Flash 10.0
		 */		
 
		public function ProgressiveLoader():void
		{
 
			mainSprite=new Sprite();
			mainSprite.addEventListener(Event.RENDER, renderListener);
 
			imageStream = new URLStream();
			imageStream.addEventListener( ProgressEvent.PROGRESS , imageStreamProgress );
			imageStream.addEventListener( Event.COMPLETE , imageStreamComplete );
 
			loader = new Loader();
 
			mainSprite.addChild( loader );
		}
 
		private function imageStreamProgress( event:Event ):void
		{
			if (imageStream.bytesAvailable==0)
			{
				return;
			}
			this.processImageData();
		}
 
		private function imageStreamComplete( event:Event ):void
		{
			if (imageStream.connected)
			{
				imageStream.close();
			}
 
 
			mainSprite.stage.invalidate();
		}
 
		private function processImageData():void
		{
			if (imageStream.connected)
			{
				imageStream.readBytes( imageData , imageData.length );
			}
 
			loader.unload();
 
			loader.loadBytes( imageData );
		}
 
		private function renderListener(e:Event):void
		{
			loader.unload();
 
			loader.loadBytes( imageData );
		}
 
		/**
		 * Start image loading 
		 *
		 * @param input The URL path to image
		 * @langversion ActionScript 3.0
		 * @playerversion Flash 10.0
		 */		
		public function loadImage( input:String ):void
		{
			if (imageStream.connected)
			{
				imageStream.close();
			}
 
			imageStream.load( new URLRequest( input + '?' + getTimer() ) );
 
			loader.unload();
 
			imageData = new ByteArray();
		}
 
		public function get canvas():Sprite
		{
			return mainSprite;
		}
	}
}
__________________
04.08 1516 23:42