PDA

View Full Version : Width Menu with Images



gvozden
June 14th, 2006, 09:32 AM
I've upgraded my menu using menu as mask for images
it's not same as our friend asked, images are moving but I like it more than they are static

here is
SWF (http://www.primatron.co.yu/MenuWidth/menu_width_images.swf)
ZIP (http://www.primatron.co.yu/MenuWidth/menu_width_images.zip)

code is free of charge but if you use it somewhere please send me an email :)

icio
June 14th, 2006, 09:45 AM
Looks good.

mprzybylski
June 14th, 2006, 09:56 AM
very cool, nice work.

prototype
June 14th, 2006, 10:41 AM
Thanks for sharing!

boohaha
June 14th, 2006, 10:44 AM
nice job man! I've seen it a lot around the net...

gvozden
June 14th, 2006, 10:53 AM
thanks ;)
I've did this because of demand of one of guys from this forum

pips
June 14th, 2006, 12:27 PM
really really nice work!!!

gonzolo
June 15th, 2006, 04:44 AM
another great job my friend you actually inspired me to make my site the way it is with your first width menu ;)

please note.
that i did not steal the code i made something simmelar myself

Sunrise765
June 15th, 2006, 06:25 PM
Thanks again for it this

spoison
December 10th, 2006, 03:34 PM
thx a lot for this job,
do you have an idea to put a white border between each menu item ?

thanks.

Lujerker
December 12th, 2006, 07:58 AM
Congrats ! :beam: excellent Effect !

gvozden
December 13th, 2006, 03:42 PM
I hope I will have time to modify it but don't expect soon :( sorry

myxmlc
January 6th, 2007, 04:04 PM
This is great piece gvozden. Howerver, I can't for the life of me figure out how to add button actions to it. Tried applying on release actions to the MC and it doesn't work. Tried functions and doesn't work. Any thoughts on how to add button actions?

thx.

gvozden
January 6th, 2007, 07:33 PM
menu0.onRelease = function() {
status_txt.text = "menu0 btn pressed... Thnx on testing";
}

this piece of code is inside .fla file and every menu item has it's own mc named
menu0, menu1, menu2 based on array of menu item names

I will try soon to release much more advanced width menu
suggestions are welcome

myxmlc
January 6th, 2007, 08:02 PM
mainmenu0.onPress = function() {
_root.gotoAndStop("test1");
}

Greatly appreciate the help. What's really strange is that "onRelease" doesn't work but "onPress" does. Finally got it working. Great job with themenu BTW!!!

gvozden
January 6th, 2007, 09:17 PM
lol, I wasn't looking same file

mainmenu0.onPress and mainmenu0.onRelease are both working :)

Exos Sho
January 9th, 2007, 08:22 AM
ive also been working on a width menu the last days. its a bit diffrent to yours, i use simple rectangles instead of masks.
right now im trying to get it as dynamic as possible. and the most things work so far, only one thing is not working right. i use an array for keeping the class-instances, so one of it looks like: t["bar_"+i];
and when i use an if-loop for the onPress-thing, it doesnt work. so ive to write the onPress-thing for each...
if i get it done, ill post my finished version.
try (http://de.geocities.com/exossho/balken.swf)
here is my class


class balken {
private var _breite:Number;
private var _xposition:Number;
private var _bezeichnung:String;
private var _clip:MovieClip;
private var _id:Number;
private var _active:Boolean = false;
private static var _DISTANCE:Number = 3;
private static var _MAX_BREITE:Number = 200;
private static var _MIN_BREITE:Number = 5;
private static var _MAX_BEZEICHNUNG:Number = 15;
private static var _SYMBOL_ID:String = "Balken";
function balken (be:String, br:Number, p1:Number, p2:Number, id:Number, t:MovieClip) {
setID (id);
setBezeichnung (be);
setBreite (br);
setX (p1, p2);
_clip = t.attachMovie (balken._SYMBOL_ID, "balken_"+id, id);
_clip._y = 100;
setClipX ();
_clip._width = _breite;
}
//
function shrink () {
var v = getBreite ();
setBreite (v-(v/4));
setClipW ();
}
function grow () {
var v = getBreite ();
setBreite (v+(v/4));
setClipW ();
}
//
function setID (i) {
_id = i;
}
function setBezeichnung (be) {
_bezeichnung = be;
}
function setBreite (br) {
if (br>balken._MIN_BREITE && br<balken._MAX_BREITE)
{
_breite = br;
}
}
function setX (p1, p2) {
_xposition = p1+p2;
}
function setClipX () {
_clip._x = _xposition+3;
}
function setClipW () {
_clip._width = getBreite ();
}
function setActive (a:Boolean) {
_active = a;
}
//
function getID () {
return _id;
}
function getBezeichnung () {
return _bezeichnung;
}
function getBreite () {
return _breite;
}
function getX () {
return _xposition;
}
function getClipX () {
return _clip._x;
}
function getClipW () {
return _clip._width;
}
function getActive () {
return _active;
}
//
function getMaxW () {
return balken._MAX_BREITE;
}
}

gvozden
January 9th, 2007, 09:18 AM
example for onPress with dynamiclly created movieclips is basiclly
when you create some movieclip like you did

_clip = t.attachMovie (balken._SYMBOL_ID, "balken_"+id, id);
you can in next line write


t["balken_"+id].number = id;

that basiclly means you defined variable in movieclip instance with number = id

and then when you make dynamic onPress you can use


t["balken_"+id].onPress = function() {
trace(this.number); // to retrieve number of a mc you've clicked
}

you're example seems a little bit slow and my example is different because it's always same width and that's little more complicated math :D not much

Exos Sho
January 9th, 2007, 10:57 AM
ok, thank u, i tried that too, but only works if u want to get info, i.e i cant use the grow()-function;
what i tried:


//in .fla
...
for(i=0;i<arr.length;i++){
t["bar_"+i].onPress = function(){
this.onEnterFrame = function(){
t["bar_"+i].grow();
}
}
}
...

or:


//in .as in the constructor
...
_clip.onPress = grow();
...

nite21
April 9th, 2008, 07:59 AM
I've upgraded my menu using menu as mask for images
it's not same as our friend asked, images are moving but I like it more than they are static

here is
SWF (http://www.primatron.co.yu/MenuWidth/menu_width_images.swf)
ZIP (http://www.primatron.co.yu/MenuWidth/menu_width_images.zip)

code is free of charge but if you use it somewhere please send me an email :)


will u send me the zip file at nite21@cooltoad.com as i cant download here

eanimator
April 20th, 2008, 03:19 PM
Great Work!!