Wednesday, August 15, 2007

the _root of some evil [buttons]

While playing with some Federated Media banners I stumbled once more upon the infamous parent property reference issue for the on handler. At least for me because I always forget about it by the time the next banner gig comes at a desktop near me...
Thing is that it differs from for buttons to movie clips.
So the FM guide was following closely the Adobe one and using a button with the sample code:

on( release ){
if (clickTAG.substr(0,5) == "http:") {
getURL( clickTAG, "_blank" );

And my beloved mantra of not using buttons unless in a life threatening situation bit me mercilessly because when using the above code on a movie clip we need to put _root explicitly when referencing the clickTAG property as in:

on( release ){
if (_root.clickTAG.substr(0,5) == "http:") {
getURL( _root.clickTAG, "_blank" );

Well it's things like these that give the adrenaline rush in a flasher's flashy day. No doubt about it :D


Post a Comment

<< Home