Storing and object reference in a var

Sannyasin Brahmanathaswami brahma at hindu.org
Wed Jan 25 12:58:57 EST 2017


Exactly

I'm studying scripts by some "pros" (Jacque, David, Malte-animation engine)

in order to get a group on creating custom visual effect that I can use "all over the place" but creating an external script/text stack

I've been doing server side script for so many years, the whole UI coding is all new but a lot more fun!

so If you want "safe" generic handlers… and you don’t' want to worry about the name space collisions you need to use the long ID

to drive things like this

    put the long id of  grp "lessonTextControl"  into pEffectsTarget
    send "object_FadeOut pEffectsTarget,0, 2, 20" to me 
    wait for 2 seconds with messages


#then in your library:

command object_FadeIn  pEffectsTarget, newBlendLevel, someIncrement, someDelay
   set the blendLevel of  pEffectsTarget  to newBlendLevel
   if newBlendLevel > 0 then
      subtract someIncrement from newBlendLevel
      send "object_FadeIn pEffectsTarget, newBlendLevel,someIncrement,someDelay" to me in someDelay milliseconds
   else
      set the blendLevel of pEffectsTarget to 0
   end if
end object_FadeIn

command object_FadeOut  pEffectsTarget, newBlendLevel, someIncrement, someDelay
   set the blendLevel of  pEffectsTarget  to newBlendLevel
   if newBlendLevel <100 then
      add someIncrement to newBlendLevel
      send "object_FadeOut pEffectsTarget, newBlendLevel,someIncrement,someDelay" to me in someDelay milliseconds
   else
      set the blendLevel of pEffectsTarget to 100
   end if
end object_FadeOut

Disclaimer: I am not a real programmer and I don't really know what I am doing, but because it is LiveCode I can still reach my goals ☺

BR




 

On 1/25/17, 5:44 AM, "use-livecode on behalf of Bob Sneidar via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

    I want to create a variable called tTargetField so I use
    
    put "Hello" into tTargetField
    
    Now I want to put something into a field so I create a variable called tTargetField2 and
    put the long id of field "foo" into tTargetfield2
    
    Then to put something into the field I
    put "Hello" into tTargetField2
    
    Now do you see? All I am doing here is replacing the value of tTargetField2 that used to contain the long id of field "foo" with the word "Hello". How does the engine know what you mean? It's Ambiguous.
    
    Bob S
    
    



More information about the use-livecode mailing list