Hi all I am creating a menu for a website I am doing 10 links so it will have 10 buttons, I can hard code each button like this:
// Button 1
// Button Label
link1.bar.txtlabel = "Home";
link1.onRollOver = function (){
link1.ball.play();
};
link1.onPress = function () {
link1.bar._y = 1
this.gotoAndStop(link1);
};
link1.onRollOut = function () {
link1.ball.stop();
link1.bar._y = 0;
};
link1.onRelease = function () {
link1.ball.stop();
link1.bar._y = 0;
};
but I would like to do a Function that holds that stuff in it so that I can use the code once as a template instead of doing it 10 times so if I wanna change anything I can do it just once. anyway here is the function I tried to do but it didnt rerally work:
function MenuLink(sLink:String, sTitle:String) : Void{
[link+sLink]bar.txtlabel = sTitle;
[link + sLink]onRollOver = function (){
[link + sLink]ball.play();
};
[link + sLink]onPress = function () {
[link + sLink]bar._y = 1
this.gotoAndStop(link + sLink);
};
[link + sLinkNum]onRollOut = function () {
[link + sLink]ball.stop();
[link + sLink]bar._y = 0;
};
[link + sLink]onRelease = function () {
[link + sLink]ball.stop();
[link + sLink]bar._y = 0;
};
trace("Link " + sLink + " Title: " + sTitle);
}
MenuLink("1", "One");
MenuLink("2", "Two");
MenuLink("3", "Three");
MenuLink("4", "Four");
MenuLink("5", "Five");
MenuLink("6", "Six");
MenuLink("7", "Seven");
MenuLink("8", "Eight");
MenuLink("9", "Nine");
MenuLink("10", "Ten");
it would be great if someone could help me
Thanks A Million Guys
Brian
// Button 1
// Button Label
link1.bar.txtlabel = "Home";
link1.onRollOver = function (){
link1.ball.play();
};
link1.onPress = function () {
link1.bar._y = 1
this.gotoAndStop(link1);
};
link1.onRollOut = function () {
link1.ball.stop();
link1.bar._y = 0;
};
link1.onRelease = function () {
link1.ball.stop();
link1.bar._y = 0;
};
but I would like to do a Function that holds that stuff in it so that I can use the code once as a template instead of doing it 10 times so if I wanna change anything I can do it just once. anyway here is the function I tried to do but it didnt rerally work:
function MenuLink(sLink:String, sTitle:String) : Void{
[link+sLink]bar.txtlabel = sTitle;
[link + sLink]onRollOver = function (){
[link + sLink]ball.play();
};
[link + sLink]onPress = function () {
[link + sLink]bar._y = 1
this.gotoAndStop(link + sLink);
};
[link + sLinkNum]onRollOut = function () {
[link + sLink]ball.stop();
[link + sLink]bar._y = 0;
};
[link + sLink]onRelease = function () {
[link + sLink]ball.stop();
[link + sLink]bar._y = 0;
};
trace("Link " + sLink + " Title: " + sTitle);
}
MenuLink("1", "One");
MenuLink("2", "Two");
MenuLink("3", "Three");
MenuLink("4", "Four");
MenuLink("5", "Five");
MenuLink("6", "Six");
MenuLink("7", "Seven");
MenuLink("8", "Eight");
MenuLink("9", "Nine");
MenuLink("10", "Ten");
it would be great if someone could help me
Thanks A Million Guys
Brian