Can't snow a snowman...and my middle name's Frosty!

Creating Flash Animations on Linux - part 5

Date/Time Permalink: 05/08/07 06:12:24 pm
Category: Flash

The Mad Flasher has struck again. View today's abomination in the eyes of the Web.

It's interactive! The switches switch! The lights light! The snozzberries taste like snozzberries!

This is my first interactive Flash animation... Mostly inspired by this example. In fact, it's the exact same method, done for three switches and bulbs.

Le code listing:

.flash bbox=300x300 fps=50

  .jpeg background "../icon_image/wood_bg.jpg"
  .jpeg off_switch_idle "../icon_image/switch_off_idle.jpg"
  .jpeg off_switch "../icon_image/switch_off.jpg"
  .jpeg on_switch "../icon_image/switch_on.jpg"
  .png bulb_off_1 "../icon_image/bulb_off.png"
  .png bulb_off_2 "../icon_image/bulb_off.png"
  .png bulb_off_3 "../icon_image/bulb_off.png"
  .png bulb_on "../icon_image/bulb_on.png"
  .box b1 width=60 height=100 color=black fill=off_switch_idle
  .box b2 width=60 height=100 color=black fill=off_switch
  .box press1 width=60 height=100 color=red fill=on_switch line=4
  .box press2 width=60 height=100 color=red fill=on_switch line=4
  .box press3 width=60 height=100 color=red fill=on_switch line=4

  .button button1
    .show b1 as=idle
    .show b2 as=hover
    .show bulb_on x=0 y=-125 as=pressed
  .end

  .button button2
    .show b1 as=idle
    .show b2 as=hover
    .show bulb_on x=0 y=-125 as=pressed
  .end

  .button button3
    .show b1 as=idle
    .show b2 as=hover
    .show bulb_on x=0 y=-125 as=pressed
  .end

  .put background x=0 y=0
  .put bulb_off_1 x=20 y=30
  .put bulb_off_2 x=120 y=30
  .put bulb_off_3 x=220 y=30
  .put press1 x=20 y=155
  .put press2 x=120 y=155
  .put press3 x=220 y=155
  .put button1 x=20 y=155
  .put button2 x=120 y=155
  .put button3 x=220 y=155

.end

This is all swfc-compiled code courtesy of SWFTools. No hugger-mugger with POVray or Bash today. I just pre-drew some simple images in Gimp, and you'll notice I didn't try to make them look special. Proof of concept. With a sledgehammer.

I've been meaning to mention along the way, swfc uses its own invented mark-up language. It, too, is still in active development, so documentation is sparse. If you get the source swfc.c, there is a static struct beginning at line 3266 which shows every possible command and parameter in this language. No kidding, in the forums they actually say, "Just read the source for now." However, it can also handle actual Macromedia Actionscript, which would be placed between the .action .end tags.

I can't wait to see what I'll code tomorrow!

Follow me on Twitter for an update every time this blog gets a post.
Stumble it Reddit this share on Facebook

suddenly the moon