-
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
-
Senior Member
[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
-
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
-
Senior Member
i forgot the textfield class extends object, thats why i edited my post
-
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|