开发者

Download an image and get its size - doesn't work with big sized images?

The image is huge, the code does not work as intended - what is the problem with this code?

package {
    import flash.display.*;
    import flash.events.*
    import flash.net.*;

    public class something extends Sprite {
        public function something():void {
            var loader:Loader = new Loader();
            loader.load(new URLRequest('http://www.decidio.com/photos_company/small/83336.jpg'));
            loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void {
                trace(e.currentTarget.content.width);
            });
开发者_开发技巧        }
    }
}


check if it fires Event.INIT and check bytestotal and bytesloaded on progress to see where's the problem. also for big amounts of data i'd recommend to use URLStream class

upd: maybe it'd be better to add listeners before you start loading and to check typeof(e.target)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜