onRelease, loops, level10 v level10.button ???


after looking @ of previous onrelease/for loop topics, i'm still stuck. have 26 buttons 26 letters in alphabet. buttons defined on stage (they they're drawn in chalk, oh boy!). i'd loop set onrelease buttons. each button's instance name single alphabetic character, thought use identify button pressed ("a", "b", "c"...). set loop:

(var thing in this) {
if (this[thing] instanceof button) {
// alphabet button names 1 character long
if (this[thing]._name.length == 1) {
this[thing].onrelease = function():void {
// thought button name, letter, passed arg
letterpressed(this._name);
}
}
}
}

unfortunately, "this" in on release @ level10, not @ button level (it's @ _level10, not _level10.a, _level10.b, etc). it's if onrelease not called in main timeline, , no longer knows button called it. it's same if directly selected button in flash editor, , called on(release) in actions panel.

by way, did try setting id button within loop, doesn't help, since "this" doesn't point right thing.

if overtly set onrelease this:

a.onrelease = function() { trace(this._name)}

i "a", want. so.....how can set these in loop, have onrelease behave it's set in timeline (which is), , not if it's set down in button? handy if use loop, , not have call 26 separate onreleases. appreciated. thank you.



More discussions in ActionScript 1 and 2


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO