Using listeners with dynamic textBoxes

  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post August 8th, 2007, 3:31 am

Hello all!
I'm trying to put an onChanged listener on a dynamic texbox... does anyone know how to do this?
I've tried:

Code: [ Select ]
flag._visible = false;
dynamicBox.onChanged = function(){
    flag._visible = true;
}
  1. flag._visible = false;
  2. dynamicBox.onChanged = function(){
  3.     flag._visible = true;
  4. }


But that only works for input text...

and i've also tried:

Code: [ Select ]
flag._visible = false;
var myListener:Object = new Object();
myListener.onChanged = function(){
    flag._visible = true;
}
dynamicBox.addListener(myListener);
  1. flag._visible = false;
  2. var myListener:Object = new Object();
  3. myListener.onChanged = function(){
  4.     flag._visible = true;
  5. }
  6. dynamicBox.addListener(myListener);

any ideas....

Thanks.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 8th, 2007, 3:31 am

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13455
  • Loc: Florida
  • Status: Offline

Post August 8th, 2007, 4:16 am

Code: [ Select ]
var onChanged:Function = function(prop, _undefined_, newVal, obj){
    trace(prop + " changed from " + obj[prop] + " to " + newVal);
    return newVal;
}
one.watch("text", onChanged, one);

but.onPress = function(){
    one.text = 'Two';
}
  1. var onChanged:Function = function(prop, _undefined_, newVal, obj){
  2.     trace(prop + " changed from " + obj[prop] + " to " + newVal);
  3.     return newVal;
  4. }
  5. one.watch("text", onChanged, one);
  6. but.onPress = function(){
  7.     one.text = 'Two';
  8. }
  • DrGonzo
  • Beginner
  • Beginner
  • No Avatar
  • Joined: Oct 04, 2006
  • Posts: 36
  • Status: Offline

Post August 8th, 2007, 5:31 am

Perfect - thanks joebert.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 32 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.