flash actionscript:
I have the following acrionscript for by buttons. When one is pressed it stays
highlighted. Works. But if you hit the button again it will load the swf again.
I want to tell it, if this has already been pressed , do nothing. Can someone
help?
stop();
var my_so:SharedObject = SharedObject.getLocal("buttons");
btnArray = new Array("contact_mc", "services_mc", "gallery_mc", "resume_mc");
btnReset = function (nt) {
for (b in btnArray) {
btn = eval(btnArray[b]);
if (nt != btn) {
btn.gotoAndStop(1);
}
}
};
MovieClip.prototype.Pressed = function() {
this.onPress = function() {
my_so.data.itemHit = String(this);
this.gotoAndStop(2);
btnReset(this);
};
};
/
for (b in btnArray) {
btn = eval(btnArray[b]);
btn.gotoAndStop(1);
btn.Pressed();
btn.onRollOver = function() {
this.gotoAndStop(3);
};
btn.onRollOut = btn.onReleaseOutside=function () {
if (eval(my_so.data.itemHit) == this) {
this.gotoAndStop(2);
} else {
this.gotoAndStop(1);
}
};
if (eval(my_so.data.itemHit) == btn) {
//...and highlight that button...
btn.gotoAndStop(2);
}
}
_root.gallery_mc.Pressed();
_root.services_mc.Pressed();
_root.contact_mc.Pressed();
_root.resume_mc.Pressed();
fscommand("allowscale", false);
loadMovie("first.swf", "_root.theHold");
gallery_mc.onRelease = function() {
//Declares what next movie is.
nextMovie = "gallery.swf";
theHold.gotoAndPlay("out");
};
services_mc.onRelease = function() {
nextMovie = "services.swf";
theHold.gotoAndPlay("out");
};
resume_mc.onRelease = function() {
nextMovie = "resume.swf";
theHold.gotoAndPlay("out");
};
contact_mc.onRelease = function() {
nextMovie = "contact.swf";
theHold.gotoAndPlay("out");
};
stop();