Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-09-2010, 09:11 AM
Junior Member
 
Join Date: Jan 2008
Posts: 6
Default read image data

Hello

i'm trying to make a RTF generator and got a problem on how to put image in rtf.. i learned that image in RTF files were written in hex16

i've found a code to convert string into hex16.. but my problem is, how do I convert the image data into string so that i can convert it to hex16?



above is the example of a PNG file when i open it using Notepad++ and convert it to Hex16

when using this codes in SWFkit.. :
a = "HP.png"
var file = new FileStream(a, "r");
imageByte = file.readLine(a)

..imageByte only return ‰PNG (the text highlighted in green)... it's like the other data is missing, or perhaps unreadable?

but if i'm using file.read(20480), which is the size of the image,
and trace("[start]"+imageByte+"[end]"), imageByte only return

without [end]

so is there any proper way to obtain the image data either within SWFkit or AS2.0?
Reply With Quote
  #2 (permalink)  
Old 01-15-2010, 07:57 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

Please try the "StringStream.readFromFile(name)" method. The trace method cannot show the content of a binary file properly, because the binary file may contain zero, which means the end of a string.

If you still have any problem, please send a sample to our support email box. We'll be happy to help you solve it.
Reply With Quote
  #3 (permalink)  
Old 01-16-2010, 05:21 AM
Junior Member
 
Join Date: Jan 2008
Posts: 6
Default

thanks..

sstream = StringStream.readFromFile("HP.png")

now sstream.length is 20000++ compare to my 1st post which only return length 4

but when I try to view sstream in textfield, it still can't view full length, still the same as previous.. i guess it's because of end of string just like you said..

but it doesn't matter because i don't need to view the full length in text, as long as it store the correct (i hope so) length so that later i can convert it to hex16.. for that part, i'll try that later...

thanks again
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:06 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.