Friday 9 March 2007

Vibrate!


When I show my friends some of the flash lite menus created, they're always impressed when they see the theme that responds to key presses by vibrating the phone. We will look at how this works:

FSCommand2( "StartVibrate”, time_on, time_off, repeat )

Both time_on and time_off values are in milliseconds and signifying the duration the vibrate will or will not be functioning. If this command is not supported by the phone, it will return a value of 1 (otherwise 0).

You can see immediately that this handy function can easily be integrated into a flash menu system:

on(keypress "<left">){
//vibrate phone

FSCommand2( "StartVibrate”, 10,0,0);
//do something else
}

In the above code, the phone will vibrate once the left button is pressed. For a menu, you will most likely not repeat the vibrate, which is why repeat = 0. For rapid sucession button activation, the previous vibration will be stopped before the consequent one proceeds.

8 comments:

nkls said...

Can you make a post about what programs to use, and make an example flash menu? That would be really great!

FLT said...

Yeah, I will sometime next week. Really busy at the moment!

Anonymous said...

I would like to disable the vibration. I found the source code that enables is but i didn'i managed to modify it and export it to a swf file without errors. Please give me some advice on how to edit the file or at least tell me a program that decompiles the swf file without errors.

nkls said...

Nice!

Unknown said...

Re: ketu:

You can only disable the vibration if you have the original source file (FLA file format). If you only have the SWF file, you will not be able to do so.

Anonymous said...

Any ideea on where to find the fla?

FLT said...

Re: ketu

You won't be able to find the fla file anywhere. Only the developer of that flash lite menu would have it.

Anonymous said...

I'm testing some Flash Lite 2.0 things on a Nokia 3500. Could it be that this and other Nokia's don't support the Vibrate function through flash lite?