- Home
- Tutorials
- Flash
- Intermediate
- 3D Menu in Flash CS3/CS4 using Flash Player 10 3D API
3D Menu in Flash CS3/CS4 using Flash Player 10 3D API

Code Part 2 - Instnatiating the clips in the library
Okay so it goes a little something like this:
var f1:s1 = new s1();//Instantiate your first menu item
var f2:s2 = new s2();//Instantiate your second menu item
var f3:s3 = new s3();//Instantiate your third menu item
var f4:s4 = new s4();//Instantiate your fourth menu item
var f5:s5 = new s5();//Instantiate your fifth menu item
var f6:s6 = new s6();//Instantiate your sixth menu item
//
f1.z = 1000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
f2.z = 3000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
f3.z = 5000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
f4.z = 7000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
f5.z = 9000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
f6.z = 11000;//This item is a placement value and will need adjustment - this sets the depth (in space) of the clip)
//
f1.x = 450;//This is a placment value and will need adjustement
f2.x = 450;//This is a placment value and will need adjustement
f3.x = 450;//This is a placment value and will need adjustement
f4.x = 450;//This is a placment value and will need adjustement
f5.x = 450;//This is a placment value and will need adjustement
f6.x = 450;//This is a placment value and will need adjustement
//
f1.y = 460;//This is a placment value and will need adjustement
f2.y = 450;//This is a placment value and will need adjustement
f3.y = 450;//This is a placment value and will need adjustement
f4.y = 450;//This is a placment value and will need adjustement
f5.y = 450;//This is a placment value and will need adjustement
f6.y = 450;//This is a placment value and will need adjustement
//
//Set the button modes for the menu items
f1.buttonMode = true;
f2.buttonMode = true;
f3.buttonMode = true;
f4.buttonMode = true;
f5.buttonMode = true;
f6.buttonMode = true;
//
//Set the button modes for the buttons
b1.buttonMode = true;
b2.buttonMode = true;
b3.buttonMode = true;
b4.buttonMode = true;
b5.buttonMode = true;
b6.buttonMode = true;
//
//Set the event listeners for the menu buttons
f1.addEventListener(MouseEvent.CLICK, moveCam);
f2.addEventListener(MouseEvent.CLICK, moveCam);
f3.addEventListener(MouseEvent.CLICK, moveCam);
f4.addEventListener(MouseEvent.CLICK, moveCam);
f5.addEventListener(MouseEvent.CLICK, moveCam);
f6.addEventListener(MouseEvent.CLICK, moveCam);
//
//add the menu items to the display list as a child of the mySpace Sprite/MovieClip
mySpace.addChild(f1);
mySpace.addChild(f2);
mySpace.addChild(f3);
mySpace.addChild(f4);
mySpace.addChild(f5);
mySpace.addChild(f6);
Okay so that code is pretty self-explanitory. You instiated all of your menu items and then added a click event listener for a function we're going to write in a bit and then added it to the display list. Moving right along...

