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.

Thursday, June 7, 2007

Customizing Flash Context Menu

Flash context menu is the menu you see when you right click on any of the running Flash animations or applications.

I have customized it many times before but one of my friend asked me few days back that if he can remove the options from the Flash shortcut(context) menu so I thought of posting it on my blog for all of those trying to customize it.

I am pasting the code along with the explanation below -

var cMenu = new ContextMenu();

function dummy() {
trace("option clicked");
var cMenuItem1 = new ContextMenuItem("Option 1", dummy);
var cMenuItem2 = new ContextMenuItem("Option 2", dummy);
var cMenuItem3 = new ContextMenuItem("Option 3", dummy);
cMenu.customItems.push(cMenuItem1,cMenuItem2,cMenuItem3); = cMenu;

The ContextMenu class provides runtime control over the items in the Flash Player context menu, which appears when a user right-clicks on Flash Player.

First of all I have created an object of the class ContextMenu called "cMenu" & then called the built in function hideBuiltInItems() using the object which will hide the default options appearing on the right click.

The function dummy has been created to display a message in the output panel whenever user will click on the customized options added in the menu.

ContextMenuItem class is used to create objects for creating customized items, so for each option you want to put in the menu, you have to create an object. While creating object it takes two parameters, the caption & the function which will be executed on the click.

After doing this you have to push the items in the menu and to do that you use in built array associated with ContextMenu called ContextMenuItems.


So using the above code you push the items created into the menu & then your menu is ready to go after you change the current menu by putting in your menu name in the "menu" property using the following statement - = cMenu;

Enjoy Customizing Context Menu...