Share Posted November 5, 2015 I am trying to switch over to LoaderMax because of all the added features, but I can't seem to convert my old Loader code to what LoaderMax needs. Here's my old code: import flash.display.Loader; [Embed(source="localBA.ba", mimeType="application/octet-stream")] var BAClass:Class; var BA:ByteArray = new BAClass as ByteArray; BA.inflate(); var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaded); loader.loadBytes(BA); var mySprite:Sprite; function loaded(evt:Event):void { mySprite = loader.getChildAt(0) as Sprite; } And my new code: var dataLoader:DataLoader = new DataLoader("localBA.ba",name:"localBA",format:"binary",estimatedBytes:10000,onComplete:dataLoaded}); var mySprite:Sprite; function dataLoaded(evt:LoaderEvent):void { var BA:ByteArray = LoaderMax.getContent("D20BA"); BA.inflate(); mySprite = BA as Sprite; //mySprite apparently is null addChild(mySprite); } Any ideas about what I'm doing wrong? What is the DataLoader version of loadBytes? Link to comment Share on other sites More sharing options...
Author Share Posted November 5, 2015 Nevermind, found this thread: http://greensock.com/forums/topic/7543-loading-bytes-with-swfloader/ 1 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