views:

26

answers:

0

First the details

  • Using AS2 (Scaleform)
  • The solution needs to be global at least within a swf
    • All of our UI is already made and this is purely for visual indication in-house of an issue with text size.

I need to be able to globally catch when the text for a TextFeild changes and then perform my check. I have tried a few things with mixed results:

  • onChanged
    • This seems to work randomly. Some of my text boxes report the text change and others do not. I have not be able to determine a cause for this.
  • addProperty( "text"... and creating my own set and get functions.
    • This is kind of scary imo but again not going to be a production change so I'm willing to go with it over modifying ever instance a textfield is being populated. In addition I have not been able to get this to work correctly either. I have not be able to find documentation or otherwise on how these functions need to operate in order to maintain the default functionality of the textfield.

The code is rather simple. I have a TextField on the stage called MessageBox. In the first frame AS code I am doing the following:

TextField.prototype.onChanged = function( tf:TextField ){
    trace( "-------------------------------------------" );
    trace( tf.text );
    TextfieldEllipsis.calcuateEllipsis( tf );
    trace( tf.text );
}
MessageBox.text = "Blah Blah Blah";

I am getting none of the traces from this function. Is this not do-able via the prototype perhaps? When I set the onChanged function on each textfield I still get mixed results. This is a simple version of what I'm actually doing. I can't post the code here unfortunately but if needed I will create a side test fla that can show the issues I'm seeing.