Search the Community
Showing results for tags 'bytearray'.
-
Hi I have a usecase, where I use DataLoader to load binary Data. This way I'm always able to look into the incoming data like so: queue = new LoaderMax( { name:"mainQueue", autoLoad:true }); [...] var loader:DataLoader = new DataLoader("example.com/SESSIONSTRING", { name:someParameter, format: "binary", onComplete:dataCompleteHandler }); queue.append( loader ); [...] function assetCompleteHandler(e:LoaderEvent):void { var ba:ByteArray = LoaderMax.getLoader(e.target.name).content as ByteArray; //Validation here, like checking if it is long enough, if not, are the first 5 Bytes read as a String saying "ERROR" and the server gave an Error back. Or is it long enough, but to short to be sure, so there might be a Warning or PHP Error coming back from the Server, then display te bytearray as a String for me to read "unexpextd error on PHP Line...". I like handling with the raw ByteArray } This is all great, but I want to be able to then convert the Binary Data into a Movieclip. That does only seem to work when doing so: var mc:MovieClip = LoaderMax.getLoader(ID).rawContent as MovieClip; The Problem is, that only SWFLoader has the rawContent accessable. When using DataLoader I only have access to Content but not rawContent. My problem is this generally: When I use DataLoader, I can scoop into the ByteArray and do all kind of magic, but am not able to create a MC from the loaded Data. When I use SWFLoader, I can play with the Loaded SWF/MC with easy, but have no Access to the ByteArray. Am I missing something? How can I have both features? Being able to have a accessable SWF and being able to scroop the Data befor allowing it to be injected into my App? Indy
- 6 replies
-
- loader
- dataloader
- (and 8 more)
-
hi I'm trying to take a screenshot of the stage which is made up of various Movieclips blending and filling the entire stage using autofitarea. the problem is none of the movieclips in the autofitarea show up in the screenshot - and if i do select a movieclip to export it is the original size not the scaled size var area:AutoFitArea = new AutoFitArea(this,0,0,stage.stageWidth,stage.stageHeight); area.attach(mc, {scaleMode:ScaleMode.PROPORTIONAL_OUTSIDE, crop:true}); area.attach(mc2, {scaleMode:ScaleMode.PROPORTIONAL_OUTSIDE, crop:true}); area.attach(mc3, {scaleMode:ScaleMode.PROPORTIONAL_OUTSIDE, crop:true}); function SaveScreenshot(evt:MouseEvent):void{ var bitmapData:BitmapData=new BitmapData(area.width, area.height); bitmapData.draw(stage); var jpgEncoder:JPGEncoder = new JPGEncoder(100); var byteArray:ByteArray = jpgEncoder.encode(bitmapData); byteArray = jpgEncoder.encode(bitmapData); var fileReference:FileReference=new FileReference(); fileReference.save(byteArray, "scrShot1.jpg"); } // neither mc, mc2 or mc3 show in the exported jpg, while everything else on the stage does really hope someone can help me with this Thanks T
-
- autofitareabitmapdata
- jpgencoder
-
(and 1 more)
Tagged with:
-
Hello, I need load PDF file and show as bitmap in Flash (AS3). I found this code in documentation, but I don´t know how transform byteArray to bitmap? Can somebody help me please? var loader:BinaryDataLoader = new BinaryDataLoader("files/dum.pdf",{name:"filePDF",requireWithRoot:this.root,estimatedBytes:6800}); loader.load(); var files:Array = ["files/dum.pdf"]; LoaderMax.registerFileType("pdf", BinaryDataLoader); LoaderMax.activate([binaryDataLoader]); var queue:LoaderMax = LoaderMax.parse(files,{onProgress:progressHandler,onComplete:completeHandler,onChildFail:childFailHandler}); queue.load(); function completeHandler(event:LoaderEvent):void { var byteArray:ByteArray = LoaderMax.getContent("filePDF"); // I need bitmap from the PDF file ??? } ...
- 5 replies
-
- loadermax
- load pdf file
-
(and 2 more)
Tagged with: