Jump to content

read bytecode of an uncompressed swf into a binary array


ajoo

Recommended Posts

Hi Kicken,

 

Thanks for the reply. I want to read the swf as it's binary executable form and store that into an array.

 

Bytecode is the binary executable that is loaded into memory when executing a .swf file.

 

Thanks.

Link to comment
Share on other sites

I'm not familiar with the SWF format so maybe I'm not understanding something, but you can load the file into a string by just doing file_get_contents('whatever.swf') and stuff that string into your array.

 

If you need to extract a specific part of the data then use substr. If you need to decode some binary data such as integer lengths to know how much data to extract use unpack.

Link to comment
Share on other sites

Hi Kicken, 

 

Thanks for the reply. I have actually tried out your suggestion and I could manage to send the swf, loaded into a string using file_get_contents, into flash. If I echo out the string in php, this is what it gives. 

 

 

CWS ~xSKOQþf¦ó(¥*/I[Ñ!.JJ£c´>k£SÄ7u(Sh§dz¡5!)>¢h¢qUÂÂğàÂ+ë҈㊝ÃqeL©çÎÒ.HŜs¿{ÏwÎùνUÈ9 ôèp±ô]ÍæYiW6я1dK%vyÉ4§m¦^fkΨN°¢çÍêefËÌ.Zó8°*;ïą́2äl۰Øtö*XªÄÍR^gŒ_°B¦ÜØ%Y9lAÏÈë&åbv9jÃÝ{7uZ2îúãxqiÝX0öJ Gk
P÷CJ}B"u}"@à¸Ԋû8.Ôð
¼ïJ8üJDõ^hr®ûJ6Z÷Ѷ&;K5Ý Óö÷TøD'a»Â?·+åÖáa6ɗräե´N·â s¸kÿCο;{õ4·È7=^|Ø9xhÂaémû&&U4#>óÛɯÛïüSÝ}ýý±Ç[;ÅhøÎV
í¡";"k· üÿ¸¯srÌ(3d¬eÝ,Î
OÞ-iâv+:õJ^p§áÄÃn,Î'âåJ9ÓX6ÌHý.G}ÒÍSACé"¦<zߎ­Î2+A½!LÂmÁPJ@s#I½?¯cOOì¬Gë¿PóA¸#$¹Í7çȍ=[¤lÍ0eȂrÎ.҅æÕ¦jþQrTþڛÀLpXÆOBMѽO£­J6Îéë{·Röñ2C^~^myu5? үÈ÷ÝûǰG}jPm#tôP\ùñÀyf.æ1^=IkcrÔPù`6vÞg ¿nño
 
 
Length : undefined

 

But strangely, the length of the string = undefined in Flash. So I am unable to manipulate it. Does this have to do with the fact that the .swf is a binary file format? How can I then store and retrieve it back as a byteArray? 

 

Thanks loads.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.