PDA

View Full Version : using handler properties


Peadar
06-17-2005, 11:07 PM
I've used Lingo before and am just starting out with Actionscript, trying to get to grips with all the different ways of handling events by doing some basic play/stop/rewind buttons with an animation. I've no problem with the old syntax where you just attach an on (release) handler to the actual button (this is a bit like Lingo), it works fine...but I'm not clear about getting the buttons to play/stop etc using event handler properties. Assigning a function to the button's onRelease handler property directly doesn't work: stop_btn.onRelease=this.stop;
Using functional literals doesn't work either:
this.stop_btn.onRelease = function () {
_root.stop();
}
nor a more elaborated version -
stop_btn.onRelease = stopIt;
function stopIt () {
stop();
}
I put the code in the frame script while on frame 1 of layer 1. I've experimented with using/not using this and _root. Looks like the messages just aren't being passed to the buttons. I'm doing something obvious wrong??! :o