Next Behaviors - Scope of Variables

Sannyasin Brahmanathaswami brahma at
Wed Apr 25 10:18:04 EDT 2018

I just implemented by first use of nested behaviors. Marvelous!

But it occurred to me right away, that I could use variables which were "local", in the sense that their scope was within the context of the nested arrays. Of course needed to declare the inside the behavior, otherwise you get confused, but they are no globals.

I have nested "behavior_ListenUI"
    # a generic UI that words of several cards

# inside

          # just for this one card.

# On this card I am forced to use  local set up "silly handlers"

local sDownloadedAudioA

on passAudioSelection pLine,pTitle
      startPlayer sDownloadedAudioA[pLine][localURL],pTitle
end passAudioSelection

# because the startPlayer behavior  is on the "generic"  "behavior_ListenUI"

but if "sDownloadAudioA" was available to "behavior_ListenUI"

I won't need to passAudioSelection pLine,pTitle

instead, I just declare the

semi-local  sDownloadedAudioA

on the mouseup handler it to a straight

      startPlayer sDownloadedAudioA[pLine][localURL],pTitle


I hope that makes sense… if could post the entire scripts if it doesn’t .

More information about the Use-livecode mailing list