In this post i m going to show how to create a custom context menu in flash CS4.
Put this action script on frame 1
/* Custom Context Menu to use Fullscreen Command by Sachin Ghare */
function deadClick () {
}
function goFullScreen()
{
Stage["displayState"] = “fullScreen”;
}
function exitFullScreen()
{
Stage["displayState"] = “normal”;
}
function menuHandler(obj, menuObj)
{
if (Stage["displayState"] == “normal”)
{
// in normal mode this code enables Fullscreen Command
menuObj.customItems[0].enabled = true;
menuObj.customItems[1].enabled = false;
bt.enabled = true;
}
else
{
// in fullscreen mode this code enables Exit Fullscreen Command
menuObj.customItems[0].enabled = false;
menuObj.customItems[1].enabled = true;
bt.enabled = false;
}
}
// here i built context menus
var myMenu:ContextMenu = new ContextMenu(menuHandler);
myMenu.hideBuiltInItems();
var mySiteLink1:ContextMenuItem = new ContextMenuItem(”Go Fullscreen”, goFullScreen);
var mySiteLink2:ContextMenuItem = new ContextMenuItem(”Exit Fullscreen”, exitFullScreen);
// here i assign the action to context menus
myMenu.customItems.push(mySiteLink1, mySiteLink2);
_root.menu = myMenu;
_root.corner_B_G_mc.toggle.onPress = function(goFullScreen, exitFullScreen)
{
goFullScreen();
}
Post your feedback about the code. You can donwload the Source Code from here
In this post i m going to show you how to import external mp3/wav file using Flash Cs4/AS3, its just a 3 easy lines code.
Put this code on frame 1.
var
//here i have created custom class as mysound which i maped to function newSound
mysound:Sound = new Sound();
//here i m requesting a external sound file to be import in flash mysound.load(new URLRequest(”music.mp3″));
//here i m playing imported sound file
mysound.play();
Post your feedback about the code. You can donwload the Source Code from here

