Page 1 of 1
referring to a script's object
Posted: Sun Dec 18, 2011 5:21 am
by monki
Code: Select all
on mouseEnter
put long ID of this field into tfieldID
put tfieldID into positonFld
end mouseEnter
This code fails with a " field "txtPreviewFld": execution error at line 2 (Chunk: no such object), char 16 " error.
Any idea what the problem could be? Does "this" only work with cards and stacks?
Re: referring to a script's object
Posted: Sun Dec 18, 2011 10:23 am
by jmburnod
Hi Monki,
Use "the target" instead "this fld" and it work
Code: Select all
on mouseEnter
put long ID of the target into tfieldID
put tfieldID into positonFld
end mouseEnter
Best regards
Jean-Marc
Re: referring to a script's object
Posted: Sun Dec 18, 2011 10:56 am
by sturgis
If you have a script in an object itself (rather than in a card or stack) you can use the "me" keyword also.
Code: Select all
on mouseEnter
put the long id of me into tFieldID
put tFieldID into positionFld
end mouseEnter
Of course there are more useful examples of "me" like having a button set its own label, or a field setting its own contents or whatever.
Code: Select all
set the label of me to "myNewLable"
jmburnod wrote:Hi Monki,
Use "the target" instead "this fld" and it work
Code: Select all
on mouseEnter
put long ID of the target into tfieldID
put tfieldID into positonFld
end mouseEnter
Best regards
Jean-Marc
Re: referring to a script's object
Posted: Sun Dec 18, 2011 5:12 pm
by monki
Thanks for the help guys.
"me" worked sturgis. I though thought I tried that word, but I must have worded something wrong.
I thought that the "me" keyword was originally part of hyperTalk and searched for it in the livecode dictionary, but the search didn't turned up anything. So after reading your post, I manually scrolled the dictionary list and found it that way.
Oh well.
Thanks for the help
Re: referring to a script's object
Posted: Tue Dec 20, 2011 12:10 am
by jmburnod
Hi,
It seem the target is better than me
for a btn:
put me = cd id 1002
put the long id of me = card id 1002 of stack...
put the backgroundcolor of me = empty
Best regards
Jean-Marc