John,

(FYI, there's something wrong with your reply to that caused this to bounce
last night with a 501 Bad address syntax error. It looks like your own
address and FlashCoders have been combined into one. I'm not sure if that
error is from you, the list, or one of the gateways along the way, but you
might want to look into it, as I have only had this problem with replying to
your post. Here's the body of the email I sent last night.)

I've made a lot of assumptions about what you're trying to do, but it looks
like you have a lot of odd syntax in your script. Avoid using _root whenever
possible, use brackets only for array indices, etc. You can also assign the
create and attach returns to a variable immediately, instead of after the
fact.

As for how you can reference the code for the relevant functions, you can
reference them either by their newly created instance name, by their
inclusion in your arrays, or you can add a function during creation.

This script addresses most of these issues and works:

//
//create missing mc lable_mc. rotated 90-degrees? ("vertical label")
//
this.createEmptyMovieClip("lable_mc",this.getNextHighestDepth());
//
//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:Number = 430;
var ySpacing:Number = 190;
var myId:TextField;
var myformat:TextFormat;
var btn:Button;
//
//create a movieClip to hold the vertical label
//
lable_mc.createTextField("myName", this.getNextHighestDepth(), 484, 200,
140, 408);
var myNformat:TextFormat = new TextFormat();
myNformat.font = "Verdana";
myNformat.size = 70;
myNformat.bold = true;
myNformat.color = 0xEEEEEE;
myNformat.align = "center";
lable_mc.myName.text = "contact";
lable_mc.myName.setTextFormat(myNformat);
//
//create the textFields for the subMenuItems
//
for (var i:Number = 0; i < myTxt.length; i++) {
    myId = this.createTextField("mytext" + i, this.getNextHighestDepth(),
myX, 0, 100, 20);
    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);
    //
    //array with submenuItems for button control
    //
    subMenuArray.push(myId.text);
    //
    //attach a button (on top of) to each textFields
    //
    btn = this.attachMovie("butt_btn", "butt" + i,
this.getNextHighestDepth());
    btn._x = myX;
    btn._y = myId._y;
    btn.onRelease = function () {
        trace(this._name);
    }
    //
    //create an array to use later to control the buttons
    //
    myBtnArray.push(btn);
}

Rich Shupe


_______________________________________________
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

Reply via email to