Показать сообщение отдельно
Старый 12.04.2010, 00:51
mickfallout вне форума Посмотреть профиль Отправить личное сообщение для mickfallout Найти все сообщения от mickfallout
  № 4  
Ответить с цитированием
mickfallout
 
Аватар для mickfallout

Регистрация: Jun 2009
Адрес: Москва
Сообщений: 170
я гружу битмапы так:
Код AS3:
package 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.Loader;
	import flash.events.Event;
 
	public class Main extends Sprite 
	{
 
		[Embed(source = "resources.swf", mimeType="application/octet-stream")]//Загружаем файл ресурсов. Содержит описания классов с графикой.
		private var Resources:Class;
		static private var resourcesLoader:Loader = new Loader;
		static public var resourcesLink:Loader;
 
		public function Main():void 
		{
			super();
			if (stage)
				init();
			else 
				addEventListener(Event.ADDED_TO_STAGE, init);
		}
 
		private function init(e:Event = null):void 
		{
			resourcesLoader.loadBytes(new Resources()); 
			resourcesLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,
												     resources_completeHandler);
			removeEventListener(Event.ADDED_TO_STAGE, init);
		}
 
		private function resources_completeHandler(e:Event):void 
		{
			addChild(getBitmap("Chest0100"));
		}
 
		static public function getBitmap(imageName:String, width:int=64, height:int=96):Bitmap
		{
			return new Bitmap(BitmapData(new (resourcesLoader.content.loaderInfo.applicationDomain.getDefinition(imageName) as Class)(width, height)))
		}
	}
 
 
}