I dyamically create a number of 'labels' for my menu but, using the
same procedure, I don't seem to able to generate the buttons.
The trace outputs the correct property for the buttons: name, x and y
but all I get is one button placed at 0, 0 even though I set its
coordinates to match the labels (I want these buttons to be right on
top of each label).
Obvioulsy I am not implementing the code in the right manner, any tips,
please? Also, how can I reference each button for the relevant functions?
Here is the code...
//___________________________Init variables_______________________________
//
var myTxt:Array = new Array("branding", "news", "about us", "print",
"marks", "contact");
var subMenuArray:Array = new Array();
var myBtnArray:Array = new Array();
var myX = 430;
var ySpacing:Number = 190;
//
//_________________create a movieClip to hold the vertical
label_________________
//
_root.lable_mc.createTextField("myName", this.getNextHighestDepth(),
484, 200, 140, 408);
myNformat = new TextFormat();
myNformat.font = "Verdana";
myNformat.size = 70;
myNformat.bold = true;
myNformat.color = 0xEEEEEE;
myNformat.align = "center";
_root.lable_mc.myName.text = "contact";
_root.lable_mc.myName.setTextFormat(myNformat);
//
//____________________create the textFields for the
subMenuItems___________________
//
for (i=0; i<myTxt.length; i++) {
_root.createTextField("mytext"+[i], this.getNextHighestDepth(), myX,
0, 100, 30);
myId = _root["mytext"+[i]];
myId._y = ySpacing;
ySpacing += 20;
// myId.text = myTxt[i];
// //____________/Format the text of the
subMenuItems/_____________________
//
myId.border = false;
myformat = new TextFormat();
myformat.font = "Verdana";
myformat.size = 13;
myformat.bold = true;
myformat.color = 0x555555;
myformat.align = "right";
//
myId.selectable = false;
myId.setTextFormat(myformat);
//
//__c/reate an Array with the submenuItems to be used in the buttons
control function/______
//
subMenuArray.push(myId.text);
//
//____________/attach a button (on top of) to each textFields/__________
//
_root.attachMovie("butt_btn", "butt"+[i], this.getNextHighestDepth());
btn = ["butt"+[i]];
btn._x = myX;
btn._y = myId._y;
//
//_________/create an array to use later to control the
buttons/_____________
//
myBtnArray.push(["butt"+[i]]);
trace(myBtnArray[i]+"y is: "+btn._y+" and the x is: "+btn._x)
// }
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com