web design template web design template web design template

Page : 1 2
 

1. Come back into Scene 1

2. Select the menu movie clip on the stage and choose Window > Properties to open the Properties panel

3. In the Properties panel type the Instance Name as 'menu'



4. In the Properties panel type X location of instance as '56' and Y location of instance as '50'

5. With the help of Left Arrow key on the keyboard move the menu movie clip to its left so that last four buttons appear on the stage i.e. Services, Clients, Portfolio, Contact Us

6. In the Properties panel check the X location of instance. It should be something near to -202 to -204. To be very precise it should be '-204'. Note down this X position as it will be used in Actionscript later on.


7. In the Properties panel type X location of instance as '56' to bring the menu to its original position

8. Choose Insert > Layer to add a new layer and name it as 'Mask'

9. With the help of 'Rectangle Tool' create a rectangle patch so that it covers first four buttons under it.



10. Select the Mask layer and right click (Command > Click for Mac) the mouse to select 'Mask' option



11. Choose Insert > Layer to add a new layer and name it as 'Actions'

12. Select frame 3 on Actions layer and choose Insert > Keyframe

13. Select the third keyframe on the Actions layer and choose Window > Actions

14. In the Actions panel type the following actions

mouseX = _xmouse;
menuX = menu._x;
 
if (mouseX > 280) {
  diff = (mouseX-280)/15;
}
if (mouseX < 220) {
  diff = (220-mouseX)/15;
}
if (mouseX <= 250 && menuX <= 56) {
  setProperty("menu", _x, menuX+diff);
}
if (mouseX >= 250 && menuX >= -204) {
  setProperty("menu", _x, menuX-diff);
}
if (menu._x >= 56) {
  menu._x = 56;
} else if (menu._x <= -204) {
  menu._x = -204;
}
gotoAndPlay(2);


// mouseX = _xmouse;
The 'mouseX' variable stores the value of X position of the mouse

// menuX = menu._x;
The 'menuX' variable stores the value of X position of the menu movie clip

// if (mouseX > 280) {
  diff = (mouseX-280)/15;
}
This condition checks whether the value of mouseX is greater than 280. If it is true then it stores the value of the equation ((mouseX-280)/15) into a new variable called 'diff'

// if (mouseX < 220) {
  diff = (220-mouseX)/15;
}
This condition checks whether the value of mouseX is less than 220. If it is true then it stores the value of the equation ((220-mouseX)/15) into 'diff'

// if (mouseX <= 250 && menuX <= 56) {
  setProperty("menu", _x, menuX+diff);
}
This condition checks whether the value of mouseX is less than or equal to 250 as well as the value of menuX is less than or equal to 56. If this condition is true, then X position of the menu movie clip is set according to the value of equation (menuX+diff)

// if (mouseX >= 250 && menuX >= -204) {
  setProperty("menu", _x, menuX-diff);
}
This condition checks whether the value of mouseX is greater than or equal to 250 as well as the value of menuX is greater than or equal to -204. If the condition is true, then X position of the menu movie clip is set according to the value of equation (menuX-diff)

// if (menu._x >= 56) {
  menu._x = 56;
} else if (menu._x <= -204) {
  menu._x = -204;
}  
This condition checks whether the X position of menu movie clip is greater than or equal to 56. If it is true then the X position of the menu movie clip is set to 56. Else if the X position of the menu movie clip is less than or equal to -204, the X position of the menu movie clip is set to -204

// gotoAndPlay(2);
After reading all above actions in a sequence, the actionscript will read this action and then the actionscript will move to frame 2 and come again into frame 3 to read the above actions. Thus actions on frame 3 will be read repeatedly by the actionscript.

 

15. Select frame 3 on all other remaining layers and choose Insert > Frame

16. Choose Insert > Layer to add a new layer above Actions layer and name it as 'Outline'

17. With the help of 'Rectangle Tool' create a stage outline

18. Choose Control > Test Movie

Move the mouse in horizontal direction and check how the menu scrolls in other direction of the mouse.

Such kind of menu can be used for the web site as well as for presentations. You can replace the buttons with small thumbnails for presentation.

Regards,

Manoj Kotak.
The author is Director of Image Online Pvt. Ltd.
Developer of Layout Galaxy web site design templates for photoshop and Flash.

All accompanying logos, brands and product names are trademarks of their respective companies.

Blood for humans comes only from humans : Donate Blood
http://www.donate-blood.org   E-mail - om@donate-blood.org





© Image Online  2001-2003