Saturday, December 29, 2012

AS3 Three hour "rant" project

Hello again. You might have realized that I am pretty fond of AS3 for my programming projects. Without getting into the never-ending debate of what programming language is the best, the reasons I like to code in AS3 are:

  • I know the language.
  • I can code stuff very quick.
  • I can share the results online easily (Dropbox public folder)

On the negative side, I do have trouble getting my creations into all iDevices. I'll be looking into that eventually.



My "Rant" project.

Okay, so the story goes something like this. I was at work, doing my usual thing, drinking my usual Ginkgo Biloba infusion. On a side note, it took me about a month to learn those two words: "ginkgo biloba". There was a time when I call it ginkgo balboa. Oh, those fun happy days.
Anyway back to the point. It seems that I drank to much ginkgo biloba, so naturally I had to hit the restroom. I did my thing, was all happy about it and went to wash my hands. 

So far things went smooth and I was happy.
But then it suddenly happened.

I opened the water faucet and a high pressure water splash spit all over my shirt.


I don't know exactly why, but I ended up pretty upset for this. So naturally, I had to talk it over with someone. That someone happened to be Xime.


The AS3 project


After talking the situation with Xime, I decided to code something funny. The result can be seen right here. The project consists of an AS3 application that recreates a chat sequence I had with Xime in Google Talk. It's in Spanish. Curiously enough, I'm listening to some German music right now. Talking about polyglotism...

The whole application was done in about 3 hours. I'm not trying to making a huge deal out of it. It's just to point out that there was little design and coding was done fast an furious

The coding

Before continuing, I suggest that you take a look at the application. There will be some spoilers bellow, so please, play through the application. It's quite short, it wont take much of your time. I promise.

Okay, let's move on.

The simulation advances whenever the user clicks somewhere on the canvas. Here is the code that controls the pace of the application:


There is a ChatConversation class stored in mChat variable. Whenever a click is detected, the next() method is called. The method returns false when the conversation is over. When that happens, the chat is finalized by calling the end() method and a new class is created and added to the stage: QuemarTodo. "Quemar Todo" is the Spanish of "Burn Everything".

External Libraries used


The chat conversation interpolates the position of the appearing images. This is done by using Greensock's TweenLite library. I recommend it to anyone that wants to quickly add a feature rich and performant interpolation solution. You can thank me later.

At the end there is a fire-like particle animation. The effect was created using Flint particle system. Again, you can get particles on screen pretty fast. The samples at their page are good. I found that some of the samples have missing data. You may found those missing bits of information by searching through their forums.


Epilogue

I'll end up with a tribute to this guy:

The name's Proof. He was a Rapper. He's dead now.

Because I just saw the "Insert Video" option here in blogger, I'll end up with a video of Proof featuring 50 cent. Represent.




No comments:

Post a Comment