Monday, September 22, 2008

Tweening with AS3

Fellow Flash Devs,

I have finally started playing with AS3 & tried doing some experimentation with Tween class.

It's as simple as before except the classes which needs to be imported are different. So for AS3 we will import fl.transitions.Tween & fl.transitions.easing.*

Please use the code below to simply animate a box kept on the stage using Tween class-

import fl.transitions.Tween;
import fl.transitions.easing.*;

b1.buttonMode = true;
b1.addEventListener(MouseEvent.CLICK, btnclick);

function btnclick(event:MouseEvent)
{
new Tween(b1,"x",Regular.easeOut, b1.x, b1.x+50,1, true);
}

Thursday, July 24, 2008

Problem with Combobox component

While working on a website for one of my client, I came across a strange problem with Combobox component.

If you try to put a Combobox in a flash & then try to load that .swf file in another flash using loadClip function of MovieClipLoader it doesn't work. You can't even click it to see the items.

After googling for sometime I found that its a bug in Flash and the work around is if you simply drag a Combobox component in your parent Flash & then just delete it from the stage leaving it in the library, it works perfectly fine.

And you can click and select any item from the Combobox embedded in the child Flash, loaded in the parent movie.

Wednesday, June 4, 2008

Tweening with MC Tween

After the Tween & TransitionManager Class, to make life more easier I have found MC Tween extension which can be used to tween objects such as movieclip/sound/textfield.

You just need to #include "mc_tween2.as" and use one simple command to create a new tweening. It doesn't use the MovieClip's own onEnterFrame event & It is based on time, not on frames.

Let's suppose you want to move something using an animation, to provide a smoother experience for the user. Using MC Tween, you could do:
myMovieclip.tween("_x", 100);

To download the extension or read the full documentation with examples please go to: http://hosted.zeh.com.br/mctween/

Monday, May 12, 2008

Auto Save

Hi Guys,

You can enable autosaving for your flash documents in Flash by downloading and installing the extension -

Extension:Auto save extension

You can set the autosave intervals as per your needs.

This extensions is licensed under a Creative Commons License. If you choose to download it then you are agreeing to the terms in this license agreement.

Thursday, July 19, 2007

Beauty of Tweening with Tween & TransitionManager class

Yes!!! Its true that you can tween any object on the stage without actually applying tweening in the timeline & its amazing.

I am pasting a small code snippet below for a quick reference, which generates a bounce effect for a movie clip placed on the stage.

import mx.transitions.Tween;
import mx.transitions.easing.*;

new Tween(mcBall, "_y", Bounce.easeOut, 0, Stage.height-50, 3, true);


Parameters Explained:
1. "mcBall" is the movie clip placed on the stage
2. This parameter tells the constructor that what property will change in case of tweening. "_y" means the y position of the movie clip has to be changed.
3. The effect.
4. Starting y position.
5. End y position.
6. Duration of the tween.
7. Boolean Value related to the duration parameter, which indicates to use seconds if true, or frames if false.

The Tween and TransitionManager classes are available only in ActionScript 2.0, but these classes are available in both Flash Basic 8 and Flash Professional 8.

Wednesday, July 18, 2007

Actionscript/Javascript Communication

Now its much easier to communicate with Flash from Javascript and vice versa using ExternalInterface class.

You can create any function in Flash & then use the ExternalInterface class to register that function to call from the browser.

I am giving a step by step explanation to achieve the desired functionality.

First and foremost import the package using the statement given below -

import flash.external.*;

& then call the following function to register the function

ExternalInterface.addCallback("callASFunction", null, asFunction);

Explanation: The first parameter "callASFunction" is the name which will be used to call the function from the browser and the third parameter is the actual name of the function created in Flash. You can always keep the second parameter as null.

Monday, June 18, 2007

Mobile Apps with Flash Lite

Hi Peeps,

I just tried playing around with Flash Lite & found it really cool to generate mobile apps & you can test your application in the emulator while developing it.

I created a very small application & found it really interesting and easy. I used Flat Lite 1.1 with Flash 8.0 to generate this application.

I had an image & a button placed in the first screen & clicking on that button made the image run out of the screen with motion tween.

It was fun & easy.