First I just want to say that the kirupa site and forums have proven to be an extremely valuable asset for me. Thanks to everyone.
Now onto my quesiton:
I’m working on an interface that has several buttons. When a user clicks on a button, I want the button to be replaced with a movie clip that plays and stops once finished.
The only thing I’ve come close to getting to work is using the movie clip as a button and using tellTarget to play the movie, which works fine. However, once the movie is complete, the user can click on it again and it’ll replay. Is there a way to keep it from replaying? Am I making any sense?
Let’s say for instance I have three buttons on the left side of the stage. When the user clicks on a button, I want that button to tween to the opposite side of the stage. However, once it has finished, I don’t want there to be anymore interaction with it. That a little clearer?
There is probably a very simple remedy for this, but I can’t seem to figure it out. Thanks in advance,
I can’t upload my actual .fla because it’s classified Army material, but here’s one reflecting what I want to do. The square works, except that if you click on it again it’ll replay. That’s what I want to disable. When I use the dot method it doesn’t work. Thanks again for all the help, you guys rock.
you cant have instance names or start instance names with a number. You are using 1 and 2 - no good. Try instead using something like one and two.
telltarget() (though deprecated) still works and can be used, however its form is
tellTarget(target){
code block
}
in that example you ended it off right at the target… BUT on top of this its button code on a movieclip, which means the scope of this script is not within the scope of where the script exists (_root as it would as if this was a button clip) but instead in the scope of that movieclip itself. So to correctly reference clips within the same scope of that clip, you would have to use _parent.instanceName, or an absolute path which is in your case, _root.instanceName (which you did for the circle script).
not really a problem here since you are using movieclips, but this relates to #2. The term ‘this’ in movieclips refers to that movieclip. ‘this’ in buttons refers to the movieclip that button is in. That being the case, should you have this.enabled = false, within a button script, it would actually disable that entire movieclip which the button is in along with all buttons within it (should the movieclip be button endowed). However, like I said, since it is a movieclip you are adding these button actions to, the script is in the scope of that movieclip and the enabled is kept within that scope effecting only that movieclip.
yet you still have buttons within your movieclips which is pretty pointless since you are adding your actions to the movieclip itself and not the button. The base graphic type is a graphic, which is good, but there was no reason to convert it to a button.
if you want the movieclip you click on to play and not some other clip all you have to do is use this and not try to tell target or reference anything else. example, for each the circle and the square just use:
on (release) {
this.gotoAndPlay(2)
this.enabled = false
}
and they will play when clicked and not be re-playable afterwards
WOW! Thanks for the explaination Senocular! I’ll have to re-read that a couple times, but I think I understand it now. lol. I knew there would be an easy fix for this. Many thanks again to everyone. This forum is the best.