Share Posted February 24, 2012 Hi, after unloading i.e. an image or video bytesLoaded isn't set to 0. This example makes no sense, but it repeatable shows the effect described: import com.greensock.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.*; var IMAGE1:ImageLoader = new ImageLoader("images/flower.jpg", {name:"flower", container:this, x:0, y:0, width:200, height:200, onComplete:imageLoaded}); IMAGE1.load(); function imageLoaded(e1:LoaderEvent):void { IMAGE1.unload(); trace(IMAGE1.bytesLoaded); // for images a number equal to bytesTotal } Kind regards Uli Link to comment Share on other sites More sharing options...
Share Posted February 24, 2012 Hey ya mate, Think you have to listen for the unload event and then do your trace from there: http://www.greensock.com/as/docs/tween/ ... tml#unload var IMAGE1:ImageLoader = new ImageLoader("images/flower.jpg", {name:"flower", container:this, x:0, y:0, width:200, height:200, onComplete:imageLoaded}); IMAGE1.addEventListener(LoaderEvent.UNLOAD, imageUnloaded); IMAGE1.load(); function imageLoaded(e1:LoaderEvent):void { IMAGE1.unload(); trace(IMAGE1.bytesLoaded); // unload event hasn't completed yet } function imageUnloaded(e1:LoaderEvent):void { trace(IMAGE1.bytesLoaded); // should work now } Link to comment Share on other sites More sharing options...
Author Share Posted February 24, 2012 Hey Zync, Thanks for your reply. I immediatelly check it out, but... import com.greensock.*; import com.greensock.events.LoaderEvent; import com.greensock.loading.*; var IMAGE1:ImageLoader = new ImageLoader("images/flower.jpg", {name:"flower", container:this, x:0, y:0, width:200, height:200, onComplete:imageLoaded}); IMAGE1.addEventListener(LoaderEvent.UNLOAD, imageUnloaded); IMAGE1.load(); function imageLoaded(e1:LoaderEvent):void { IMAGE1.unload(); trace(IMAGE1.bytesLoaded); // 18067 } function imageUnloaded(e1:LoaderEvent):void { trace(IMAGE1.bytesLoaded); // 18067 } Link to comment Share on other sites More sharing options...
Share Posted February 24, 2012 Hmm thats weird, I'm getting the same result. Figured at that point the bytes loaded should be back to 0. Edit: Just had a look see at the LoaderCore.as and around line 250 I justadded in: if (scrubLevel != 2) { _cachedBytesLoaded = 0; //Add this in for a quickfix dispatchEvent(new LoaderEvent(LoaderEvent.UNLOAD, this)); } But might wanna wait for Jack to see if its meant to function like this or not. Link to comment Share on other sites More sharing options...
Share Posted February 24, 2012 Actually, you're right - it really should go back to 0 after unloading. Thanks for pointing out that issue. It should be resolved in the latest version of LoaderMax. Link to comment Share on other sites More sharing options...
Author Share Posted February 27, 2012 Thanks Dave and Zync for your support. And now it works as documented... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now