# Dynamic event handlers in Director?

**URL:** <https://forum.kirupa.com/t/dynamic-event-handlers-in-director/107256>\
**Category:** Uncategorized\
**Created:** [April 13, 2004, 7:16pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-in-director/107256 "2004-04-13T19:16:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![APDesign](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@APDesign](https://forum.kirupa.com/u/APDesign)\
**Post date:** [April 13, 2004, 7:16pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers-in-director/107256/1 "2004-04-13T19:16:02Z")

</div>

I wasn’t sure where to put this, maybe Senocular will see this since he seems to know a thing or two about lingo :thumb:. I’m trying to get a grasp on how things differ there from flash… I’ve got a pretty good start but the thing that keeps pissing me off is I can’t figure out how to (or if I can??) assign events dynamically like in flash… or maybe there is a better way to do it? if you want to be continously checking something, how the heck do you do it? for instance, I’m trying to make a quicktime control behavior (yes, i realize there is a default one in the library, I’m just trying to learn) and I need to do some different checks depending on which control is being used. I’m not all that concerned with figuring this one thing out as I am with understanding how these types of things should be dealt with in director, so if someone can point me in the right direction or a to a tutorial that’d be great. I’ll post the code so you can get an idea of what my problem is.

```auto

property sChannelNum, sMovControl

on getPropertyDescriptionList
  pList=[:]
  addProp pList, #sChannelNum, [#comment:"Select video sprite channel: ", #default:0, #format:#integer]
  addProp pList, #sMovControl, [#comment: "Select video control: ", #default:#play, #format:#symbol, range:[#stop, #rewind, #fastforward, #play, #pause]]
  return pList
end

on mouseUp me
  case sMovControl of
    #play: playMov
    #pause: pauseMov
    #stop: stopMov
    #fastforward: fastMov
    #rewind: rewindMov
  end case
end

on playMov
  sprite(sChannelNum).movieRate = 1
end

on pauseMov
  sprite(sChannelNum).movieRate = 0
end

on stopMov
  sprite(sChannelNum).movieTime = 0
  sprite(sChannelNum).movieRate = 0
end

on rewindMov
  sprite(sChannelNum).movieRate = -1
end

on fastMov
sprite(sChannelNum).movieRate = 3
end

```

So for the rewind movie, I want to check to see if the movieTime hits 0, and when it does… stop it from rewinding (otherwise it just goes to the end and keeps rewinding.) A simple if sprite(sChannelNum).movieTime \<= 0 won’t work since it will only check once after the event is called. I tried using a repeat statement, but that seemed to hang everything up so I figured it was the wrong approach. If anyone has any ideas, that would be great… sorry for my ignorance, I would normally read tutorials and such but there seems to be a lack of those for lingo programming =/
