Uncompressing ByteArray

I'm working through the 'reading a zip file' example on the
liveDocs site, I've copy and pasted the code exactly and I can get
the filenames and sizes of the files in the zip file (I'm using an
air archive instead of a zip archive) fine, but when I call the
uncompress method on the byteArray I get a reference error saying
that the variable CompressionAlgorithm cannot be found'
Why is this happening? there are no spelling mistakes in the
code or anything because I copied it from the example page, this is
hugely frustrating....

Well, there probably IS an error in the example. If you are
running an HTML-based app, then you probably need to use
"air.CompressionAlgorithm".

Similar Messages

  • Play sound from ByteArray

    Ok, so I'm trying to record sound from a microphone, allow the user to preview the sound, then compress the sound to mp3, and upload the mp3 to the server.  I've gotten everything to work except for allowing the user to preview the sound.  The microphone records a raw byteArray, but the Sound class can only play a URL request.  I've type-casted the byteArray to a Sound class, I've compressed it to mp3 and type-casted it, but it doesn't work.  I can send it to the server, and then request the server and play it, but this isn't optimal.  Does anyone know how to play an uncompressed byteArray generated by the microphone? 

    I think you want to use the sampleData event from the Sound object.

  • ByteArray.uncompress() problem

    Hello
    Does the uncompress method of ByteArray only supports level 3
    compressed streams? Because I have a valid zlib compressed file but
    compressed in level 2, and Flash always throws me the 2058 error
    message.
    I've also tried using the DefaultCompressionAlgorithm class
    for AIR with its two compression methods, but with no success.
    Doing some quick tests with python using the same file gets
    uncompressed with no problems.

    I am having problems with uncompress as well. See my
    code.

  • AS API(ByteArray.uncompress) doesn't work as expected in flash player 15.0.0.189 .

    This API is work well in flash player 15.0.0.167 and other previous player version.
    In the flash player 15.0.0.189 debug version, it will alert Error message:
    RangeError: Error #1506: 指定的范围无效。
      at flash.utils::ByteArray/_uncompress()
      at flash.utils::ByteArray/uncompress()
      at ?/bytesLen()
      at ?/init()
      at flash.display::DisplayObjectContainer/addChildAt()
      at PreLoader/onComplete()
    The same situation also occurred in ActiveX version, plugin version and Chrome PPAPI version.

    It's possible that this is the result of a security change.
    Please file a bug at http://bugbase.adobe.com/.  Include a SWF that demonstrates the example so that we can debug it.
    If you post the bug number here, I will get a notification and will ensure that it gets routed to the right engineer.
    Thanks!

  • Bytearray uncompress filestream wirtebytes error

    Hi,
    I'm developing an app for iPad in which I'm trying to load a zip file from a remote url, save that zip file on device and then trying to unzip it.
    It works fine both on laptop(while testing as AIR app) and also on the device(iPad) if zip file size is around 20 - 25MB, with it's internal file being around 140 - 170MB. But if the zip file size is larger (beyond 50MB) then it crashes while uncompressing the zip file on the device. It still works fine on laptop though.
    I'm compiling the code with Flex 4.6 overlayed on AIR 3.6
    iPad iOS version is 6.0.1
    Using following code :
    private function unzipFile():void
                progress = progress + fileName +' unzipFile started\n';
                saveLog();
                var zStream:FileStream = new FileStream();
                var bytes:ByteArray = new ByteArray();
                var fileName:String = new String();
                var flNameLength:uint;
                var xfldLength:uint;
                var offset:uint;
                var compSize:uint;
                var uncompSize:uint;
                var compMethod:int;
                var signature:int;
                progress = progress + fileName +'before zStream.open\n';
                saveLog();
                zStream.open(fileLocal, FileMode.READ);
                progress = progress + fileName +'after zStream.open\n';
                saveLog();
                bytes.endian = Endian.LITTLE_ENDIAN; 
                while (zStream.position < fileLocal.size)
                {  progress = progress + fileName +'before zStream.readBytesbytes, 0, 30\n';
                    saveLog();
                    zStream.readBytes(bytes, 0, 30);
                    progress = progress + fileName +'after zStream.readBytesbytes, 0, 30\n';
                    saveLog();
                    bytes.position = 0;
                    signature = bytes.readInt();
                    if (signature != 0x04034b50)
                        break;
                    bytes.position = 8;
                    compMethod = bytes.readByte();
                    offset = 0;
                    bytes.position = 26;
                    flNameLength = bytes.readShort();   
                    offset += flNameLength;    
                    bytes.position = 28;    
                    xfldLength = bytes.readShort();
                    offset += xfldLength;   
                    zStream.readBytes(bytes, 30, offset);
                    bytes.position = 30;
                    fileName = bytes.readUTFBytes(flNameLength); 
                    bytes.position = 18;
                    compSize = bytes.readUnsignedInt(); 
                    bytes.position = 22;  
                    uncompSize = bytes.readUnsignedInt();
                    progress = progress + fileName +'before zStream.readBytes(bytes, 0, compSize)\n';
                    saveLog();
                    zStream.readBytes(bytes, 0, compSize);
                    progress = progress + fileName +'after zStream.readBytes(bytes, 0, compSize)\n';
                    saveLog();
                    if (compMethod == 8)
                        try
                            progress = progress + fileName +' before bytes.uncompress\n';
                            saveLog();
                            bytes.uncompress(CompressionAlgorithm.DEFLATE);
                            //bytes.uncompress(CompressionAlgorithm.LZMA);
                            progress = progress + fileName +' after bytes.uncompress\n';
                            saveLog();
                            //outFile(fileName, bytes); 
                        catch(error:Error)
                            progress = progress + fileName +' bytes.uncompress catch\n';
                            saveLog();
                  //write bytes to a file locally here
    It fails on this line:
    bytes.uncompress(CompressionAlgorithm.DEFLATE);
    and gets inside catch block.
    To avoid this problem, I also tried to load the file which was there in the zip file, directly using remote url(file size and download time will be more), but in this case, after loading the file, reading the bytearray data of it, when I try to write this bytearray to a filestream, it crashes again!
    Just wanted to know if there is any file size limit on mobile\iOS devices, while unzipping a file and while writing bytearray data to a filesystem or am I doing something wrong here?
    Kindly help, as I'm stuck with this and cannot really proceed on this project using Flex AIR if this doesn't work.
    -Deepak

    Hi Brent,
    Yes, for unzipping, we really have to split the zip files, as uncompress doesn't work for larger zip files(it crashes on device).
    Since my file size would range from 200-400MB, for now, I'm planning to load the raw file directly(running out of time to deliver it :| ). This too was failing, when i tried to readByes\writeBytes, after loading the file completely(since it runs out of memory). But I came across a solution right here:
    http://stackoverflow.com/questions/14583247/air-as3-download-large-file-trough-ipad-applic ation
    It basically writes data to the disk, as and when data gets downloaded in chunks. I felt it was a great idea! Apparantly, there won't be any memory issues too with that approach
    And yes, as you have mentioned future plan would be to load and unzip zip files.
    Thanks Brent, that helped too

  • ByteArray.uncompress() Error

    I'm attempting to compress a string on the server and uncompress it in Flex.  I'm getting a generic error when calling uncompress() and I assume it is because I'm encoding the string incorrectly.  I'm using C# on the server, and Flex 2 on the client (so only zlib compression).
    Does anyone have a code example on the server of this working?

    Hi Brent,
    Yes, for unzipping, we really have to split the zip files, as uncompress doesn't work for larger zip files(it crashes on device).
    Since my file size would range from 200-400MB, for now, I'm planning to load the raw file directly(running out of time to deliver it :| ). This too was failing, when i tried to readByes\writeBytes, after loading the file completely(since it runs out of memory). But I came across a solution right here:
    http://stackoverflow.com/questions/14583247/air-as3-download-large-file-trough-ipad-applic ation
    It basically writes data to the disk, as and when data gets downloaded in chunks. I felt it was a great idea! Apparantly, there won't be any memory issues too with that approach
    And yes, as you have mentioned future plan would be to load and unzip zip files.
    Thanks Brent, that helped too

  • How to avoid uncompressing bitmapDatas multiple times

    Hi,
    Not sure if this should go here (performance) or IOS section, since I mainly have this issue on iOS but I think its on all air players.
    When a bitmap (for exemple a bitmap in a fla) is added, you can see with Adobe SCOUT (great tool btw!) that it is uncompressed when added. Allright.
    The bad thing is, if it is removed from stage, even if you keep it in memory for reuse, it is very often re-uncompressed when redisplayed. I mean 'often' because it seems erratic. If it stay removed for just a second, most of the time it won't be uncompressed again, but after 3 or more seconds, most of the time it will be (some kind of garbage collector in the "video" memory ?)
    Setting its quality to lossless in the fla helps the decompression goes a bit faster (30-40 % I would say), on the detriment of swf size, but does not solve the main question : how can I force an animation (made of bitmaps for example) to never be uncompressed again as long as I dont tell it to to be "disposed" from wherever this is stored ?
    Having it permanently on screen hidden somewhere is just too much a performance killer to be considered a solution when you have many. CacheAsBitmapMatrix could be usefull for vector data  on this issue (not sure), but drawing a bitmap seems a bit stupid if you do already have bitmaps.
    It might not seem a big issue but in a game with effects etc. most of those will only show up once every 2 to 10 seconds, but if you loose 5ms/frame for 40 frames each time one does, and you have many, it really impact performance on devices like ios etc, whereas memory doesnt seem to be the problem here, it happens with low or high memory usage both.
    If anyone knows a tip, thanks a lot!
    EDIT : Tests made with gpu mode, flash builder 4.7, air 3.5, iPad3 (or other), release build.

    In my experience, the second solution here: actionscript 3 - Bitmaps Being Cached As Bitmaps - Stack Overflow is the one that gave me best results thus far, even when loading a swf (as opposed to a bitmap) which contains bitmaps inside. To avoid this decompressing on the run (on demand) you can instead request flash to decompress it on load. This will increase the load time but improve the perceived performance of the app since a separate thread takes care of the decompressing. This of course means no jitter or skip when the image hits the screen:
    var fileLocation:URLRequest = new URLRequest(levelToLoad);
    levelToLoad = "testLevel.swf";
    var levelLoader:Loader = new Loader();
    var loaderContext:LoaderContext = new LoaderContext();
    loaderContext.imageDecodingPolicy = ImageDecodingPolicy.ON_LOAD;
    levelLoader.load(fileLocation, loaderContext);
    Embedded images (via code) are not supposed to be compressed, so this problem shouldn't occur with applications that do so. However, if you are like me, and you use the Flash Pro IDE to import PNGs or other bitmap assets, Flash Pro compresses them as JPG by default, using the setting provided by the image itself.
    To fix this and avoid these decompression issues, simply go to your Flash Pro asset library, right click on the image you want to change, click on properties and select "lossless / PNG/GIF" as compression. This will increase largely the load time but you will have the much better perceived performance discussed here. This should be done in addition to implementing the code above, or it will make no difference.
    In my experience the frame rate average dropped only by one frame per second, but it's much more consistent without any skips or lags which is essential for games.
    See: http://help.adobe.com/en_US/as3/dev/WS52621785137562065a8e668112d98c8c4df-8000.html
    And
    http://www.bytearray.org/?p=2931

  • Uncompress folder

    Hi there!
    I am playing with the uncompress function of air and
    javascript.
    I have done the "ByteArray example: Reading a .zip file"
    training (
    link)
    and everythings works fine.
    Now i am trying to uncompress a zip file including folders.
    The Reading a .zip file example finds the correct files but
    after finding a folder it gets a problem, i think its becoause it
    is reading the wrong bytes.
    Anyone got an idea of how to uncompress folders? Google didnt
    help at all.
    Here is a sample code where i think the error occures:
    quote:
    while (zStream.position < zfile.size) {
    // read fixed metadata portion of local file header
    zStream.readBytes(bytes, 0, 30);
    bytes.position = 0;
    signature = bytes.readInt();
    // if no longer reading data files, quit
    if (signature != 0x04034b50) {
    break;
    bytes.position = 8;
    compMethod = bytes.readByte(); // store compression method
    (8 == Deflate)
    offset = 0; // stores length of variable portion of metadata
    bytes.position = 26; // offset to file name length
    flNameLength = bytes.readShort(); // store file name
    offset += flNameLength; // add length of file name
    bytes.position = 28; // offset to extra field length
    xfldLength = bytes.readShort();
    offset += xfldLength; // add length of extra field
    // if a folder is found offset seems to have the size of all
    files inside the folder
    // read variable length bytes between fixed-length header
    and compressed file data
    zStream.readBytes(bytes, 30, offset);
    bytes.position = 30;
    fileName = bytes.readUTFBytes(flNameLength); // read file
    name
    output += fileName + "<br />"; // write file name to
    text area
    bytes.position = 18;
    compSize = bytes.readUnsignedInt(); // store size of
    compressed portion
    output += "\tCompressed size is: " + compSize + '<br
    />';
    bytes.position = 22; // offset to uncompressed size
    uncompSize = bytes.readUnsignedInt(); // store uncompressed
    size
    output += "\tUncompressed size is: " + uncompSize + '<br
    />';
    // read compressed file to offset 0 of bytes; for
    uncompressed files
    // the compressed and uncompressed size is the same
    // if a folder is found the compSize is 0
    zStream.readBytes(bytes, 0, compSize);
    if (compMethod == 8) {// if file is compressed, uncompress
    bytes.uncompress(air.CompressionAlgorithm.DEFLATE);
    thx!

    No ideas?!

  • Decoding image from a byteArray

    I don't know if this is possible (haven't seen it done
    anywhere). Is there a way to decode a Base64 string back into a
    ByteArray and subsequently into a Bitmap so that it can be
    displayed within Flash?
    I have successfully been able to encode the BitmapData into
    PNG via a PNGEncoder class. This results in a ByteArray which I
    have encoded using a Base64 class.
    Any help much appreciated.

    this seems to do what you were asking.
    http://nightlycoding.com/index.php/2012/05/as3-send-bitmapdata-to-backend-efficiently/
    source incase the link goes down in the future:
    public static function deconstructBitmap(bmp:BitmapData):Object
                // converting the bitmapdata into a byteArray
                var byteArray:ByteArray = bmp.getPixels(bmp.rect);
                // compressing using the default algorithm 'zlib'
                byteArray.compress();
                var enc:Base64Encoder = new Base64Encoder(); 
                var b64;
                enc.encodeBytes(byteArray);
                // joining all in one line
                b64 = enc.drain().split("\n").join("");
                // the rectangle is needed for re-contstruction
                return {'bmpData':b64,'rect':bmp.rect};
    public static function constructBitmap(obj:Object):BitmapData
                // to avoid errors
                if(obj!==''&&obj!==undefined&&obj!==null&&obj.bmpData!=='ByteArray'){
                    var dec:Base64Decoder = new Base64Decoder();
                    dec.decode(obj.bmpData); // decoding using the same algorithm
                    var newByteArr:ByteArray=dec.toByteArray();
                    newByteArr.uncompress();
                    // end of decoding //
                    var bitmapData:BitmapData = new BitmapData(obj.rect.width, obj.rect.height);
                    bitmapData.setPixels(bitmapData.rect, newByteArr);
                    return bitmapData;
                else
                    return null;

  • IMAGEIO IS WORKING BUT BYTEARRAY IS NOT WORKING:

    Hi all
    I am getting images from gmail contacts and trying to store it in DB
    using my http code:InputStream is=urlconnection.getInputStream();
    i could able to store the inputstream in file using:
    BufferedImage filebuffer=ImageIO.read(is);
    FileOutputStream fos=new FileOutputStream("picturerecent.jpg");
    ImageIO.write(filebuffer, "jpg", fos);
    but i was trying to store it in DB using the following code but it is not working.i am having a question that
    how it writing to a file without any problem.why not to database:
    try {
           String url = "jdbc:mysql://localhost:3306/";
             String db = "test";
             String driver = "com.mysql.jdbc.Driver";
                    Class.forName(driver);
                    con = DriverManager.getConnection(url+db,"root","");
                    try{
    PreparedStatement psmnt;
         psmnt = con.prepareStatement("insert into gmailphoto(id,Photo) "+ "values(?,?)");
         psmnt.setInt(1, 9);
         psmnt.setObject(2, is, java.sql.Types.BLOB);
         int s = psmnt.executeUpdate();
           Statement st = con.createStatement();
        try{
            ResultSet rs=st.executeQuery("select photo from gmailphoto where id=9");
            if(rs.next())
              {     //byte[] bytearray = new byte[4096];
                  int size=0;
                File sImage;
    //FIRST TRY
                FileWriter wr=new FileWriter(new File("c:\\imageOutput.jpg"));
                IOUtils.copy(rs.getBlob("photo").getBinaryStream(),wr);
                //SECOND TRY
                BufferedImage bf=ImageIO.read(new ByteArrayInputStream(rs.getBytes("photo")));
                FileOutputStream fout=new FileOutputStream(new File("C:\\imageOut"));
                if(bf!=null)ImageIO.write(bf, "jpg", fout);
                if(wr!=null)
                wr.flush();
                wr.close();
              rs.close();
           }}catch(SQLException e){
                System.out.println(e);
           }Thanks a lot for help

    but i was trying to store it in DB using the following codeThere is no code here that writes to a database. There are two lots of code that write to a file.

  • FCP 6.0.2 captures black (Uncompressed 10bit PAL)

    Hi all,
    The fun and games continue...
    Since upgrading to OSX 10.5 and being forced up to FCP 6.0.2 (someone else's projects..), all my captures have resulted in plain black quicktimes. It records the timecode data but just sees black footage where vision should be. (If that makes sense)
    I'm capturing via a Decklink Extreme, from a J-series Digi Beta. My capture codec is the Uncompressed 10bit one. I have no issues controlling the digi, but the preview window is black also. I occasionally experienced this problem on FCP 5.x, but a full power down then restart always solved it. No such luck this time. Is there any way to roll back the FCP install to 6.0.1? Or any hacks around the problem?

    Okay, time to give myself +1 gold star for answering my own questions, and -1 black cross for knee-jerk narrow mindedness.
    Somewhere in between 10.4 / 6.0.1 and 10.5 / 6.0.2 the Decklink changed its input from SDI to component (Preferences / Decklink / Settings / Set Input). Fixed.
    Apologies for the waste of forum space.
    Message was edited by: user_127
    Message was edited by: user_127

  • Capture Settings for uncompressed Video Vs DV Video

    Im capturing footage from Digibeta masters via a J30 deck using a single SDI cable connected to my black magic extreme, (captured using the Blackmagic uncompressed 10 bit setting) editing in FCP and exporting to SD dvd via compressor using "dvd best quality 90 mins anamorphic".
    Up untill today i had been using the same workflow EXCEPT i had been capturing over firewire using DV PAL anamorphic to work in the DV PAL format.
    Comparing the final result of both workflows im not seeing a huge difference (the original footage is the same in both cases).
    Are there any capture settings i can play with that will improve the quality of the final product or should i be looking at the bitrates in compressor instead?
    I just want to make sure im not arsing up the capture and that i am capturing as much info as i can from the digibeta masters. The files created from he digi's are a lot larger then the files from the Dv stuff but i just dont feel im seeing that on screen - any advice?
    thanks,
    S

    All the original footage was shot on 35mm by a pro cinematographer - me:) Each project was mastered to Digibeta. What i want to do is show that footage in its best "light" so to speak, but i am limited to presenting it on SD DVD until Blu-ray takes off.
    Up untill recently i had been using the Digi to DV to DVD workflow i had described above. With a recent desktop upgrade i am now recapturing all the same material from the same Digimasters using the uncompressed 10bit to dvd workflow descibed above so that i can avoid the afrementioned dv compression in the middle.
    Obviously i can see a difference between uncompressed and Dv footage natively but when i view them both on DVD on a PAL monitor i cant see as big a difference as i had hoped i would see.
    can i improve this difference with my capture settings or do i need to work on my dvd bitrate settings or a combination of both?
    S

  • How to open a PDF File from a ByteArray

    Hi, Fellows,
    I'm having the following problem:
    I have put a PDF file inside a BLOB field in a table in my SQLite database.
    And I can retrieve it from this database without any problem, receiving a ByteArray data type as result.
    What I want to know is what I should do to render this file in my HTML flex object without saving it to a file…
    I used the mx.controls.HTML.data property, but what I see is the TEXT of my PDF file. The mx.controls.HTML.location needs a STRING with the link to a URL site or file.
    Thanks in advance for your help.
    Here, my code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" width="810" height="620"
          creationComplete="creationCompleteHandler();">
          <mx:Script>
                <![CDATA[
                      import flash.data.*;
                      import flash.filesystem.*;
                       private var _connection:SQLConnection;
                      private var _statement:SQLStatement; 
                 private function creationCompleteHandler():void {
                    var file:File = File.applicationStorageDirectory.resolvePath("arq.db");
                    _connection = new SQLConnection();
                    _connection.addEventListener(SQLEvent.OPEN, openHandler);
                    _connection.openAsync(file, SQLMode.CREATE);
                 private function openHandler(event:SQLEvent):void {
                    var sql:SQLStatement = new SQLStatement();
                    sql.sqlConnection = _connection;
                    sql.text = "CREATE TABLE IF NOT EXISTS arq(" +
                               "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                               "nome TEXT, " + 
                                "arquivo BLOB)";
                    sql.execute();        
                 private function insertFile(identificacao:String, caminho:String):void {
                            var sql:SQLStatement = new SQLStatement();
                            sql.sqlConnection = _connection;
                            var arquivo:File = new File(caminho);
                            var arqStream:FileStream = new FileStream();
                            arqStream.open(arquivo,SQLMode.READ);
                            var arqBlob:ByteArray = new ByteArray();
                            arqStream.readBytes(arqBlob);
                            arqStream.close();
                    sql.text = "INSERT INTO arq(nome, arquivo)" + 
                                "VALUES(@nome, @arquivo)";
                    sql.parameters["@nome"] = identificacao;
                    sql.parameters["@arquivo"] = arqBlob;
                    sql.execute();
                     trace("Arquivo inserido com Sucesso!!!");
                     lb1.text = "Arquivo inserido com Sucesso!!!";
                 private function selectFile(identificacao:String):void {
                             var sql:SQLStatement = new SQLStatement();
                            sql.sqlConnection = _connection;
                    sql.text = "SELECT id, arquivo FROM arq WHERE nome=@nome";
                    sql.parameters["@nome"] = identificacao;
                    trace(sql.text);
                    sql.addEventListener(SQLEvent.RESULT, apresentarDados);
                    sql.execute();
                 private function apresentarDados(event:SQLEvent):void {
                             var statement:SQLStatement = event.target as SQLStatement;
                            var result:SQLResult = statement.getResult();
                            if(result != null && result.data != null) {
                                  var dataset:Array = result.data;
                                  trace(dataset.length);
                            var arqBlob:ByteArray = dataset[0].arquivo;
                       var xx:HTMLLoader = new  HTMLLoader();
                      var ur:URLRequest = new URLRequest();
                      var ul:URLLoader = new URLLoader();
                       //Right now, it's doing nothing
    ur.contentType = "application/pdf";
                       ul.dataFormat = URLLoaderDataFormat.BINARY;
                      ul.data = arqBlob;
                       //Here is my problem - WHAT SHOULD I DO?
    pdfFile.data = arqBlob;
                           trace("Cheguei!!!");
                          lb1.text = "Cheguei!!!";
                             } else {
                                  trace("Não funcionou!!!")
                 private function sair():void {
                      this.exit();
                 ]]>
          </mx:Script>
          <mx:TextInput x="99" y="10" id="arq"/>
          <mx:Label x="10" y="12" text="Identificação:" width="81"/>
          <mx:Button x="168" y="40" label="Apresentar" click="selectFile(arq.text)"/>
          <mx:Button x="728" y="10" label="Sair" width="60" click="sair()"/>
          <mx:TextInput x="417" y="10" id="id1"/>
          <mx:TextInput x="417" y="40" id="cm1"/>
          <mx:Button x="585" y="12" label="Gravar" click="insertFile(id1.text, cm1.text)"/>
          <mx:Label x="291" y="12" text="Identificação:" width="105"/>
          <mx:Label x="291" y="42" text="Caminho Completo:" width="118"/>
          <mx:Label x="615" y="42" width="173" id="lb1"/>
          <mx:HTML id="pdfFile" width="800" height="520" y="79"/>
    </mx:WindowedApplication>

    Bob, Here's some ActionScript code for saving the byte array data to temporary file. (In this code, pdfData is a ByteArray object containing the PDF data.)
    var tempFile:File = File.createTempFile();
    var stream:FileStream = new FileStream();
    stream.open(tempFile, FileMode.WRITE);
    stream.writeBytes(pdfData);
    stream.close();
    Next you can load the file into your Flex HTML control (represented as html in the following code):
    html.location = tempFile.url;
    Here's more information on reading and writing files:
    http://help.adobe.com/en_US/AIR/1.5/devappsflex/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc2. html (for Flex developers)
    http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc2 .html (for Flash developers)
    http://help.adobe.com/en_US/AIR/1.5/devappshtml/WS5b3ccc516d4fbf351e63e3d118666ade46-7dc2. html (for Ajax developers)

  • How to load a ByteArray FLV in OSMF?

    I'm working on a local application ( it's not a website or nothing related ) and I have various FLVs with a very simple encryptation method (just like adding 10 at each byte).
    I can load/play them using NetStream.appendBytes() after my decrypt, but that happens only after I read all video data.
    What I really need is to stream those videos from a remote url, and decrypting while receiving data, using a OSMF player that I already have.
    This is my current code just to play my decoded FLV byte array
    private function playBytes(bytes:ByteArray):void
                // detecting it's header
                if (bytes.readUTFBytes(3) != "FLV")
                    _text.appendText("\nFile \""+ file +"\" is not a FLV")
                    return void;
                bytes.position = 0;
                netConnection.connect(null);
                netStream = new NetStream(netConnection);
                netStream.client = { onMetaData:function(obj:Object):void { } }
                video.attachNetStream(netStream);
                addChild(video);
                // put the NetStream class into Data Generation mode
                netStream.play(null);
                // before appending new bytes, reset the position to the beginning
                netStream.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
                // append the FLV video bytes
                netStream.appendBytes(bytes);
    [I moved the discussion from OSMF, to here, due the lack of attention there]

    I looked at it a couple of month ago and, frankly, don't remember exact package that takes care of it. I don't have OSMF code on this machine - so I cannot look into it now.
    I doubt there are many resources on the web regarding this. This is a very specialized functionality and very few people attempted to do what OSMF does. We have figured out certain aspects but were not able to completely replicate it. Again, it is a very daunting task to search of byte offsets and match with file format specs.

  • Can Photoshop CS6 Extended save uncompressed DICOM files?

    In CS4 and CS5 Extended layered documents saved as DICOM (.dcm) were uncompressed and could be opened in another imaging program that I use frequently (ImageJ) without complaint. It appears that CS6 Extended saves DICOM files in a compressed format which cannot be directly opened in ImageJ and, as I recall, some other DICOM viewers.
    Does anyone know if there is a way to change to uncompressed DICOM saves? I've looked for save options, but cannot see anything relevant.

    Monitor the file I/O with tools like Sysinternals' System Monitor and check what's causing the problem. Could be a mundane permissions problem with your temporary folders or otehr resource problem.
    Mylenium

Maybe you are looking for

  • Washed out iPhone 5 screen

    This happens when I try and unlock my screen.Occasionally, the screen will be very faded looking. Not bright like an autobright overadjustment, just unsaturated and hazy. Washed out and cloudy, it often dissipates slowly over about 30 seconds to a mi

  • How do I detect if a new PS/2 mouse is plugged in?

    If I remove my PS/2 mouse, then plug it back in, it no longer works. How do I make the computer refresh and re-detect the mouse without rebooting?

  • Mapping Number Problem

    HI all, i create my project on OWB 10 and after i deploy it on OWB 11gR2 and everything works good, despite of the external tables data don't show numbers with comma, my flat file (csv) has data like ( 123,43) and i don't find in the external table a

  • Sorting a Drill Down Report by summary values in Crystal 2008

    Hi All, I'm a newbie to 2008 but have been using Crystal 7.0 for years, so am trying to find the best 'new' way to represent report data I have. The data consists of various Product details (code, description, colour, size, Category, Sub Category) an

  • Hide Format Bar, and or Ruler on Start:

    I've tried looking through the forum here, and in the help files, but I must not be using the right words because I haven't found it yet. And I know it can be done because I've done it before. I would like to have pages (numbers too, I guess), when i