SWF Parser (AIR application)

Simple, but useful tool to copy image resources from your SWF files.

SWF Parser

Download: SWFParser.air (Adobe AIR is required to run this software).

Working on GUI for Flash Panorama Player I noticed there is no appropriate library for SWF authoring. I tried free libraries like sswf and swf tools, also I checked commercial ActiveX products for SWF authoring/transformation like SWF Generator and SWF Scout. They are not bad for simple manipulations on old versions of SWF files, but all of them have big problems with 9th version of Flash format, also practically they are not working with SWF library items (only with scene objects). What a pity…

Now there is a question: why not using Actionscript for SWF manipulations? I can’t find any info about this except some unanswered questions on different Flash forums. This strange because Actionscript 3 has all capabilities to work with SWF: ByteArray, zlib library, png/jpg decoders and loadBytes() function to convert the result into DisplayObject and test it on the fly. This gives a possibility to create online tools for SWF transformation. For example: there is a big problem to load and control Actionscript 1-2 files inside Actionscript 3 application (no direct communications between AVM1 and AVM2). SWF library would allow disjointing SWF resources (images, vector shapes, movieclips and so on) and control them separately. Another way: just insert some communication object like SWF Adapter to AS2 application on the fly (one additional SWF tag) and convert it into AVM1 movie.

Together with new Adobe AIR technology this will provide a powerful platform for offline SWF authoring (multiplatform: single application for Windows and Mac, and for Linux a little later).

So, SWF parser is a test of technology. Features:

  • Parse SWF format (all versions).
  • See SWF file info (version, size, FPS) and tags structure.
  • Extract all bitmap images.
  • Type path to any local or internet SWF file.
  • Drag any swf files to the application (one or more).
  • Drag direct URL to SWF file from browser’s address bar.
  • Drag extracted images to any folder to save them.
  • No image quality reduction: jpeg files are saving as is, without recompression.
  • It works for Windows and Mac.
  • It’s only 17 kb the whole application.
  • Free for use (and partially open source).

This is an example how to parse SWF file (I believe this will be useful if you want to continue this idea).
Place it to the first frame in Flash CS3 or insert it to your AS3 class.

Simple SWF parser
Written by Denis V. Chumakov 
Use this code without any restrictions.

// log string
var parseLog:String;

// handlers for SWF tags
// for example: 
// handlers[6] = parseJPEG; 
// to set your handler for DefineBitsJPEG tag.
// you can find SWF file specifications in Google.
var handlers:Array = [];

// parse SWF file
function parseSWF(data:ByteArray) {
	parseLog = "";
	data.endian = Endian.LITTLE_ENDIAN;
	var format:String = data.readUTFBytes(3);
	var compressed:Boolean = format=="CWS";
	if (format=="FWS" || format=="CWS") {
		parseLog += "SWF version "+data.readByte();
		parseLog += ", size: "+data.readUnsignedInt();
	} else {
		parseLog += "Not a Flash file.";
	data.length -= 8;
	if (compressed) {
	data.position = 0;
	var frame:Array = readBox(data);
	parseLog += "\n";
	parseLog += "Width: "+Math.round((frame[1]-frame[0])/20);
	parseLog += ", height: "+Math.round((frame[3]-frame[2])/20);
	var fps_f:uint = data.readUnsignedByte();
	var fps_i:uint = data.readUnsignedByte();
	parseLog += "\n";
	parseLog += "FPS: "+(fps_i+fps_f/256);
	var count:uint = data.readUnsignedShort();
	parseLog += "\n";
	parseLog += "Total frames: "+count;
	parseLog += "\n";
	while (data.bytesAvailable) {

// read SWF tag and call handler if present
function readSWFTag(data:ByteArray) {
	var tag:uint = data.readUnsignedShort();
	var id:int = tag>>6;
	var size:int = tag&0x3F;
	if (size == 0x3F) {
		size = data.readUnsignedInt();
	parseLog += "\n";
	parseLog += "Tag "+id;
	if (handlers[id]!=null) {
		var dump:ByteArray = new ByteArray();
		if (size!=0) {
		handlers[id](tag, id, size, dump);
	} else {
		data.position += size;
	parseLog += "\tsize: "+size;

// read compressed box format
function readBox(data:ByteArray):Array {
	var c:Array = [];
	var current:uint = data.readUnsignedByte();
	var size:uint = current>>3;
	var off:int = 3;
	for (var i:int=0; i<4; i+=1) {
		c[i] = current<<(32-off)>>(32-size);
		off -= size;
		while (off<0) {
			current = data.readUnsignedByte();
			c[i] |= off<-8?current<<(-off-8):current>>(-off-8);
			off += 8;
	return c;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.BINARY;
loader.addEventListener(Event.COMPLETE, loadComplete);
// load complete handler
function loadComplete(event:Event) {
loader.load(new URLRequest("myfile.swf"));

This entry was posted on Monday, July 2nd, 2007 at 5:34 pm and is filed under AIR, Flash. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

117 Comments so far

  1. This is freaking AWESOME!!!!! Thanks!!!

  2. Hehehe…. I was expecting some panoramic related post! ;)
    But this one is great! Thanks for letting us learn from your experience! :)

  3. Hello i can’t understand the swf parser utility !
    Maybe because i’m not regular with Action Script and English (i’m from France).
    Is there a relation with panoramic ?
    If i only have Flash MX 2004, can I use it ?

    Thanks for help

  4. I am extremely disappointed in this product. The link to the “support” page is “file not found”, the file doesn’t know how to handle NORMAL STANDARD 360 images (one image, not six pieces — I NEVER heard of that in 10 years of doing pano). There was never any HINT of that in the initial selling page.

    Now what?

  5. Support forum was reinstalled because of spammers. Use http://flashpanoramas.com/forum/
    Wrote you a mail about format convertion. It’s not a big problem to get six cube faces, Apple Quicktime is using this format more then 10 years.

  6. 2Claude: No, it’s a new type of offline applications, you do not need anything except Adobe AIR to use it (the same for Win and Mac).
    Will be very explotable in year or two, believe me. :)

  7. Hi, This is a great utility and a great example of why AIR is such a powerful technology. I’m currently putting together a searchable index of AIR applications at http://www.theairbay.com/ (should be live within a week or two) and I’m including your app in the index. I have a few questions regarding the entry for the SWF parser. Feel free to reply via email if you want.

    1. What version is this?
    2. Is it being released under a particular license?
    3. Is there a better description than what I currently have? (“Simple, but useful tool to copy image resources from your SWF files.).
    4. Will you download link remain the same or will I need to update it in the future.

    As a fellow Flash developer…thanks for pushing the envelope; it’s always a pleasure to watch :) Keep up the great work.


  8. Thanks for sharing this code. There is one piece of code I simply can not get my head around, its the readBox method. Would you be willing to send me an email with explaination (if you can find the time), I would be very gratefull. The line that gives me most problems is


    At the start off is 3 and size is 15, so in simple terms it would be

    current <> 17

    What does this do… Hmm while typing this I think I got a clue. I was under the impression that you could only push of (or discard) bits on the right side, hehe. But integers can be only 32 bits in size, so you are pushing them out on the left aswell.

    Phew, what a discovery. Thanks for sharing your code, I am learning loads!

    Greetz Erik

  9. When i try to install it I get an error – this application needs an older version of air that is no longer supported. please contact the vendor and ask him to update his program.

    It looks really neat, but could you update the program?

  10. Are you developing this to save swf files? I would love to contribute to that effort somehow

  11. I’m also getting the message about need an older Air runtime. Are you planning an update? I can’t seem to find anything but the latest Air palyer…


  12. Just wanted to say a quick thanks for posting your code; I literally spent the entire day looking for a swf bytecode manipulation library and am happy to say that this is a great foundation for building just that!

    Hope you continue to flesh out this class and look forward to seeing what else you come up with.

    Thanks again!

  13. Wow great site! Some really helpful information there.
    I’m sorry for little off-topic, but I want to ask you about design of this site.
    Did you make this template yourself or got from any templates website?
    Looks pretty cool for me. Wonderful well this reading.

  14. Hi Denis,

    I was going thru the code and description.Its pretty much neat.I really admire your knowledge on this.
    I am looking for something little diffferent.As of now I am new to this SWF and FLV thing.However,I am doing my homework to get acquainted to it.My issue is to find some programmable way to find if SWF has an embedded FLV in it.Can you guide me in this or point me to some related stuffs which helps me in finding out if the swf contains an embedded FLV?

    Thanks in advance,

  15. Hi Denis,

    I’ve been searching for a way to load in an external SWF with some user-editable input fields in it, and then save the SWF out again, with the string values they entered intact. (Like form fields in PDFs.).

    Haven’t found anything yet, but wonder if it’s possible with something based on your code? Do you have or know of a way of doing it? (I don’t have the time to decode and understand the Flash file spec unfortunately)

    Thanks for any help :)

  16. Great… Thanks a lot…

  17. great!!!
    extremely helpfull man!!! thanks just what I was looking for!!!
    I was looking for some info on manipulating swf filez with AIR… and its just here…

  18. For some reason I couldn’t get this to install. What version of Air did you compile it with? I wrote a small Air 1.0 app using this parsing code: http://www.janitor61.com/?page_id=3 I can post the source if anyone is interested.

  19. Hey there, thanks for putting this together. Couple questions for you. Where did you find the name’s of the tags? Foe example 0x4C – you have “DEFINECLASS”, I don’t see that documented anywhere in the SWF file format. Also, the air file you have for download is outdated, so I can’t install it. I was also wondering if you would post the source somewhere. I’m trying to figure out how to extract class definitions from the SWF bytecode – basically like a glorified exclude classes.


  20. Hello,

    i’m having the same problem like Pineappleclock, cannot install cause it tells me ‘i need an air update which is not available for my system’
    …very strange…running vista with air 1.5 installed

  21. Hello, Neat post. There is a problem with your web site in internet
    explorer, might check this? IE still is the marketplace
    chief and a huge portion of people will pass over your fantastic writing
    due to this problem.

    My web-site :: website :: Anton ::

  22. Downloading Cube planet typically costs funds. I will give you Dice
    World full variation which you can download listed here
    for totally free. Of course you will be in a position to perform Cube Globe in a couple of minutes right here for free,
    all you have to do is down load Cube World with the website link
    provided right here. We integrated Cube Planet crack so soon after
    you install Cube Entire world Alpha, you can perform it instantly.

    Cube Entire world is a 3D action RPG kind match that is created/designed by Wollay and his spouse.
    Cube Globe was started out in June 2011
    and now, the Alpha edition is out previously.

  23. Downloading Cube world normally charges money. I will give
    you Cube Globe total version which you can download here for
    totally free. Of course you will be able to engage in Cube Planet in a handful of minutes
    here for free, all you have to do is obtain Cube Globe with the hyperlink presented below.
    We included Dice Globe crack so after you put in Dice
    Globe Alpha, you can perform it immediately. Cube Entire world
    is a 3D action RPG type recreation that is created/developed by Wollay and his wife.
    Dice World was started out in June 2011 and now, the Alpha version is out presently.

  24. Wow, this post is pleasant, my sister is analyzing these things,
    so I am going to let know her.

  25. It’s very trouble-free to find out any topic on net as compared to books, as I found this article at
    this website.

  26. Nice blog here! Also your site loads up fast! What host are you using?
    Can I get your affiliate link to your host?
    I wish my site loaded up as fast as yours lol

  27. Hello, i read your blog occasionally and i own
    a similar one and i was just wondering if you get a lot of spam comments?
    If so how do you prevent it, any plugin or anything
    you can recommend? I get so much lately it’s driving me crazy so any help is
    very much appreciated.

  28. Can you tell us more about this? I’d care to find out
    more details.

  29. Hi, I log on to your blog regularly. Your writing style is witty, keep doing what
    you’re doing!

  30. Thanks a bunch for sharing this with all folks you actually
    recognize what you’re speaking about! Bookmarked.
    Please also talk over with my site =). We could have a hyperlink change agreement between us

  31. Hi there mates, how is everything, and what you wish for to say concerning
    this article, in my view its really awesome in favor of me.

  32. It’s awesome for me to have a site, which is good in
    support of my knowledge. thanks admin

  33. Hello colleagues, how is the whole thing, and what you
    want to say regarding this article, in my view its in fact amazing in support of me.

  34. ‘ [2] This clearly illustrates the principal concern of those included in Ninja Kingdom Hack.
    They would go a step further than neurolinguistic programming
    (NLP) by learning the personality dimensions of
    their victims, then perform a hypnotic combination of NLP with Kuji
    Kiri like a spider weaving a web around his unwitting captive.

    With some-more than 220 episodes for a 1st array alone.

    Also visit my web blog – Ninja kingdom cheat

  35. This often goes hand-in-hand with being confident, indifferent, exciting, adventurous.

    In 1053 he married his cousin, Matilda of Flanders, against the wishes
    of the Pope. Everything also closed down pretty early, even the casino closed by 2:30am.

    My web-site: best Total Conquest Cheat

  36. Excellent post. I was chechking continuously this blog
    and I am impressed! Extremely useful info specifically thee
    last part :) I care for such info much. I was seeking this particular information
    for a long time. Thank you and good luck.

  37. Very shortly this web page will be famous among all
    blogging people, due to it’s fastidious content

    Also visit my blog: suomalaisia nettikasinoita

  38. Its like you read my thoughts! You appear to grasp so much approximately this, like you wrote the e-book in it or
    something. I think that you simply could do with some p.c. to force
    the message house a little bit, but instead
    of that, that is wonderful blog. A fantastic read. I’ll definitely be back.

    Feel free to surf to my blog post spilleautomater bonus

  39. Pretty component of content. I just stumbled upon your website and in accession capital to claim that I acquire actually enjoyed account your weblog posts.

    Any way I’ll be subscribing to your feeds or even I achievement you access consistently fast.

  40. Thanks for sharing your thoughts about wordpress. Regards

  41. With havin so much content and articles do you ever run into any
    issues of plagorism or copyright infringement?
    My blog has a lot of exclusive content I’ve either created myself or outsourced but it appears a
    lot of it is popping it up all over the internet without my agreement.
    Do you know any ways to help protect against content from being stolen? I’d genuinely appreciate it.

  42. Do you know any ways to help protect against content from being stolen?

  43. With havin so much content and articles do you ever run into any

  44. Wide lapels, flared trousers, all have been a component
    and parcel of the fashion for men, prevalent

  45. Cheak Out HIgh Class Delhi Escorts :- delhiescortsservices.co.in

  46. It’s going to be finish of mine day, except before
    finish I am reading this wonderful article to improve my know-how.

  47. Needed to put you one very small observation in order to give thanks again for your personal superb solutions you have discussed on this site. It’s quite surprisingly open-handed with you in giving unhampered what exactly a lot of people could have sold for an ebook to generate some cash for their own end, most importantly now that you could possibly have tried it in the event you decided. These pointers as well acted to be the great way to fully grasp that some people have similar dream similar to mine to grasp much more concerning this matter. I am certain there are some more fun periods up front for those who discover your blog.

  48. Hi there colleagues, its wonderful article
    about tutoringand completely defined, keep it up
    all the time.

  49. cheap international roaming sim card

    SWF Parser (AIR application) | flashpanoramas.com blog

  50. Hi mates, how is the whole thing, and what you desire to say on
    the topic of this article, in my view its genuinely amazing in support of me.

  51. QuГѓВ© tal compaГѓВ±eros, Aportas mucho valor aquГѓВ­ Me encanta muy ГѓВєtil

  52. We obtained this kind of necklace around your neck as a treat by my own best ally. The item is one of the most special gifts I’ve got previously gotten. The meaning behind the necklace around your neck is literally close to and precious to be able to my personal center each time I use it!

  53. The very core of your writing while sounding reasonable at first, did not really settle well with me personally after some time. Somewhere within the sentences you were able to make me a believer but only for a while. I still have got a problem with your leaps in logic and you might do well to help fill in all those breaks. When you can accomplish that, I will certainly be amazed.

  54. Major thankies for the post.Really thank you! Fantastic.

  55. Appreciate the recommendation. Will try it out.|

  56. http://www.ninja-vouchers.co.uk

    SWF Parser (AIR application) | flashpanoramas.com blog

  57. Car Navigation System Based On Hybrid Genetic Algorithm

    “[...]SWF Parser (AIR application) | flashpanoramas.com blog[...]“

  58. There are individuals who even use their info on facebook and they store their personal
    information there. ” Needless to say I was
    frightened and sought protection from the local
    police for myself and my family. About “Lost Animals”
    are quite useful, including ugly ducklings, black cats, black sheep,
    turtles etc.

  59. He has great tranquility of heart who cares neither for the praises nor the fault-finding of men.

  60. This application is really a dark side for me, I would never have understood how it works, but for this post. I am so grateful.

  61. Having reЙ‘d this I thougТ»t it was extremely enlightening.
    I appreciatРµ you spending some tС–me and effort to put this content toЙЎether.
    I once again find myself spending a lot of time both reading Й‘nd commenting.
    But so what, it was still worth it!

  62. Videos XXX gratis esn espaГ±ol: http://videosxxxde.com

  63. maravilloso asunto, uno de vosotros estГЎ al tanto de si se suelen hallar relaciones en cam4 com, por favor contestar por privado gracias.

  64. These postures are not just poses or the forms that you may have noticed aged Chinese people practicing in parks. Do whatever it takes to survive and avoid becoming violated. Some individuals will go as much as performing out.

  65. Very interesting information, had long been looking for her. Thank you very much -> http://www.videosdeabuelas.xxx

  66. Her hand moved down his body as I licked again and again. I gathered the cum like I was licking an ice cream cone, but one had never tasted so good. So naughty I devoured the incestuous mix as I loved my aunt. My hands wrapped about her thighs, holding her as I licked and nuzzled, taking long drags.

  67. Mom laughed. “Your father did, too. Your Aunt Vicky and I were on standing orders to find him any Asian woman interested in a threesome.”

  68. Last night, when Melody and I had made love and fucked four times, we had not been quiet. My bedroom was on the third floor, sharing the attic with a storage room. Alicia’s was on the second floor but not directly beneath mine. She was the only person home last night, and she might have heard us.

  69. “His penis?”

  70. “Yes!”

  71. This design is incredible! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost
    moved to start my own blog (well, almost…HaHa!) Wonderful job.
    I really loved what you had to say, and more
    than that, how you presented it. Too cool!

  72. I’ve searched hours for this and now I found this article that surprised me, thanks mate!

  73. of course like your web site however you have to take a look at the spelling on quite a few of your posts. Many of them are rife with spelling problems and I in finding it very bothersome to tell the reality nevertheless I’ll surely come back again.

  74. Really impressive post. I enjoyed your article and planning to rewrite it on my own blog

  75. I was looking through some of your blog posts on this internet site and I think this web site is very instructive! Keep putting up.

  76. This post is in fact a pleasant one it assists new web visitors, who are wishing in favor of blogging.|

  77. Only wanna remark on few general things, The website layout is perfect, the subject matter is rattling good : D.

  78. I visit every day a few blogs and websites to read posts, except this weblog
    gives quality based posts.

  79. delicate

    SWF Parser (AIR application) | flashpanoramas.com blog

  80. I do trust all the ideas you’ve presented to your post. They’re really convincing and will definitely work. Still, the posts are too brief for starters. May just you please prolong them a little from next time? Thank you for the post.

  81. of course like your web site however you have to take a look at the spelling on quite a few of your posts. Many of them are rife with spelling problems and I in finding it very bothersome to tell the reality nevertheless I’ll surely come back again.

  82. Good post. I learn something totally new and challenging on sites I stumbleupon everyday. It will always be interesting to read content from other authors and use a little something from other sites.

  83. I’m often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark your site and hold checking for brand new information.

  84. I am continually looking online for articles that can benefit me. Thank you!

  85. I am very much pleased with the contents you have mentioned. I wanted to thank you for this great blog.

  86. Simple but useful tools!

  87. Singapore tour Attractions

    SWF Parser (AIR application) | flashpanoramas.com blog

  88. Your article reflects the issue people are concerned about. The article provides timely information that reflects multi-dimensional views from multiple perspectives. I look forward to reading quality articles that contain timely information from you.

  89. freex sex

  90. Easily exchange currency

    SWF Parser (AIR application) | flashpanoramas.com blog

  91. A good web site with interesting content, this is what I need. Thank you for making this web-site

    Samsung authorized service

  92. Awesome post. I am a normal visitor of your blog and appreciate you taking the time to maintain the excellent site. I’ll be a frequent visitor for a really long time.
    LG authorized dealers

  93. t’s really a great and useful piece of info. I’m happy that you shared this helpful info with us. Please stay us informed like this. Thank you for sharing.
    Buy flowers

  94. wooooowww
    very good content

  95. 点击这里

  96. wis

  97. china sales

    SWF Parser (AIR application) | flashpanoramas.com blog

  98. Wow! Thanks for sharing nice article.

  99. Amazing! thanks a lot for the article.

  100. I was expecting some panoramic related post! ;)
    But this one is great! Thanks for letting us learn from your experience!

  101. Really impressive post. Thank you for sharing…

  102. It’s difficult to find well-informed people in this particular topic, but you sound like you know what you’re talking about! Thanks

  103. Its really an informative post . I apprecialte you efforts and all the best. I am so happy to get this post article and nice knowledgeable information. I was looking forward to getting such a this type of intresting post whichis very helpful for us keep sharing and posting this type of article thanks for sharing.

  104. In the wake of perusing your article I was stunned. I realise that you clarify it exceptionally well. What’s more, I trust that different perusers will likewise encounter how I feel in the wake of perusing your article.

  105. good article and I am very impressed with this article, allow me to recommend this website to my friends.

  106. Good post. I study one thing more challenging on completely different blogs everyday. It would all the time be stimulating to read content from different writers and observe a little one thing from their store. I’d desire to make use of some with the content material on my blog whether you don’t mind. Natually I’ll provide you with a link in your net blog. Thanks for sharing.

Have your say

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URIs must be fully qualified (eg: http://www.domainname.com) and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.