Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Main.hx
- private function tempload()
- {
- var imageLoader:URLLoader = new URLLoader();
- imageLoader.dataFormat = URLLoaderDataFormat.BINARY;
- var request:URLRequest = new URLRequest("../../../Assets/data/homer.png");
- imageLoader.addEventListener(Event.COMPLETE, completeHandler);
- imageLoader.load(request);
- }
- private function completeHandler(e:Event)
- {
- var byteArrayData = e.currentTarget.data;
- zoomBox.loadImage(byteArrayData);
- }
- ZoomBox.hx
- public function loadImage(data:ByteArray)
- {
- var bd:BitmapData = new BitmapData(Std.int(width), Std.int(height));
- bd.setPixels(imageRect, data);
- var loadedImage = bd;
- var baseImage = new Bitmap(loadedImage);
- stageImage = new BitmapWrapper(baseImage);
- attachImageToHUD(stageImage, Std.int(imageRect.x), Std.int(imageRect.y));
- }
- Output:
- [Fault] exception, information=Error: Error #2030: End of file was encountered.
- at flash.display::BitmapData/setPixels()
- at scripts::ZoomBox/loadImage()[C:\Users\SadiQ\AppData\Roaming\Stencyl\stencylworks\games-generated\testings\Source\scripts\ZoomBox.hx:107]
- at scripts::MainScene/completeHandler()[C:\Users\SadiQ\AppData\Roaming\Stencyl\stencylworks\games-generated\testings\Source\scripts\MainScene.hx:110]
- at flash.events::EventDispatcher/dispatchEventFunction()
- at flash.events::EventDispatcher/dispatchEvent()
- at flash.net::URLLoader/onComplete()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement