alert This appears to be a flash file, you cannot see a preview because flash player is no longer supoorted in browsers, but you can still download the file to study it's source code.
You can open/play the swf file with Flash Player exe
user jmalek
jmalek (7)

Image Menu v2

Modified version of the previous, the menu now has functional links. Much thanks to sanjum for help with the script.

To modify urls, simply open imagemenu.as file and edit the "URL" array after [var mcPaths = ...]

15578 downloads, 64652 views
Download (1.30 MB)

Comments

You need to login to post a comment.

user PorcoNu
PorcoNu 13 years ago

some one can post all code here, with the places to change the urls????

user ingniko
ingniko 14 years ago

import mx.transitions.Tween;
import mx.transitions.easing.*;

function findMaxLevel(menu_no, mc_string):Number {

var maxDepth:Number = 0;
var clip:Number = 0;
var j:Number;
for (j=0; j<menu_no; j++) {
if (eval(mc_string+j).getDepth()>=maxDepth) {
maxDepth = eval(mc_string+j).getDepth();
clip = j;
}
}
return clip;
}
function setMenu(menu_no, menuStartX, widthOption, mc_string) {
var j:Number;
for (j=0; j<menu_no; j++) {
var _mc:MovieClip = new MovieClip();
_mc = this[mc_string+j];
_mc.onRollOver = function() {
var l:Number = this._name.lastIndexOf(mc_string.substr( mc_string.length-1,mc_string.length) );
var number:Number = Number(this._name.substr(l+1, 2));
var i:Number;
var tempMC:Number;
tempMC = findMaxLevel(menu_no, mc_string);
eval(mc_string+number).swapDepths(ev al(mc_string+tempMC));
var tempWidth:Number = ((menu_no*widthOption)-200)/(menu_no-1);
var tempPosX:Number = menuStartX;
for (i=0; i<menu_no; i++) {
if (i != number) {
var tw:Tween = new Tween(eval(mc_string+i), "_width", Strong.easeOut, eval(mc_string+i)._width, tempWidth, 1, true);
var tw2:Tween = new Tween(eval(mc_string+i), "_x", Strong.easeOut, eval(mc_string+i)._x, tempPosX-(widthOption-tempWidth)/2, 1, true);
tempPosX += tempWidth;
} else {
var tw:Tween = new Tween(eval(mc_string+i), "_width", Strong.easeOut, eval(mc_string+i)._width, 200, 1, true);
var tw2:Tween = new Tween(eval(mc_string+i), "_x", Strong.easeOut, eval(mc_string+i)._x, tempPosX-(widthOption-200)/2, 1, true);
tempPosX += 200;
}
}
};
_mc.onRollOut = function() {
var l:Number = this._name.lastIndexOf(mc_string.substr( mc_string.length-1,mc_string.length) );
var number:Number = Number(this._name.substr(l+1, 2));
var i:Number;
for (i=0; i<menu_no; i++) {
var tw:Tween = new Tween(eval(mc_string+i), "_width", Strong.easeOut, eval(mc_string+i)._width, widthOption, 1, true);
var tw2:Tween = new Tween(eval(mc_string+i), "_x", Strong.easeOut, eval(mc_string+i)._x, menuStartX+i*widthOption, 1, true);
}
};
_mc.onRelease = function() {
if (this._name == "mainmenu0") {
getURL('about.htm', '_self');
}
if (this._name == "mainmenu1") {
getURL('http://www.yahoo.co.uk/', '_ blank');
}
if (this._name == "mainmenu2") {
getURL('http://www.facebook.com/', ' _blank');
}
if (this._name == "mainmenu3") {
getURL('http://www.google.co.uk/', ' _blank');
}
if (this._name == "mainmenu4") {
getURL('http://www.google.co.uk/', ' _blank');
}
if (this._name == "mainmenu5") {
getURL('http://www.google.co.uk/', ' _blank');
}
};
}
}


function createRectangle(x:Number, y:Number, width:Number, height:Number, color:Number, alpha:Number, number:Number, option_name:String, txtFormat:TextFormat, mc_string):MovieClip {

var mc:MovieClip = this.createEmptyMovieClip(mc_string+numb er, this.getNextHighestDepth());
var mc_txt:TextField = mc.createTextField("menu_txt"+number, this.getNextHighestDepth(), -width/2+5, -height/2+5, width-10, height);
mc.beginFill(color);
mc.moveTo(-width/2, -height/2);
mc.lineTo(-width/2, -height/2);
mc.lineTo(width/2, -height/2);
mc.lineTo(width/2, height/2);
mc.lineTo(-width/2, height/2);
mc.endFill();
mc._x = x;//+width/2;
mc._y = y;//+height/2;
mc._alpha = alpha;
mc_txt.text = option_name;
mc_txt.selectable = false;
mc_txt.setTextFormat(txtFormat);
return mc;
}

function createMenu(numberOfOptions:Number, menuWidth:Number, menuHeight:Number, menuStartX:Number, menuStartY:Number, menuItems:Array, txtFormat:TextFormat, mc_string:String) {
var widthOption:Number = Math.floor(menuWidth/numberOfOptions);
var menuStartX:Number = menuStartX+widthOption/2;
var menu_no:Number = numberOfOptions;
var i:Number;
for (i=0; i<menu_no; i++) {
var color:Number = Math.random()*255*0xFF0000+Math.random() *255*0x00FF00+Math.random()*255*0x0000FF ;
createRectangle(menuStartX+i*widthOpt ion, menuStartY+menuHeight/2, widthOption, menuHeight, color, 100, i, menuItems[i], txtFormat, mc_string);
}
setMenu(menu_no, menuStartX, widthOption, mc_string);
}

user stylekeeper
stylekeeper 15 years ago

for linking to a specific label in your movie. i used the same code nilsy posted and just replaced it with the root path and it worked...
var j:Number;
for (j=0; j<menu_no; j++) {
var _mc:MovieClip = new MovieClip();
_mc = this[mc_string+j];
_mc.onRelease = function () {
if (this._name == "mainmenu0") {
_root.gotoAndStop("home");
}
if (this._name == "mainmenu1") {
_root.gotoAndStop("leg");
}
if (this._name == "mainmenu2") {
_root.gotoAndStop("way");
}
if (this._name == "mainmenu3") {
_root.gotoAndStop("induli");
}
if (this._name == "mainmenu4") {
_root.gotoAndStop("people");
}
if (this._name == "mainmenu5") {
_root.gotoAndStop("pics");
}
if (this._name == "mainmenu6") {
_root.gotoAndStop("contact");
}
};

user berzera
berzera 15 years ago

Hi r-land...can you send me the correct AS code, i have the same problem in the buttons, always tha same link.
[email protected]
thanks!

user r-land
r-land 15 years ago

Hi again :) Problem solved, if you need a solution code, mail me :)
buttons now work fine.

show all 32 comments