Categories
AS3 Flash

My first AIR app: SWF2GIF-banner – part 1

Sometimes, and I’m not very fond of them, I need to make banners…..
The animation part is not so bad, but making the different sizes…. that can be a drag.
And after you made the SWF banners, you also need to make the animation in GIF.

This is how I use to do it:

  1. make the SWF banner
  2. embed it in a html page with a background color that is not in the banner itself (a border around the SWF banner helps)
  3. make snapshots of the animation
  4. open photoshop >> (I used a action for this part….)
  5. place all the images in one document
  6. cut the browser from the screenshot
  7. select the background-color reverse the selection and cut
  8. make a animation from all the layers (end photoshop action)
  9. save

I have never made an AIR application but I think that it should be possible to make a SWF2GIF converter in AIR.

Stuff what I need to find out:

  • browse for a file
  • load that file into air
  • take snapshots of the animation
  • controle the frame rate of the animation
  • make a animated gif
  • save everything
  • etc.

Lets start with some basic:
I’m still working on CS3, and it seems that AIR default is installed with CS4
Installing the Adobe AIR update for Flash CS3

English: http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html
Dutch: http://help.adobe.com/nl_NL/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7fc3.html

You can also use FlashDevelop 3.0.1, AIR is also installed with that program and in combination with Flex sdk you don’t even need Flash.

Because I’m not finished with it (I will only work on it when I have to build banners) I will post now and then some parts of the code.

For some reason I couldn’t find the code to load SWF into AIR using “browse”.

[as light=”false” wraplines=”true”]
private function openSwfFile(e:MouseEvent = null):void
{
var imagesFilter:FileFilter = new FileFilter("Flash SWF", "*.swf");
myFile = new File();
myFile.addEventListener(Event.SELECT, selectHandler);
myFile.browseForOpen("Open", [imagesFilter]);
}

private function selectHandler(event:Event):void
{
myFile.removeEventListener(Event.SELECT, selectHandler);
loadSWF(myFile.url);
}

private function loadSWF(inName:String):void
{
trace( "Main.loadSWF > inName : " + inName );
mLoader = new Loader();
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderComplete);
mLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onErrorComplete);
mLoader.load(new URLRequest(inName));
}
private function onLoaderComplete(e:Event):void { startOnEnterFrameHandler(); }
private function onErrorComplete(e:IOErrorEvent):void { trace( "Main.onErrorComplete > e : " + e ); }

private function startOnEnterFrameHandler():void
{
_movie.addChild(mLoader);
// _movie.addEventListener(Event.ENTER_FRAME , onEnterFrameHandler);
}
[/as]
just use a button to activate.

I know the code is not complete… and that some classes have strange names… it’s work in progress.

Categories
Flash Open source / Freeware

Convert SWF to AVI – part 3

Update #1: when I wrote this post, this all worked… And I have good hope that the site will return. For now I can only say: try again later…. 🙁
Update #2: well the site didn’t return: it’s as dead as a doorknob … that’s too bad. I couldn’t find a place where you can download it now, so I searched my external harddrive if I had the original zip-file, and I did. So you can download the file at http://www.box.net/shared/u5utxytazn#swfdrop
Update #3: Today I needed this for a good export to AVI and found out that swfdrop only works if the animation is on the main (root) timeline… so I used the trick introduced by swf2avi > read more here

Flash is not very good in converting animations in to AVI’s because you lose the animations in the nested movieclips. You can export to .MOV but that’s not a native Windows video codex.

So you want to convert a SWF to AVI (SWF2AVI) or another videofile/codex (without spending any cash)?
As the title of this post suggest: I have written about this subject before: in part 1 and part 2.

And I found a new freeware tool to help you convert your SWF: www.swfdrop.com.
SWF DROP: Version 0.9c

Download: it think this program is very useful, but the creators think different and killed the original site. I still have the original swfdrop.zip and that one can be downloaded here:http://www.box.net/shared/u5utxytazn#swfdrop.
Remember: I have nothing to do with this program, I only think it’s useful.

This project is also freeware and more up-to-date: October 2007 (swf2avi is last updated in 27-08-2002 & swf>>avi is last update in 07.20.2005).

“SWFDROP” is the SWF converter for Windows to convert Flash SWF file format to AVI format. It’s the best tool to successfully convert any Flash 6/7/8/9 SWF file into a video AVI file that you can play with Windows Media Player (or any video player), where all other tools dont work. These, along with a variety of video encoding options, make SWFDROP the best choice for you productivity!

A little preview: you can figure it out, trust me.

It’s very easy to use, you can use the codex installed on you computer and it’s very fast

Create a movie that will load the movie that you want to export.

  • make this movie the same size as the original
  • use the same frame rate
  • only difference with to movie you want to load is the number of frames: use the number that you want (for example: 1000)

Because swf2avi is based upon as2, this code is also as2
[as]
// code in frame 1
loadMovieNum(‘name_of_the_movie_you_want_to_render.swf’, 1);
stopAllSounds();
[/as]