Post by thomas on Jan 12, 2006 0:32:40 GMT
NOTE:I made this tutorial for a person on VideoGameDC.It is not stolen in any way.
First,set your variable for the menu.
"menu" is the variable for the context.
Now hide all the built in items with this code.
You will now be left with a simple empty Context.Next is creating a button in the menu.
Where it says "link" is where the...hmmm..."Instance" of the button would be.Where it says "VGDC" is what you want the button caption to say.
Now you gotta set the function of the button,which will also make it appear.
You have to set the function,and "link" is referring to the instance...you can tell that this fucntion is for a URL.
Now to finish,you have to set the menu as your menu.
Oh,and if you want to set a little grey bar..."separator"...before a button,use...
Change "1" to whatever number the custom item is.
So,here is an example code that I use.
I hope you've learned.
First,set your variable for the menu.
var menu = new ContextMenu();
"menu" is the variable for the context.
Now hide all the built in items with this code.
menu.hideBuiltInItems();
You will now be left with a simple empty Context.Next is creating a button in the menu.
menu.customItems.push(new ContextMenuItem("VGDC", link));
Where it says "link" is where the...hmmm..."Instance" of the button would be.Where it says "VGDC" is what you want the button caption to say.
Now you gotta set the function of the button,which will also make it appear.
function link() {
getURL("http://www.videogamedc.org/", "_blank");
}
You have to set the function,and "link" is referring to the instance...you can tell that this fucntion is for a URL.
Now to finish,you have to set the menu as your menu.
_root.menu = menu;
Oh,and if you want to set a little grey bar..."separator"...before a button,use...
menu.customItems[1].separatorBefore = true;
Change "1" to whatever number the custom item is.
So,here is an example code that I use.
var menu = new ContextMenu();
menu.hideBuiltInItems();
menu.customItems.push(new ContextMenuItem("TheToon", item1));
menu.customItems.push(new ContextMenuItem("Newgrounds", item2));
menu.customItems.push(new ContextMenuItem("-Quality-", item3));
menu.customItems.push(new ContextMenuItem("LOW", item4));
menu.customItems.push(new ContextMenuItem("MEDIUM", item5));
menu.customItems.push(new ContextMenuItem("HIGH", item6));
menu.customItems.push(new ContextMenuItem("Play More Games!", item7));
menu.customItems.push(new ContextMenuItem("Goto the Menu", item8));
function item1() {
getURL("http://www.thetoon.us.tt/", "_blank");
}
function item2() {
getURL("http://www.newgrounds.com/", "_blank");
}
function item3() {
//no actions
}
function item4() {
_root._quality = "LOW";
}
function item5() {
_root._quality = "MEDIUM";
}
function item6() {
_root._quality = "HIGH";
}
function item7() {
getURL("http://www.armorgames.com/", "_blank");
}
function item8() {
_root.gotoAndStop("menu");
}
menu.customItems[2].separatorBefore = true;
menu.customItems[6].separatorBefore = true;
menu.customItems[8].separatorBefore = true;
_root.menu = menu;
I hope you've learned.