You must be logged in to post Login Register
Search 

Modern Horizontal Flash Menu – Question about a variable

User Post

2:26 am
May 15, 2009


Kemipso

Member

posts 3

1

Post edited 9:27 am – May 15, 2009 by Kemipso
Post edited 9:28 am – May 15, 2009 by Kemipso
Post edited 9:30 am – May 15, 2009 by Kemipso
Post edited 9:31 am – May 15, 2009 by Kemipso
Post edited 9:33 am – May 15, 2009 by Kemipso


The tutorial can be found here : http://tutorials.flashmymind.c…..flash-menu

Edit : Bullox, I really suck with wordpress, wish it were BBS !

Edit#25 : God damnit.

Ok, I'll just sum things up :

You create a “button” movie clip from e.target in the function “mouseOverButton”.

What for, why don't you use e.target in the whole function ?

6:15 am
May 15, 2009


smonte

Admin

posts 27

2

Post edited 1:15 pm – May 15, 2009 by smonte
Post edited 1:16 pm – May 15, 2009 by smonte


Hey Kemipso,


You could also do the whole thing with e.target. I personally think the code is easier to read with variable names that make sense. That's why I usually save the target to a local variable. But either way works, so do what's best for you! And code Kemipso is talking about:


//This function is called when the mouse is over a button
function mouseOverButton(e:Event):void {
 
//Assign the button to a local variable
var button:MovieClip = (MovieClip)(e.target);
 
//Calculate the new target width and height for the buttonBackground
var targetWidth:Number = button.width + 10;
var targetHeight:Number = button.height + 10;
 
//Tween the buttonBackground's position, size and color (color is random)
TweenMax.to(buttonBackground, 0.5, {x: button.x, y: button.y,
width:targetWidth, height:targetHeight, tint: Math.random() * 0xffffff});
}

Regards, smonte

7:18 am
May 16, 2009


Kemipso

Member

posts 3

3

Thanks for the reply. I guess I'm really unskilled with wordpress :-)


- Kemipso

Topic RSS 
Search