A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: watch("text")

  1. #1
    Senior Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    493

    watch("text")

    watch causes text field to be undefined
    The code below executres and traces out updated when mouseDown Clicked.
    But text property displays undefined. (N.B. aTB is a dynamic text field on the stage)

    Comment the watch out and text displays fine...... ?

    Anyone had same or similar issue? As seems a bit odd that you can watch the property but it affects its value!!!

    Code:
    traceME=function()
    {
    	trace("updated")
    }
    
    
    aTB.watch("text",traceME)
    
    onMouseDown=function()
    {
    	aTB.text="hello"
    }

    Any ideas or pointers appreciated.

    Cheers
    Jon

  2. #2
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    [Edit] what a load of rubbish lol.

    here you go, it was just a matter of getting the callbackfunction right:
    Code:
    function traceMe(prop, oldVal, newVal) {
    	if (newVal != oldVal) {
    		trace("editied");
    	}
    	return newVal;
    }
    aTB.watch("text", traceMe);
    onMouseDown = function () {
    	aTB.text = "hello";
    };
    HTH,

    zlatan
    Last edited by dudeqwerty; 09-07-2006 at 07:40 AM.
    New sig soon

  3. #3
    Senior Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    493
    Hi Thanks for the reply.

    Why does it trigger then if it is not part of the Textfiled class? Also is the textfield class not a base Object extended class ? (i may be wrong here?)

    Cheers
    Jon

  4. #4
    Senior Member dudeqwerty's Avatar
    Join Date
    Mar 2005
    Location
    Bosnia
    Posts
    1,626
    i forgot the textfield class extends object, thats why i edited my post
    New sig soon

  5. #5
    Senior Member
    Join Date
    Apr 2001
    Location
    UK
    Posts
    493
    thanks for that. i see this in the help files now. Its a bit of an odd implementation i think as i may want to update something and do something else when it is changed...without tying this change to updating the property...if that makes sense?

    Thanks for your help though

    Jon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center