Home » Archive

Articles in the AS3 Category

Featured, Headline, RabbitTween, flash, tween »

[17 Sep 2009 | 2 Comments | ]

RabbitTween is a brand new AS3 tweening engine, simple, fast and very light weight.

Yeah I know, I have been away for a long time, giving no news and posting absolutely nothing for months !… and look who is coming back with an already existing thing that everybody has already seen everywhere ?!? …
It may look stupid and useless as there are so many engines out there that may do the job a hundred times better. And that’s what I was telling myself till a couple of days ago…
But why would …

AS3, Game, Math, flash »

[2 Jun 2009 | No Comment | ]

That’s it, the following code finds for you the shortest rotation angle from a given angle to another:

var diffAngle:Number = Math.atan2(Math.sin(angleTo - currentAngle), Math.cos(angleTo - currentAngle));

The code was given on this forum. You’ll also find a way to do it with vectors.

AS3, Commercial Projects, Featured, Game, Headline, flash »

[29 May 2009 | 7 Comments | ]

Here it is, the new and unique Prototype Experience using Facebook Connect for the new blockbuster game by Activision: Prototype.
I don’t think it has been done before and so I invite you to go and visit the site before you read this post as I will explain a bit more about the development process (as far as I’m allowed to) behind this promotional website.
First of all, I’ll briefly describe the website, what it contains and eventually what issues we have encountered while developing it. Then I’ll write about the most …

AS3, Strange/Bugs »

[27 May 2009 | 3 Comments | ]

So, if you got a bug on FireFox and Safari when trying to insert a @ character into a textfield, just take a look at this post: http://blog.madebypi.co.uk/2009/04/21/transparent-flash-text-entry/
It seems to happen when a div is placed (or was…) over your flash movie.

AS3, Strange/Bugs »

[27 May 2009 | One Comment | ]

For those people out there who are experiencing this cool issue, just upgrade your flash cs4 10.0.0 to 10.0.2. It solved the problem for us.
Sometimes Flash CS4 won’t even show you anything in the Output and/or Compiler errors windows and when debugging your movie it will just tell you that it cannot do anything with a project containing no code or something like that. It is the same issue.
It seems to happen on “very large projects” as the guys at Adobe say but I’v worked on larger project and it …

AS3, General game programming, flash, managers »

[9 May 2009 | 4 Comments | ]

First of all, to understand the need of a centralized manager for filters in flash, we need to understand how filters are set on a DisplayObject.
To set a filter, we first need to create a BitmapFilter object :

// create a new blur filter
var blur:BlurFilter = new BlurFilter(4.0, 4.0, 1);

Then add it to the “filters” property (which is an array) of a DisplayObject like so:

// get a copy of the "filters" array
var aFilters:Array = displayObject.filters;
// add our filter to our new array
aFilters.push(blur);
// and set our new array
displayObject.filters = aFilters;

Why do we …

AS3, Game »

[25 Apr 2009 | 7 Comments | ]

hitTestPoint is a very usefull function when you want to test if a point (x, y) hits a shape, even an irregular one.
But there are a few but important things that you got to remember to get it to work properly:

the dispay object you’re working on must be added to the display list.
use TRUE for the last parameter of the function if you want your point to be tested against the actual shape and FALSE if you just need it to be checked against its bounding box.
and last but not …

AS3, Strange/Bugs »

[18 Apr 2009 | 2 Comments | ]

Sometimes you just spend time for stupid things like this and when you find out how to do it you just wonder why it has to be like this… I feel like there are still a lot of inconsistencies in ActionScript 3…
Anyway, here is the code to do so. Just set a new SoundTransform object to the soundTransform property of your NetStream object like so:

var nc = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
// change "1" to whatever you need the volume to be changed to
ns.soundTransform = new SoundTransform(1);

AS3, General game programming, managers »

[5 Apr 2009 | No Comment | ]

What for ?
Events centralization allows to listen for events of an object that we don’t have direct access to.
Example
We have a button in a MovieClip that is not directly connected to your main MovieClip or class where you want to keep all the events logic. There are many ways to get the reference of your button but if you only need to listen for its events then there is a simple way.


Events centralization
The core of the centralization system is a Singleton (some sort of …

AS3, Useful links »

[13 Mar 2009 | 3 Comments | ]

When you look for something, there are always more chances that you don’t find it when you need it. It’s only weeks later, when looking for something else that you step on it. (some unwritten laws that I know most of you have encountered many times)
Anyway, here is a great open-source performance tester written in and for ActionScript 3:
http://businessintelligence.me/projects/performance_tester/performanceTester.html
It’s got tests on:

Array loops
Constant lookups
Single or multiple variables declaration
Increment
Division
Associations with objects, arrays and dictionary
Array vs. Vector
Loops
Different types of instantiations (”new Array()” vs. “[]“…)

And even a performance tester between two scripts …