[SIZE=1]I have 5 instances of a movie clip that need to move to a frame labeled “highlight” on Rollover and to a frame labeled “unhighlight” on Rollout. On Release each needs to get a different URL.[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]I got it working, but the script is pretty repetitive. Can someone show me how to shorten the script by creating a function or something similar that would handle the rollover and rollout part? Code for two of the movie clips below.[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]Thanks![/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]------------------------------------------------------------[/SIZE]
[SIZE=1][/SIZE]
[SIZE=1]// On Rollover, highlight button
this.main_mc.btn1.onRollOver = function () {
if(!pressed)
main_mc.btn1.gotoAndPlay(“highlight”);
}
// On Rollout, exit mouseover highlight
this.main_mc.btn1.onRollOut = function () {
if(!pressed)
main_mc.btn1.gotoAndPlay(“unhighlight”);
}
// On Release, getURL
this.main_mc.btn1.onRelease = function () {
getURL("[/SIZE][SIZE=1]http://www.cnn.com[/SIZE][SIZE=1]");
main_mc.btn1.gotoAndPlay(“unhighlight”);
// on release exit mouse-over
pressed = true;
}[/SIZE]
[SIZE=1]// On Dragout, exit mouse-over
this.main_mc.btn1.onDragOut = function () {
main_mc.btn1.gotoAndPlay(“unhighlight”);
}[/SIZE]
[SIZE=1]/*********************************************************/
// On Rollover, highlight button
this.main_mc.btn2.onRollOver = function () {
if(!pressed)
main_mc.btn2.gotoAndPlay(“highlight”);
}
// On Rollout, exit mouseover highlight
this.main_mc.btn2.onRollOut = function () {
if(!pressed)
main_mc.btn2.gotoAndPlay(“unhighlight”);
}
// On Release, getURL
this.main_mc.btn2.onRelease = function () {
getURL("[/SIZE][SIZE=1]http://www.espn.com[/SIZE][SIZE=1]");
main_mc.btn1.gotoAndPlay(“unhighlight”);
// on release exit mouse-over
pressed = true;
}[/SIZE]
[SIZE=1]// On Dragout, exit mouse-over
this.main_mc.btn2.onDragOut = function () {
main_mc.btn2.gotoAndPlay(“unhighlight”);
}[/SIZE]