Saturday, August 11, 2007

ActionScript 3.0 / Flash 9

Great surprise for all of us who in the years got used with ActionScript 2.0. First of all - we cannot apply actions directly to the movie clip (so forget about the really simple on(release){...} ).

If you click on a movie clip and you have the "Actions" window opened you will notice "Current selection cannot have actions applied to it"! At first it is irritating, but it seems to be a good point.

So how to make a "RollOver", "RollOut" etc. effects in AS3 ?

The first what we do - we have to import the Events package:

import flash.events.Event;

Now lets assume we have the movie clip on the stage and we named it "mymc". What we have to to is to add event handlers to it to listen for events:

mymc.addEventListener(MouseEvent.ROLL_OVER, RollOverHandler);
mymc.addEventListener(MouseEvent.CLICK, ClickHandler);
mymc.addEventListener(MouseEvent.MOUSE_OUT, RollOutHandler);

There is a set of predefined constants in the MouseEvent object, which we can use.

The next step is to implement the event handlers. Here is the simplest implementation of an event handler:

function RollOverHandler(me:MouseEvent):void {
    me.target.alpha = 1.0
}

I would rather call the type of "me" MouseEventArgs, but it's another story. What do we have in the MouseEvent variable is the "target". The "target" is the object that has escalated the event. Now we can say to that target what to do. We can say for example: me.target.gotoAndPlay(2), or me.target.gotoAndStop(1);

OK, that's it so far. Hope to have more to write soon ;)

Friday, August 10, 2007

Reflection of images ?

This cool script has a great features ;)

Hope you will like it!

Thursday, August 9, 2007

Flash 9 fullscreen mode and transparent movie

A long time not writing, hyh ...
Tough times ;)

Anyway, the last couple of hours I struggled with the problem: "allowFullScreen"=>"true" to enable full screen video playing in one of the latest projects I had. When I use the original generated code from the "Publish" in flash I have no problems. But when I tried with SWFObject I ran into trouble.

The full screen mode did not work... at all ... I examined the generated code (using FireBug and IE DevToolBar - developer's right hand tools) and it seemed quite OK! The parameter was there. But the flash player did not want to go full-screen.

After having a short break and coming back to the problem I noticed that I am also using the "wmode"=>"transparent" for the target movie. Commented it - just to try. Guess what - hola! The movie is again working as expected.

The problem - FullScreenMode is INCOPATABLE with TRANSPARENT movie - what the ?

Looking over this post, it seemed that: Adobe says: "...Full-screen mode was not originally supported if the wmode is opaque or transparent windowless, but it is now supported starting with the latest Flash Player 9 Update...", but I have the 9.0.45 and it still got the problem ...

A friend of mine told me "why would you need transparent along with full screen?". Well, another "great feature" of the FLASH object is that it keeps itself ALWAYS ON TOP of the page, regardless the "z-index" of your other objects. Unless it is set to "transparent".