Particular behavior

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Particular behavior

dunbarx via use-livecode
Hi,

With all the discussion of behaviors… I haven’t used behaviors yet, but am wondering if that will work in this scenario:

I have a stack “PlayerFoo” containing a player, the player has callbacks set.
When the player plays, I want the callbacks to be handled by a card script in another stack.

I could have a card script in the same card that has the player. This card script could have a handler doCallback containing the command:

        send “doCallback” to card “CardFoo" of stack “StackFoo” with tCallback

where the callback is then acted on.

Is there a way to apply behaviors to this scenario?

Peter Bogdanoff
ArtsInteractive
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Particular behavior

dunbarx via use-livecode
If I'm understanding correctly, then sure, given the caveat that only
buttons and script-only stacks (and maybe regular stacks?) can be
behaviors. So either:

Put the callback handler(s) that are currently in card “CardFoo" of stack
“StackFoo” into a button. Set the button as the behavior of the player.

or:

Create a script-only stack. Put the callback handler(s) that are currently
in card “CardFoo" of stack “StackFoo” into the script of that stack. Save
the stack someplace relevant to your project, for example, right next to
your project, or in a folder called something like "behaviors" that is
right next to your project. Then set the stack as the behavior for your
player, and remember to set the stackfiles property of the stack the player
is in to include a reference to the new script-only stack.

Work on a copy, or just be careful to document exactly what you do so you
can roll it back if needed.

On Tue, Jan 23, 2018 at 1:25 PM, Peter Bogdanoff via use-livecode <
[hidden email]> wrote:

> Hi,
>
> With all the discussion of behaviors… I haven’t used behaviors yet, but am
> wondering if that will work in this scenario:
>
> I have a stack “PlayerFoo” containing a player, the player has callbacks
> set.
> When the player plays, I want the callbacks to be handled by a card script
> in another stack.
>
> I could have a card script in the same card that has the player. This card
> script could have a handler doCallback containing the command:
>
>         send “doCallback” to card “CardFoo" of stack “StackFoo” with
> tCallback
>
> where the callback is then acted on.
>
> Is there a way to apply behaviors to this scenario?
>
> Peter Bogdanoff
> ArtsInteractive
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode