Jump to content

read bytecode of an uncompressed swf into a binary array


ajoo

Recommended Posts

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.

Edited by ajoo
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.