I’m having a problem creating a button. Its a rather complex problem, so I’ll try to be as clear as possible.
What I want the button to do:
- I just have a square button with a color fill and text. On rollover, I want the fill of the button to fade into a darker color. On rollout, I want the fill to fade back to the original color. During this time the button’s text should remain static.
- When clicked, I want the button to load a .txt into a dynamic textbox.
Here’s my problem:
I can get the button’s fill to fade in/fade out. I did this by embedding a button symbol into a movie clip symbol. I then using on (rollOver) to play the ‘fade in’ frames, and on (rollOut) to play the ‘fade out’ frames. I also put in my AS to load external text on(release), using pretty standard methods (see below). When played, the fade works but the click doesn’t. I’m guessing it’s because i’m clicking a movie clip. So I’m trying to figure out a way to achieve the fade effect and still get the button to load the text.
Here’s my AS:
This AS is put on the button symbol which is embedded in a movie clip symbol
on (rollOver) {
gotoAndPlay(“fadeIn”);
}
on (rollOut) {
gotoAndPlay(“fadeOut”);
}
on (press) {
loadText = new loadVars();
loadText.load(“pages/home.txt”);
loadText.onLoad = function(success) {
if (success) {
textBox.html = true;
textBox.htmlText = this.mytext;
}
};
Ok so if you’re patient enough to go through all that, i appreciate it. Hopefully you get my problem. I’m thinking maybe I could use some tellTarget or something. I think that using the movie clip as the final symbol on the stage is the problem, but i just cant find a way around using a movie clip. I’d appreciate any help. Thanks!