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();
cMenu.hideBuiltInItems();

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);
_root.menu = 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.

cMenu.customItems.push(cMenuItem1,cMenuItem2,cMenuItem3);

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 -

_root.menu = cMenu;


Enjoy Customizing Context Menu...

Thursday, May 24, 2007

XML Preloader

Hey Guys,

Now you can show a preloader animation even while loading any data from a XML file. The code for the preloader is like any other preloader in Flash except there is a change while extracting the loaded and total bytes -

loadedBytes=myXML.getBytesLoaded();
totalBytes=myXML.getBytesTotal();


myXML here refers to your XML object created to load the XML file.

Please feel free contact me at atul.narang@designworxz.com in case of any query.

Cheers :)

Friday, April 27, 2007

Loading Image Dynamically

I don't recommend to use LoadMovie for loading images dynamically because you can not actually trace the progress & perform the next action depending upon the progress.

I will suggest using MovieClipLoader class and its function loadClip using which you can actually trace the progress & if required can play preloader animation & then hide it when the loading of image is completed.

Please feel free to post your query if you have any.

Thursday, April 26, 2007

Parsing XML in Flash

XML2Object is an extension for Macromedia Flash & just to let those people know who are creating dynamic website or applications by integrating & reading data from XML that it makes your life very easy by creating an object of complete XML.

After creating an object of XML2Object you can extract data by using the following format -
ObjectName.nodename.data

It is very easy & faster to use rather than parsing through each node of XML file & then extracting the data.