thursj
08-24-2005, 05:01 PM
I have a stoplight component that has a status variable for red (frame 1 with a stop();), yellow (frame 2 with a stop();) or green (frame 3 with a stop();).
Here is it's code:
#initclip
function DashLightReportClass () {
this.update();
}
// Allow StatusLightClass to inherit MovieClip properties
DashLightReportClass.prototype = new MovieClip();
DashLightReportClass.prototype.setStatus = function (s) {
this.tstatus = s;
this.update();
}
DashLightReportClass.prototype.getStatus = function() {
return this.tstatus;
};
DashLightReportClass.prototype.setPopup = function (p) {
this.tpopup = p;
this.update();
}
DashLightReportClass.prototype.getPopup = function () {
return tpopup;
}
DashLightReportClass.prototype.setExcelURL = function (x) {
this.texcelurl = x;
this.update();
}
DashLightReportClass.prototype.getExcelURL = function () {
return texcelurl;
}
// Connect the class with the linkage ID for this movie clip
Object.registerClass("FDashLightReport", DashLightReportClass);
#endinitclip
The tstatus will decide which frame is played in the movie with the following code:
//button component
switch (tstatus) {
case 'R':
gotoAndPlay(1);
break;
case 'Y':
gotoAndPlay(2);
break;
case 'G':
gotoAndPlay(3);
break;
default:
gotoAndPlay(1);
txt_popup.visible = false;
break;
}
I am using the attachmovieclip statement to bring the component to the stage:
attachMovie("DLReport", "mc_name_1", getNextHighestDepth(), {tstatus: "G", tpopup:"Some text for the popup"});
My question is this, I can change the variable to R by using mc_name_1.tstatus = "R" by putting it below the attachmovie function but, if I try to assign it to a button with:
on (release) {
mc_name_1.tstatus = "R";
}
it does not work...
Now, I can get the existing movieclips properties, write them to a variable, remove the existing clip and attach it again with it's old variables plus the "R" and it works. This seems like a long way to around to get the solution.
My end result I am looking for is to be able to make the clip change to another color by using mc_name_1.tstatus = "R";
Any help would be appreciated.
thanks,
J Thurston
Here is it's code:
#initclip
function DashLightReportClass () {
this.update();
}
// Allow StatusLightClass to inherit MovieClip properties
DashLightReportClass.prototype = new MovieClip();
DashLightReportClass.prototype.setStatus = function (s) {
this.tstatus = s;
this.update();
}
DashLightReportClass.prototype.getStatus = function() {
return this.tstatus;
};
DashLightReportClass.prototype.setPopup = function (p) {
this.tpopup = p;
this.update();
}
DashLightReportClass.prototype.getPopup = function () {
return tpopup;
}
DashLightReportClass.prototype.setExcelURL = function (x) {
this.texcelurl = x;
this.update();
}
DashLightReportClass.prototype.getExcelURL = function () {
return texcelurl;
}
// Connect the class with the linkage ID for this movie clip
Object.registerClass("FDashLightReport", DashLightReportClass);
#endinitclip
The tstatus will decide which frame is played in the movie with the following code:
//button component
switch (tstatus) {
case 'R':
gotoAndPlay(1);
break;
case 'Y':
gotoAndPlay(2);
break;
case 'G':
gotoAndPlay(3);
break;
default:
gotoAndPlay(1);
txt_popup.visible = false;
break;
}
I am using the attachmovieclip statement to bring the component to the stage:
attachMovie("DLReport", "mc_name_1", getNextHighestDepth(), {tstatus: "G", tpopup:"Some text for the popup"});
My question is this, I can change the variable to R by using mc_name_1.tstatus = "R" by putting it below the attachmovie function but, if I try to assign it to a button with:
on (release) {
mc_name_1.tstatus = "R";
}
it does not work...
Now, I can get the existing movieclips properties, write them to a variable, remove the existing clip and attach it again with it's old variables plus the "R" and it works. This seems like a long way to around to get the solution.
My end result I am looking for is to be able to make the clip change to another color by using mc_name_1.tstatus = "R";
Any help would be appreciated.
thanks,
J Thurston