Loading an image in an XML text file

I've gotten the DateChooser component to work very well
loading dynamic text fields with data from an external XML file.
Can I embed a jpeg into the XML text like I would with the
<img> tag in an HTML text file?
Many thanks in advance for any tips...
George

I assume your XML looks something like this...
<event date='11/11/1111'>
<PerformerName>SomeInfoHere</PerformerName>
</event>
You could add the image info anywhere you want in the XML.
Perhaps an attribute of the PerformerName tag?
<PerformerName
image='myImage.jpg'>SomeInfoHere</PerformerName>
or
<PerformerName image='
http://www.myDomain.com/images/myImage.jpg'>SomeInfoHere</PerformerName>
When you parse the XML data and build your Array, then you
just need to capture the additional tag attribute. Similar to how
you got the date attribute.
Then at that point you would add it into the textField of
your info_txt.
Read this page in the docs to see how to add the image.
http://livedocs.adobe.com/flash/8/main/00001464.html

Similar Messages

  • Loading data from oracle table to text file........

    how can i load data from a oracle table to a text file or CSV file using PL/SQL procedures where the pls/sql code will take the table name dynamically.........
    soumen

    Try this thread..
    Is it possible to export a pl/sql region as a csv file?

  • HP Officejet 6700 installed desktop program displays xml text files when run

    Afer installing the printer software and drivers on 64 bit Windows 7 Pro, the desktop shortcut and start menu entry "HP Officejet 6700" returns xml code text files .  When the icon is first clicked a window asks me to choose which installed printer, then displays two xml files.  The first file is titled "HPSPProgress" the second "HPSolutionPortal" using windows notepad.
    The shortcut points to the following:
    "C:\Program Files\HP\HP Officejet 6700\Bin\HP Officejet 6700.exe" -Start UDCDevicePage
    The printer drivers and web based access run fine, and the desktop installed HP Scan program runs fine too. All printer functions work correctly. But this one desktop installed program will not run. 
    I have uninstalled, rebooted  and re-installed multiple times as administrator and with various compatibility settings with no success.  I have tried to install from CD as well as over the internet with the same result.
    Advice please.
    This question was solved.
    View Solution.

    Hey,
    I would advise running the patch fix posted by Kyle_W in the 4th message of the thread linked below.
    http://h30434.www3.hp.com/t5/Notebook-Operating-Sy​stems-e-g-Windows-8-and-Software/officejetpro-8600​...
    Let me know if this fixes your issue,
    Jason
    -------------How do I give Kudos? | How do I mark a post as Solved? --------------------------------------------------------
    I am not an HP employee.

  • Importing XML Text files with Indesign friendly 'Carriage Returns'

    Hi,
    I have a question wrt importing XML into Indesign.  I have my text stored in Excel (Fig A) and intend to export as an XML file where each line will represent each page.  However, my first attempt failed to treat the 'carriage returns' as I'd envisaged:
    The 'carriage returns' used within an Excel cell (ALT-ENTER) are maintained when transforming to a CSV file (Fig B).  However, when converting to an XML file, the conversion only takes place on a line by line basis and hence the XML file becomes incomplete (Fig C).
    So, it appears I need to make sure that the CSV file contains one line per entry, while also maintaining the actual carriage returns in my source spreadsheet and for Indesign to recognise them.  In order to do this, I'll need to substitute the 'carriage returns' in my excel column to be represented by a new set of characters.  My question is how can I let Indesign know to recognise this set of characters to be converted to a carriage return, when importing text.
    For example, if this set of characters was '%%%%%%', then my new csv file would look like Figure D and the XML would be produced correctly, like Figure E.  Then importing this XML file to InDesign, the carriage returns would automatically be reinstated, hopefully.
    I hope someone can help me as I am only starting out in Indesign and feel Im running before I can walk by venturing into the XML/Indesign arena too soon.
    Best Regards
    Luke

    Hi,
    Thanks for all the responses.
    With regard to XML, it could well be an issue has crept in because I am using another utility to convert my csv's to xml and maybe there are better options out there. I will take a look for other utilities and try that (Its not possible from Excel easily, even though there is an option to save as an XML file).
    Secondly, because the XML was readable by internet explorer, I assumed it had a satisfactory standard XML format which would be accepted by any program, including InDesign.  This proved true, since the XML file i generated was actually recognised by my Indesign document and populated the tags correctly, albeit without any carriage returns. 
    When I save my excel sheet as a csv, it does actually hold the carriage returns causing multiple lines per entry, hence why I need to substitute the actual carriage returns in my excel sheet to a alternative character set so that the entry remains on one line.
    Re: Double quotes on text fields.  Im sorry, I didnt realise I had commas in my sample csv example.
    I should have corrected it, but I intend on using semi-colons as my csv delimiter and don't intend on having semi-colons in my excel sheet itself, so I possibly won't need any double-quotes.
    So, it looks like this is what I need to do ;
    i)   Add a column in Excel which substitutes all the carriage returns with a line break identifier (^n).
    ii)  Convert Excel file to a semi-colon csv holding this new column,
    iii) Convert csv file to XML using a good CSV->XML utility,
    iv)  Add the respective XML tags to my INDD document,
    v)   Add a GREP rule which does a find/replace on all instances of ^n and replace with a line break,
    vi)  Import the XML file,
    vii) Apply the find/replace GREP rule on the whole document. Carriage returns on my text fields should be consistent with my original excel sheet.
    Thanks for all your help fellas.  Will report on how I get on once Im done.
    Best Regards
    L

  • I want to embed text AND image from same XML file

    Hey,
    I got following problem:
    I want to put 1 image AND my text in 1 external XML file.
    I can load either one of them in seperate XML files.
    I need this because I want my content to be scrollable on my website and with this my image has to scroll with my text.
    I got following AS3 put in now:
    (ACTIONSCRIPT3.0)
    //LOADING EXTERNAL XML & IMAGE//
    var xml:XML;
    var urlRequest:URLRequest = new URLRequest("externaltext/welkom_content.xml");
    var urlLoader:URLLoader = new URLLoader();
    urlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete);
    urlLoader.load(urlRequest);
    function urlLoader_complete(evt:Event):void {
        xml = new XML(evt.target.data);
        welkom_content_text.text = xml.toXMLString();
    //LOADING EXTERNAL PICTURES//
    var xmlData:XML=new XML();
    var pHeight:Number = 200;
    var pWidth:Number = 200;
    var listLoader:URLLoader = new URLLoader( new URLRequest("externaltext/testxmlimage.xml") );
    var picLoader:Loader = new Loader();
    listLoader.addEventListener(Event.COMPLETE, gotList);
    function gotList(evt:Event):void {
       var xmlData:XML = XML(listLoader.data);
       var numImages:Number = xmlData.pix.length();
       var stImage:String = xmlData.image
    picLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, gotPic);
    picLoader.load( new URLRequest(stImage) );
    listLoader.removeEventListener(Event.COMPLETE, gotList);
    function gotPic(evt:Event):void {
    var thisBmp:Bitmap = Bitmap(evt.target.content);
    thisBmp.x = 0;
    thisBmp.y = 0;
    var thisWidth:Number = thisBmp.width;
    var thisHeight:Number = thisBmp.height;
    thisBmp.scaleX = pWidth/thisWidth;
    thisBmp.scaleY = pHeight/thisHeight;
    addChild(thisBmp);
    picLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, gotPic);
    (/ACTIONSCRIPT3.0)
    And my XML file for the text content is as following:
    (XML TEXT FILE)
    <?xml version="1.0" encoding="utf-8"?>
    .... ALL OF MY CONTENT
    (/XML TEXT FILE)
    And for my image the XML file is as following:
    (XML IMAGE FILE)
    <?xml version="1.0" encoding="utf-8"?>
    <imagelist>
    <image>externaltext/testpicxml.jpg</image>
    </imagelist>
    (/XML IMAGE FILE)
    Does anyone know how to fix this and how to do it?
    Thanks in advance!
    Every help is appreciated!

    Thanks!
    And again... I'm doing some things wrong.. I feel dumb!
    Trying to make a website in ASP.NET almost whole day, so my head isn't set to AS3 at all..
    My code now to embed XML looks like:
    var xml:XML = new XML();
    var XMLURL:String = "externaltext/welkom_content_pic.xml";
    var myXMLURL:URLRequest = new URLRequest(XMLURL);
    var myLoader:URLLoader = new URLLoader(myXMLURL);
    var page:Sprite = new Sprite();
    myLoader.addEventListener("complete", urlLoader_complete);
    function urlLoader_complete(evt:Event):void {  
    addChild( page );
    page.addChild( welkom_title_text );
    page.addChild(  welkom_content_text );
    page.addChild(  welkom_image_holder );
    xml = new XML(evt.target.data);   
    welkom_title_text.text = [email protected]();   
    welkom_content_text.text = xml.item.toString();       
    //use URLLoader to load the image from the path [email protected]()
    Probably set some things wrong..
    And what exactly do I have to set to load my image with it?
    We were all a beginner once.. but I'm the uber annoying beginner I think... hehe
    I probably won't be answering untill thursday, because I got a day off, so..
    Thanks!!!!!!!!!!!!!!!!

  • How to load Test data from a Text file in ECATT

    Hi,
    I have created a test configuration with a test script, system data container, and test data container.
    I have done the recording of a transaction and created the script. Parameterization is done for the script and have imported those parameters from script in to the data container.
    I am trying to load a the data from a text file on the local work-station. The data is not being read.
    Please explain this in detail (step by step) as I am very new to ECATT.
    I am trying this on SAP ECC 6.0 IDES server.
    Thanks in Advance
    Vikas Patil

    Please explain this in detail (step by step) as I am very new to ECATT.
    Thanks in Advance
    Vikas Patil

  • How to load data in plain-text file into database by using EJB?

    Hi,
    We need to develop an on-line application which requires us to load input data
    from a selected plain-text file on the Web server (iplanet server) into the backend
    oracle database. How could I use EJB to make it happen? it seems like using Entity
    EJB is not feasible.
    Really appreciate your help!
    Corona

    Hi Corona,
    "Corona Fang" <[email protected]> wrote in message
    news:3f3b0ea3$[email protected]..
    We need to develop an on-line application which requires us to load inputdata
    from a selected plain-text file on the Web server (iplanet server) intothe backend
    oracle database. How could I use EJB to make it happen? it seems likeusing Entity
    EJB is not feasible.If you are talking about loading thousands of records,
    the preferable way is using plain JDBC calls utilizing
    batch methods.
    Regards,
    Slava Imeshev

  • Text file manipulation before load to ODS

    Hello Experts,
    I have a text file with 3 fields(comma separated): GLCode (Number), Desc1 (Char),
    Desc2(Char) and need to load it into BW.
    My Text file looks like:
    1011.00,"Mejor PC Infrastructure","This line is ok."
    1012.00,"Telephone Equipment $","This line ends in next line.    Need to add next line,
    1)Need to change the equipment immediately.
    2)Take immediate action"
    1013.00,"V1 Major Computer Server Infrastructure # Equip","For purchases
    of components that make up the company's network, such as servers, hubs, routers etc."
    1014.00,"Flash Drive","Need to provide all IT Developer"
    This is how file looks like. Now I need the followings:
    1. Need to remove the space and need to adjust the splitted line into one. Say here
    line/record 2 is splitted into 3 lines and need to adjust in 1 line.
    2. In Line 5 (Record 3) data splitted into 2 lines and need to make 1 line.
    3. Need to remove bad characters.
    4. Load into ODS after cleanup.
    Need guidance, example.
    Thank you.
    Regards,
    Bhakta
    Could someone help me please how to proceed ?

    Hi,
    Go to Details tab in monitoring.
    Just check for any packages are in yellow.
    If any package i yellow then right click and take the Update manually option for that package only.
    Or else you have to delete the request from the target and make the request in to red in monitor under Status tab.
    Now you can try to load the data.
    This is because of IDocs not processed successfully.
    Regards,
    Venkat

  • Combine Text File & Image

    I am needing a script that will take a text file that has an image URL and 2 lines of text and create one image out of the URL image with the 2 lines of text underneath it all in one image.
    So the text file would contain:
    http://www.url.com/to/image
    Text Line 1
    Text Line 2
    I need the final image to look like the file I have attached:

    well, this is 95% there.  The last request (the 3x4 card thing) is possible, but involves some complexities. Image Events can scale images, but it only does it by proportion or pixels, so without knowing the dpi or initial size of the images in question I don't know how best to do the calculations.  are the images all the same size, orientation and resolution, or will we have to dig the info out on a per-image basis and do the math?
    At any rate, here's what we have so far, in three parts.  Create a folder called Source Folder on the desktop (or change line 2 of the script to point to a preferred folder location).  You'll need to make two plain-text files in that folder with the following contents:
    1. data file.txt
    http://www.freeimagesarchive.com/data/media/223/waterfall.jpg"
    So long!
    And thanks for all the fish!
    2. template file.html
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
    </head>
    <body>
    <img alt="" src="***ImageSource***"
    height="400" width="600"><br>
    <br>
    <font face="Lithos Pro"><b>***Text1***</b></font><br>
    <br>
    <b><font face="Lithos Pro">***Text2***</font></b><br>
    </body>
    </html>
    Copy the following script into the applescript editor and run it.  it will (knock wood) create a jpeg file in the Source folder.
    -- I'm putting intermediary files in /tmp so you don't have to think about deleting them
    set tempFolder to (do shell script "mktemp -d /tmp/temp.XXXX") & "/"
    set sourceFolder to POSIX path of (path to desktop from user domain) & "Source Folder/"
    -- set up convenience paths
    set dataFilePath to sourceFolder & "data file.txt"
    set htmlTemplatePath to sourceFolder & "template file.html"
    set htmlWriteoutPath to tempFolder & "tempHTML.html"
    set pdfWriteoutPath to tempFolder & "tempPDF.pdf"
    set finalImagePath to sourceFolder & "output image.jpg"
    -- read the data file
    set {imageSource, lineOne, lineTwo} to paragraphs of (read dataFilePath)
    -- get, modify and save the html template
    set htmlText to read htmlTemplatePath
    set htmlText to swapText(htmlText, "***ImageSource***", imageSource)
    set htmlText to swapText(htmlText, "***Text1***", lineOne)
    set htmlText to swapText(htmlText, "***Text2***", lineTwo)
    set htmlWriteoutPath to tempFolder & "temp.html"
    set fp to open for access htmlWriteoutPath with write permission
    write htmlText to fp
    close access fp
    -- convert to pdf
    do shell script "cupsfilter " & quoted form of htmlWriteoutPath & " > " & quoted form of pdfWriteoutPath
    -- convert to jpeg
    tell application "Image Events"
              set thePDFImage to open pdfWriteoutPath
      save thePDFImage as JPEG in finalImagePath
      close thePDFImage
    end tell
    -- utility handlers
    on tid(input, delim)
      -- generic text item delimiter handler
              set {oldTID, my text item delimiters} to {my text item delimiters, delim}
              if class of input is list then
                        set output to input as text
              else
                        set output to text items of input
              end if
              set my text item delimiters to oldTID
              return output
    end tid
    on swapText(input, x, y)
      tid(tid(input, x), y)
    end swapText

  • Can I create a xml or text file?

    Hi,
    I would like to be able to create a text file or xml file
    using users input(this is not for a web site so do have server
    capabilities)
    The file will be smiler to this with the user input in {}
    Thanks for all your help

    Hey there,
    Flash being a web based application doesnt allow writing any
    files other than temp cookies or the ASO files. Now these files are
    useless for the medium you are describing here.
    Due to security reasons flash doesnt support XML/Text
    writing, but has very good support on the reading XML/Text file. If
    you are using the idea for a website then, maybe PHP, ASP along
    with SQl might help you save data from flash to a database. And if
    you have ideas of keeping this idea desktop based, maybe you can
    use MDM Zinc, even PHP, or Visual Studio (where ExternalCallbacks
    can be used).
    You can decide.

  • How to Save a text file in the server?

    hello
    i just want to save an text file in the server.
    My idea is to load an xml text file maybe make some changes
    and then save it back to the server, so i can avoid all the
    database/php work because i know nothing about it.
    thank you

    hello
    i just want to save an text file in the server.
    My idea is to load an xml text file maybe make some changes
    and then save it back to the server, so i can avoid all the
    database/php work because i know nothing about it.
    thank you

  • Saving results displayed on jsp into a text file using struts actions

    Hi,
    i am developing a web application using struts...the basic functionality of the system is to retrieve data from the database based on the search conditions given by the user. Hence for different search criteria there are different JSP result screens. Struts and persistence are being used. The user should be able to save/view the data loaded on the screen in a text file when he clicks on the save button.
    I am supposed to write an action for fileoutput which can be used by all the result screens...instead of writing the same code in all the jsp pages...how do i go about it? I have already written an action class for the same but when i click on the save button a blank IE screen opens up instead of the open /save dialog box...i have also added mappings for the same in struts config xml file....any suggestions?

    Again, you have posted to the wrong board. SignalExpress is an application written in LabVIEW.

  • How to adjust splitted lines into one line in Text file?

    Hi Guys,
    I have a text file with 3 fields(comma separated): GLCode (Number), Desc1 (Char), Desc2(Char) and need to load it into BW.
    My Text file looks like:
    1011.00,"Mejor PC Infrastructure","This line is ok."
    1012.00,"Telephone Equipment $","This line ends in next line.   
    1)Need to change the equipment immediately.
    2)Take immediate action"
    1013.00,"V1 Computer Server Infrastructure # Equip","For purchases
    of components that make up the company's network, such as servers, hubs, routers etc."
    1014.00,"Flash Drive","Need to provide all IT Developer"
    This is how file looks like. Now I need the followings:
    1. Need to remove the space and need to adjust the splitted line into one. Say here
    line/record 2 is splitted into 3 lines and need to adjust in 1 line.
    2. In Line 5 (Record 3) data splitted into 2 lines and need to make 1 line.
    3. Need to remove bad characters.
    Could someone help me please how to proceed ?
    Regards,

    Not quite correct by my testing.  Try:
    $i=0
    Get-Content .\test.txt | ForEach {
    If ($i%2){
    ("$Keep $($_)").Trim()
    }Else{
    $keep=$_
    }$i++
    Good catch!
    Boe Prox
    Blog |
    Twitter
    PoshWSUS |
    PoshPAIG | PoshChat |
    PoshEventUI
    PowerShell Deep Dives Book

  • How to load color table in a indexed mode file??

    How to load color table in a indexed mode file??
    Actually, if i opened a indexed file and want to edit color table by loading another color table from desktop (or any other location), any way to do this through java scripting??

    continuing...
    I wrote a script to read a color table from a GIF file and save to an ACT color table file. I think it might be useful for someone.
    It goes a little more deeper than the code I posted before, as it now identifies the table size. It is important because it tells how much data to read.
    Some gif files, even if they are saved with a reduced palette (less than 256), they have all the bytes for the full color palette filled inside the file (sometimes with 0x000000). But, some gif files exported in PS via "save for web" for example, have the color table reduced to optimize file size.
    The script store all colors into an array, allowing some kind of sorting, or processing at will.
    It uses the xlib/Stream.js in xtools from Xbytor
    Here is the code:
    // reads the color table from a GIF image
    // saves to an ACT color table file format
    #include "xtools/xlib/Stream.js"
    // read the 0xA byte in hex format from the gif file
    // this byte has the color table size info at it's 3 last bits
    Stream.readByteHex = function(s) {
      function hexDigit(d) {
        if (d < 10) return d.toString();
        d -= 10;
        return String.fromCharCode('A'.charCodeAt(0) + d);
      var str = '';
      s = s.toString();
         var ch = s.charCodeAt(0xA);
        str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
      return str;
    // hex to bin conversion
    Math.base = function(n, to, from) {
         return parseInt(n, from || 10).toString(to);
    //load test image
    var img = Stream.readFromFile("~/file.gif");
    hex = Stream.readByteHex(img);      // hex string of the 0xA byte
    bin = Math.base(hex,2,16);          // binary string of the 0xA byte
    tableSize = bin.slice(5,8)          // Get the 3 bit info that defines size of the ct
    switch(tableSize)
    case '000': // 6 bytes table
      tablSize = 2
      break;
    case '001': // 12 bytes table
      tablSize = 4
      break;
    case '010': // 24 bytes table
      tablSize = 8
      break;
    case '011': // 48 bytes table
      tablSize = 16
      break;
    case '100': // 96 bytes table
      tablSize = 32
      break;
    case '101': // 192 bytes table
      tablSize = 64
      break;
    case '110': // 384 bytes table
      tablSize = 128
      break;
    case '111': // 768 bytes table
      tablSize = 256
      break;
    //========================================================
    // read a color (triplet) from the color lookup table
    // of a GIF image file | return 3 Bytes Hex String
    Stream.getTbColor = function(s, color) {
      function hexDigit(d) {
        if (d < 10) return d.toString();
        d -= 10;
        return String.fromCharCode('A'.charCodeAt(0) + d);
      var tbStart = 0xD; // Start of the color table byte location
      var colStrSz = 3; // Constant -> RGB
      var str = '';
      s = s.toString();
         for (var i = tbStart+(colStrSz*color); i < tbStart+(colStrSz*color)+colStrSz; i++) {
              var ch = s.charCodeAt(i);
              str += hexDigit(ch >> 4) + hexDigit(ch & 0xF);
          return str;
    var colorHex = [];
    importColors = function (){
         for (i=0; i< tablSize; i++){ // number of colors
              colorHex[i] = Stream.getTbColor(img, i);
    importColors();
    // remove redundant colors
    // important to determine exact color number
    function unique(arrayName){
         var newArray=new Array();
         label:for(var i=0; i<arrayName.length;i++ ){ 
              for(var j=0; j<newArray.length;j++ ){
                   if(newArray[j]==arrayName[i])
                        continue label;
              newArray[newArray.length] = arrayName[i];
         return newArray;
    colorHex = unique(colorHex);
    // we have now an array with all colors from the table in hex format
    // it can be sorted if you want to have some ordering to the exported file
    // in case, add code here.
    var colorStr = colorHex.join('');
    //=================================================================
    // Output to ACT => color triplets in hex format until 256 (Adr. dec 767)
    // if palette has less than 256 colors, is necessary to add the
    // number of colors info in decimal format to the the byte 768.
    ColorNum = colorStr.length/6;
    lstclr = colorStr.slice(-6); // get last color
    if (ColorNum < 10){
    ColorNum = '0'+ ColorNum;
    cConv = function (s){
         var opt = '';
         var str = '';
         for (i=0; i < s.length ; i++){
              for (j=0; j<2 ; j++){
                   var ch = s.charAt(i+j);
                   str += ch;
                   i ++;
              opt += String.fromCharCode(parseInt(str,16));
              str = '';
         return opt
    output = cConv(colorStr);
    // add ending file info for tables with less than 256 colors
    if (ColorNum < 256){
         emptyColors = ((768-(colorStr.length/2))/3);
         lstclr = cConv(lstclr);
         for (i=0; i < emptyColors ; i++){
              output += lstclr; // fill 256 colors
    output += String.fromCharCode(ColorNum) +'\xFF\xFF'; // add ending bytes
    Stream.writeToFile("~/file.act", output);
    PeterGun

  • Help With Loading an Image In AIR

    I need to load an image (GIF) with AIR using File and FileStream, but can't figure out how to do it. I need to load the image into a Bitmap or BitmapData object, so I can't use the loader class. Here's what I have so far:
    import flash.display.*;
    import flash.events.*;
    import flash.filesytem.*;
    import flash.net.FileFilter;
    import flash.utils.ByteArray;
    import flash.geom.Rectangle;
    var file:File = File.documentsDirectory;
    var myImage:BitmapData;
    var myFilter:FileFilter = new FileFilter("GIF Image","*.gif");
    file.addEventListener(Event.SELECT,loadImage);
    file.browseForOpen("Open",[myFilter]);
    function loadImage(e:Event):void{
    var stream:FileStream = new FileStream();
    stream.open(file,FileMode.READ);
    var bytes:ByteArray = new ByteArray();
    stream.readBytes(bytes);
    stream.close();
    //By the way, this image is a special format and will always be 160 by 160 pixels.
    myImage = new BitmapData(160,160);
    bytes.position = 0;
    myImage.setPixels(new Rectangle(0,0,160,160),bytes);
    addChild(new Bitmap(myImage));
    However, this never works. I always get this error:
    Error #2030: End of file was encountered.
    I don't quite understand why. Help would be much appreciated.

    I already know how to do that, but I specifically stated in my post that I can't use the Loader class. The reason for that is that my program is an image manipulation program, and I need to load the data into a BitmapData object. However, since I originally made my post, I have found some more information. I used trace() to find out the length of the ByteArray I was loading the data into, and then the position after trying to create the BitmapData object, like so:
    import flash.display.*;
    import flash.events.*;
    import flash.filesytem.*;
    import flash.net.FileFilter;
    import flash.utils.ByteArray;
    import flash.geom.Rectangle;
    import flash.errors.EOFError;
    var file:File = File.documentsDirectory;
    var myImage:BitmapData;
    var myFilter:FileFilter = new FileFilter("GIF Image","*.gif");
    file.addEventListener(Event.SELECT,loadImage);
    file.browseForOpen("Open",[myFilter]);
    function loadImage(e:Event):void{
         var stream:FileStream = new FileStream();
         stream.open(file,FileMode.READ);
         var bytes:ByteArray = new ByteArray();
         stream.readBytes(bytes);
         stream.close();
         trace(bytes.length); //Outputs: 4631
         //By the way, this image is a special format and will always be 160 by 160 pixels.
         myImage = new BitmapData(160,160);
         bytes.position = 0;
         try{
              myImage.setPixels(new Rectangle(0,0,160,160),bytes);
         } catch(e:EOFError){
              trace(bytes.position); //Outputs: 4628
         addChild(new Bitmap(myImage));
    As the comments show, though the ByteArray is 4631 bytes, it is only read up until byte number 4628. Then it throws an error. Any idea what's going on?

Maybe you are looking for