I’ve got a few slick scripts that I thought I would share with the world.
These are simple scripts for toggling buttons, and it works without components.
Simple version:
sd_mc._visible = false;
sd_btn.onRelease = function() {
if (!sd_mc._visible) {
sd_mc._visible = true;
} else if (sd_mc._visible) {
sd_mc._visible = false;
}
};
Example file and source:
More complex version:
//check boxes
//function to hide all the checks, doesn't affect selection state
hideChecks = function () {
for (var i:Number = 1; i<=7; i++) {
_root.ad['check'+i+'_btn']._visible = false;
}
};
//function to show the checks, doesn't affect selection state
showChecks = function () {
for (var i:Number = 1; i<=7; i++) {
_root.ad['check'+i+'_btn']._visible = true;
}
};
for (var i:Number = 1; i<=7; i++) {
_root.ad['check'+i+'_btn']._alpha = 0;
_root.ad['check'+i+'_btn'].onRelease = function() {
ad.save_btn._alpha = 100; //this turns on a save button anytime a toggle state is changed
if (getProperty(this, _name) == 'check1_btn') {
pop2_mc._visible = true; //makes a pop up appear
}
if (this._alpha == 0) {
this._alpha = 100;
} else if (this._alpha == 100) {
this._alpha = 0;
}
};
}
Hope you like it and can use it in your own projects.