PDA

View Full Version : Tricky button question



brintonwhite
March 4th, 2004, 01:52 PM
Ok, I need to know a little actionscript and hope you will be able to help - I have always found replies here.

I have my main movie with home, contact and links buttons (in fact they are movie clips with buttons in them - I intend to animate these buttons eventually) - my home button movie clip has an instance name of home_mc and the button inside this has an instance name of home_button

These buttons have simple actionscript to load external swf files at level 1

What i need is some actionscript code that I can put on my home fla that tells the home button in my main FLA to disable. This will stop the home movie reloading if I press the button again - you see, the home movie loads itself with actionscript at the final frame of my main fla and I don't want it to load again if I press the home button. Am I making sense?

In fact I have uploaded a file to my server that contains some very simple fla files with these buttons and associated fla files. They were done for another person on the forum but I got no reply.
Many thanks. I have great confidence in this forum and await your reply.

http://www.galaxymusic.co.uk/oldnewbie.html

DDD
March 4th, 2004, 02:10 PM
Can you just have it go to another frame (labelled) with an instance of the button disabled? If I understand you correctly. I know it is not AS, but when you skills in AS are as dull as mine you tend to find other ways.

claudio
March 4th, 2004, 02:44 PM
Search the forums, there are plenty of scripts to disable the current button.

brintonwhite
March 4th, 2004, 03:28 PM
I know a script that will disable buttons that I could put in my main movie, but when the homepage loads with the actionscript in the timeline, and I press home button, it reloads, it will only stop loading once I have pressed one of the other buttons, that is when the code becomes active, I hope I am making sense.

Thank you.

claudio
March 4th, 2004, 03:37 PM
Then just disable the home button as the page loads.

Or use something like this:
buttons_array = ["home", "profile", "photos"];//array contaning your buttons instance names
function controlButtons(button) {
for (var i in buttons_array) {
if (this[buttons_array[i]]._name != button) {
this[buttons_array[i]].enabled = true;
} else {
this[buttons_array[i]].enabled = false;
}
}
}
for (var j in buttons_array) {
this[buttons_array[j]].onPress = function() {
controlButtons(this._name);
};
}
controlButtons(buttons_array[0]);//initially disable the 'home' button

Sceleratus
March 25th, 2004, 06:42 PM
Hello L/G

How would this script look. If I use
Movieclip symbols as buttons ?

#erik#