Просмотр полной версии : BinaryArray и Image
Acid2007
08.10.2007, 14:21
Привет всем. Есть веб сервис который возвращает картинку как BinaryArray
Как мне загрузить этот BinaryArray в Image. Может ли кто-нить поделиться рабочим примером? Бился со свойством Context. Но нечего не получилось.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()">
<mx:Script>
<![CDATA[
private var _loader:URLLoader;
private var _imageLoader:Loader;
private function init():void {
this._loader = new URLLoader(new URLRequest('image.jpg'));
this._loader.dataFormat = URLLoaderDataFormat.BINARY;
this._loader.addEventListener(Event.COMPLETE, this.completeHandler);
}
private function completeHandler(event:Event):void {
var data:ByteArray = this._loader.data as ByteArray;
this._imageLoader = new Loader();
this._imageLoader.loadBytes(data);
this._imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.imageCompleteHandler);
}
private function imageCompleteHandler(event:Event):void {
this.myImage.source = this._imageLoader;
}
]]>
</mx:Script>
<mx:Image id="myImage" source=""/>
</mx:Application>
Работает на vBulletin ® версия 3.7.3. Copyright ©2000-2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Copyright © 1999-2008 Flasher.ru. All rights reserved.