Groges
07-29-2003, 05:53 AM
I have just attempted writing my first class for a button. The variables are all passed through correctly (verified with traces), I am pretty sure the problem is with my attachmovie syntax. My library contains topnavbutton_pb and topnavbutton_lbl, the class method is meant to attach both these movies place them via x and y and give the label some text via the LabelText variable. Any help would really be appreciated!! I have searched for an answer for this and could not find one, I would hate my first post to be a crossthread:p
here is the code:
TopNavButtonClass = function(ButtonName,ButtonInstanceName,ButtonDepth Number,ButtonxCoord,ButtonyCoord,LabelName,LabelIn stanceName,LabelDepthNumber,LabelxCoord,LabelyCoor d,LabelText ){
this.ButtonName = ButtonName;
this.ButtonInstanceName = ButtonInstanceName;
this.ButtonDepthNumber = ButtonDepthNumber;
this.ButtonxCoord = ButtonxCoord;
this.ButtonyCoord = ButtonyCoord;
this.LabelName = LabelName;
this.LabelInstanceName = LabelInstanceName;
this.LabelDepthNumber = LabelDepthNumber;
this.LabelxCoord = LabelxCoord;
this.LabelyCoord = LabelyCoord;
this.LabelText = LabelText;
trace("in class");
}
TopNavButtonClass.prototype.createbuttons = function(){
attachMovie(this.ButtonName,this.ButtonInstanceNam e);
[this.ButtonInstanceName]._x = [this.ButtonxCoord];
[this.ButtonInstanceName]._y = [this.ButtonyCoord];
attachMovie(this.LabelName,this.LabelInstanceName, this.LabelDepthNumber);
[this.LabelInstanceName]._x = [this.LabelxCoord];
[this.LabelInstanceName]._y = [this.LabelyCoord];
[this.LabelInstanceName].text_lbl.text=this.LabelText;
trace("in method");
trace(this.ButtonDepthNumber);
}
HomeButton = new TopNavButtonClass("topnavbutton_pb","topnavbutton_pb_Home",10,19,47,"topnavbutton_lbl","topnavbutton_lbl_Home",11,19,47,_Global.Top_Home_Button);
HomeButton.createbuttons();
Oh yeah if this code is bad please tell me better I learn the right way early,
Cheers
here is the code:
TopNavButtonClass = function(ButtonName,ButtonInstanceName,ButtonDepth Number,ButtonxCoord,ButtonyCoord,LabelName,LabelIn stanceName,LabelDepthNumber,LabelxCoord,LabelyCoor d,LabelText ){
this.ButtonName = ButtonName;
this.ButtonInstanceName = ButtonInstanceName;
this.ButtonDepthNumber = ButtonDepthNumber;
this.ButtonxCoord = ButtonxCoord;
this.ButtonyCoord = ButtonyCoord;
this.LabelName = LabelName;
this.LabelInstanceName = LabelInstanceName;
this.LabelDepthNumber = LabelDepthNumber;
this.LabelxCoord = LabelxCoord;
this.LabelyCoord = LabelyCoord;
this.LabelText = LabelText;
trace("in class");
}
TopNavButtonClass.prototype.createbuttons = function(){
attachMovie(this.ButtonName,this.ButtonInstanceNam e);
[this.ButtonInstanceName]._x = [this.ButtonxCoord];
[this.ButtonInstanceName]._y = [this.ButtonyCoord];
attachMovie(this.LabelName,this.LabelInstanceName, this.LabelDepthNumber);
[this.LabelInstanceName]._x = [this.LabelxCoord];
[this.LabelInstanceName]._y = [this.LabelyCoord];
[this.LabelInstanceName].text_lbl.text=this.LabelText;
trace("in method");
trace(this.ButtonDepthNumber);
}
HomeButton = new TopNavButtonClass("topnavbutton_pb","topnavbutton_pb_Home",10,19,47,"topnavbutton_lbl","topnavbutton_lbl_Home",11,19,47,_Global.Top_Home_Button);
HomeButton.createbuttons();
Oh yeah if this code is bad please tell me better I learn the right way early,
Cheers