Tuesday, March 10, 2009

Flash Animation Player Update

Okey dokey, it's been updated and the previous links will no longer work. Now you have to use:
animation_player.swf?v_spd=20&v_nbr=106&v_frm=jpg

The only difference is adding in the v_frm variable, which lets you specify what type of images you have.

Now, to make it all work you need a few things. First, you need to download the swf file on that link up there and then you need to plug it into your site wherever you want it like nyah:
<embed src='animation_player.swf?v_spd=20&v_nbr=106&v_frm=jpg' width='269' height='211'>

Then you need to name all your files in sequential order (starting with 1) like so:
image_1.jpg
image_2.jpg
image_3.jpg
image_4.jpg
...

You need to put in the width and height of your images (all images need to be the same size), put in the image format, put in the number of images you have to animate and then put in the speed (in milliseconds) that you want it to run. And viola!

It probably doesn't need mentioning, but you of course need the images to be in the same directory as the swf file.

4 comments:

Kirk Is said...

betatesting...maybe alpha...

(one of my stupid nitpicks, when you say "speed" you mean "delay in millis", right? (higher values of speed usually means go faster...))

So I tried to set this up but didn't get good results. I'm not 100% sure I set everything correctly, I had to doublecheck a few parameters to get it right...

http://kirkjerk.com/temp/rocky/test.html

I avoided using index.html so you can see the files I'm trying to use... 11 awesome frames of Rocky pushups (though ripped from a youtube vid and crammed through a GIF.)

Locally, it flashes some frames, then seems to get stuck repeating 2 or 3, plus there's an offset problem where the image is "high" in the frame, black showing underneath

On my webserver, IE6 just shows a black panel and Firefox gives me an endless series of "Transferring data from kirkjerk.com"

You should probably check to make sure the swf file didn't get corrupted or anything. (just a thought, I'm just less used to downloading other folks swf, though I downloaded both from firefox and lynx w/ similar looking results.)

Kirk Is said...

OK, I was dumb and forgot that it would be case sensitive on my unix server. So I fixed the files and now it looks the same as it did on my desktop.

(Idea: it would be nice to optionally specify the file prefix as a param, rather than have to have it be "image_")

Is it caching the images at all? It looks like it's constantly loading each image requested, quite a bandwidth killer if so...

Also, 1k? Cute! I had to double check to make sure that wasn't the issue. But of course 1K doesn't mean much if it's trying to pull down a 100 15K frames a second

Onideus said...

It is a delay a milliseconds, your example would work better at around 100 than 10. The images are cached, on the user end, so it only initially loads them from the server, it is constantly unloading and reloading the images though, from the cache. I did experiment with leaving them loaded and using the ._visible option to show and hide them sequentially, but it didn't work so well.

Part of the problem is that it's just too damn fast, so fast that it can easily trip over itself, running one function before another actually has time to finish (not code wise, but display wise).

As far as the images not aligning and so forth that's a problem with your images. Essentially what you did was just make a really short video clip, rather than a seamlessly repeating animation. What you could do is reverse the frame, having a total of 21, making number 10 into 12, 9 into 13 and so on. That would create a pseudo repetitive animation and it would lose that flick/jerkyness.

Onideus said...

I take that back, it's already setup that way. I think the script is tripping over itself with so few frames, I'm going to try and slow it down (via scripting) to see if I can't correct it.