Archive for January, 2008

How many times do you compile in a day?

Well I’m working on the AS2 project right now so I don’t really have stuff to blog about these days (that and the fact that I start too many projects at the same time). I did this little experiment today; I was curious about how many time I was compiling in a day so I counted it today. I compiled 68 times in 7 hours. I don’t know what to think about this number, but at least now I know…

How many times do you compile in a day?

No Comments


TweenLite, Tweener, GOASAP | Fun with animation packages

I have been speaking a lot about Tweener these days and for a good reason; it’s a really good as3 animation library. I can’t say I have been having trouble with it but I found evidence from different sources that it might not be the best animation package for what I want to do.

What I am doing is mostly websites and in those website I use ActionScript to make everything move; I rarely use the timeline. All of my tweens are at most 1 second long but most of the time they last about 0.5 second. I liked Tweener because it was way better than Adobe’s Tween classes but I found from 2 different sources (TweenLite, GOASAP) that TweenLite is faster for small tweens than Tweener. You might know that already, but being fast is one of the most important attribute for me in a tweening engine. Not so much because I use too much animation at the same time but more because that when I start Tweens, I don’t want them to eat all of the cpu, I want them too leave as much processing power for other stuff like timeline animations, video etc. These is all to say that I am changing all my code from Tweener to Tweenlite (that I had previously changed from Adobe Tween classes to Tweener) because I need the extra speed badly.

Something came up since I started this project. From the maker of the Fuse kit comes GOASAP. Which looks very promissing; it’s  not an animation package per say, it’s more like animation package building blocks. Since sometime there is a lot of overhead in animation engine for things that you will never use, Moses Supposes made us all animation library developers. The GOASAP code base is in AS3 and I can’t wait to start using it. In the mean time I invite you all to go and start developing your own animation code;

, , ,

1 Comment


Mutant Farm, on your LCD Screens soon

Since it is complete enough that I can show it, here is a project I have been working on for a little while now: Mutant Farm; A game where all sheep are evil.

I have done it in ActionScript 3 and it gave me much content to write about like the post about ActionScript 3 and interfaces.

It’s obviously not completed but it will soon be there. My objectives with that game was first to learn ActionScript 3,  second to try to make a bit of money and third to drive traffic to my blog. The first objective as already been achieved but for the two others we will soon see to which extent I will achieve them. I intend also to release the code when the game will be forgotten (or something like that).

Here is what is on my check list to improve the game:

  •  add a preloader with sponsors and a link to zedia.net
  • add the story before the first level
  • improve all graphics (menu, in game, UI)
  • add music (menu, in game)
  • add better sounds
  • implement the between level upgrades that you can buy
  • add high score mechanics and maybe a survival mode
  • add more levels and critters
  • add more weapons like grenades and the Ancient Artifact

Right now there is 4 levels and the fourth one is way too hard but it’s going to be easier when you will be able to buy upgrades.

So go  play it now: Mutant Farm and fell free to leave me any comments about the game.

,

No Comments


How Google indexes Flash content

I found while browsing the web two articles about how Google indexes Flash content; here they are:

Google reads Flash text, so optimize it and Matt Cutts on how you can help Googlebot “see” your Flash content.

Basically what they say is that Google is kinda working with Adobe on that, in fact Google is using the Search Engine SDK made by Adobe in order to find text in Flash files. Also, you can read there also that the techniques I explained about how to optimize your  flash website for Google (easy technique, brute force technique) are accepted by Google (not seen as blackhat tricks) only if you put in the HTML the exact text that is in the Flash file. Have a good read.

,

3 Comments


ActionScript 2 and Object Oriented Programming; an entire day of trouble

I was back to work today after the holidays and my first day hasn’t been that fun. First of all I’m back working in ActionScript 2 after working on the cool Christmas card which was in ActionScript 3. Second, I have been trying all day to make my menu work while programming it in an object oriented kinda way but all my efforts have been in vain.

 The first big problem I encountered is that even if you assign a class to a symbol in the library, if you put that symbol on the stage, it won’t use the class you assigned to it. You have to use the attachMovie method in order to make that work. Ok that’s fine I can find workaround in order to make that work.

Now I finally get that working the trouble is that the onRollOver and other onSomething won’t work in that class because of where it is situated (in an other class or other bug I just couldn’t find). Well I lost my whole day on that…

I feel it’s kinda wasteful to spend time on problems like this (in ActionScript 2) because I am not really learning something that will be useful in the long run. Anyway I don’t usually like to make post like this, because I don’t provide an answer to my problem but I really had to get this out of my system. Sorry about this, better post next time.

, ,

3 Comments


How to use interface in ActionScript 3

There are a lot of good ActionScript 3 books out there, but in most of them all the examples about inheritance, composition, interface, polymorphism and more complex object oriented principles are done using data classes. It’s good to explain the principles, but when you are ready to code some actual classes in Flash, some problems start to arise. Most of my problems come from the fact that 90% of the time I am coding classes that are a visual representation of something. So these classes extends the Sprite or MovieClip class.

So I was coding this game class where I have multiple kind of monsters but I want to use the same functions without checking what kind of monster it is. This is a case where polymorphism comes in handy. The thing is I didn’t do my classes of monster using inheritance (which maybe I should have done), so in order to use polymorphism, I have to create an interface with the public methods common to all my monster classes. So I open the Colin Moock book and start looking at how to code interfaces. Here is a list of quick facts that will help you while doing so.

  • You have to list all public methods that will be common for the classes that implements this interface;
  • You do so by writing the definition of the function, its name, its parameters and its return type;
  • You don’t have to open and close curly braces after the method definition
  • You don’t specify if the method is private, public or protected (that’s kind of obvious but I did that mistake)
  • interface can only extend other interfaces
  • a class can implement more than one interface

So here is an example of an interface in As3:

package com.mutantfarm.monster{
  public interface IMonster {
    function getShot(damage:uint):void;
    function getCanShoot():Boolean;
  }
}

Here is how my visual class implements this interface while also extending the MovieClip class:

public class spriteMouton extends MovieClip implements IMonster{

It is important that you put the extend keyword before the implement keyword.

So most of what I just wrote about was details about interfaces, but when you start coding, all these details are important to know.

Here are two more article I wrote about interfaces:

, ,

40 Comments