Skip to main content
April 16, 2006
Question

button that runs 2 actionscripts

  • April 16, 2006
  • 1 reply
  • 164 views
bc.onRollOver = function() {
if (_root.section != "images/bc_sample.jpg") {
_root.section = "images/bc_sample.jpg";
_root.transition.gotoAndPlay("closing");
}
};

Above is the code I have on frame 2. It allows my button bc to work.
It works fine, but I want button bc to do two things.


// FIRST THING //
bc.onRollOver = function() {
if (_root.section != "images/bc_sample.jpg") {
_root.section = "images/bc_sample.jpg";
_root.transition.gotoAndPlay("closing");
}
};


//AND//

// SECOND THING //
bc.onRollOver = function() {
if (_root.section != "images/bc_self.jpg") {
_root.section = "images/bc_self.jpg";
_root.trans2.gotoAndPlay("close");
}
};

HOW DO I TIE THEM TOGETHER SO THE BUTTON "bc" does both.
I am not very good at flash and I do not know how to make this work.
This topic has been closed for replies.

1 reply

Inspiring
April 16, 2006
Just connect them with a 'else', although I think it's not logical if there are more than 2 possibilities... What should happen if root.section == "images/bc_something" (if that's possible in your movie)?
Anyway, this is how it looks:

bc.onRollOver = function() {
if (_root.section != "images/bc_sample.jpg") {
_root.section = "images/bc_sample.jpg";
_root.transition.gotoAndPlay("closing");
}
else if (_root.section != "images/bc_self.jpg") {
_root.section = "images/bc_self.jpg";
_root.trans2.gotoAndPlay("close");
}
};

This code would change the pic to bc_sample.jpg, if it was bc_self.jpg before. Is that what you want? If you leave out he 'else', it would change to bc_sample.jpg and right after that back to bc_self.jpg in the same case.

hth,
blemmo