PDA

View Full Version : Button Issue - plz and thnx



BoonDock
February 1st, 2006, 10:46 AM
Ok so I have a button that goes back to a frame on the Main Movie that plays this script at this particular frame:


myArray = ["home_quote1.swf","home_quote2.swf", "home_quote3.swf"];
randomClip = myArray[random(myArray.length)];
//usage
sub_nav.loadMovie(randomClip);

The reason I have this button going back to this particular frame is because it's sort of a "back to home" button for the site I'm doing (so that it loads a random external movie clip when you go back to the "homepage")...

My question is this: Is there any way I can put this script into the button so I don't have to go back to this frame in order to call this script to load the random movieclips?

SAVAGER
February 1st, 2006, 11:09 AM
why couldn't you put it in an onRelease event handler in the button's actions?

on (release) {
myArray = ["home_quote1.swf","home_quote2.swf", "home_quote3.swf"];
randomClip = myArray[random(myArray.length)];
//usage
gotoAndPlay ("frameName")
sub_nav.loadMovie(randomClip);
}

BoonDock
February 1st, 2006, 11:14 AM
Well if I do that, is there any way to combine that code with this code?:


on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "movieclipname";
sub_nav.loadMovie("moviename.swf");
} else if (_root.currMovie != "movieclipname") {
if (sub_nav._currentframe >= sub_nav.midframe) {
_root.currMovie = "movieclipname";
sub_nav.play();
}
}
}

In order to use the transitions?

BoonDock
February 1st, 2006, 02:52 PM
Got this one!

Here is the code:


this.onRelease = function(){
_root.gotoAndStop(227);
myArray = ["home_quote1.swf", "home_quote2.swf", "home_quote3.swf"];
_root.currMovie = myArray[random(myArray.length)];
_root.sub_nav.loadMovie(_root.currMovie);
_root.load_corner.loadMovie("home_pic.swf");
}

-thanks anyways!
:thumb: