<doc>
  <legacy_id></legacy_id>
  <name>before</name>
  <type>control structure</type>
  <syntax>
    <example>before <i>messageName</i> [<i>parametersList</i>] <i>statementList</i> end <i>messageName</i></example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>Writing LiveCode</category>
  </classification>
  <references>
    <control_st tag="after">after Control Structure</control_st>
    <control_st tag="on">on Control Structure</control_st>
    <control_st tag="exit">exit Control Structure</control_st>
    <command tag="dispatch">dispatch Command</command>
    <function tag="commandNames">commandNames Function</function>
    <function tag="result">result Function</function>
    <function tag="paramCount">paramCount Function</function>
    <keyword tag="end">end Keyword</keyword>
    <keyword tag="private">private Keyword</keyword>
  </references>
  <history>
    <introduced version="6.0">Added.</introduced>
    <experimental version=""></experimental>
    <nonexperimental version=""></nonexperimental>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
  </security>
  <summary>Defines a <glossary tag="message handler">message handler</glossary>.</summary>
  <examples>
    <example>before mouseUp</p><p>  answer "before mouse up received"</p><p>end resizeStack</example>
  </examples>
  <description>
  <p>The <b>before</b> handler is exclusive to behavior scripts and is sent to a behavior script before all messages.</p><p/>
  <p>For example, consider a mouseDown message moving through the message path. It gets to an object with a behavior script:</p><p/>
  <p>1. The engine looks at the behavior script of the target object - If a <b>before</b> mouseDown handler is present, it executes it.</p><p/>
  <p>2. The engine next looks at the object script - If an on mouseDown handler is present, it executes it.</p><p/>
  <p>3. The engine now looks at the behavior script - If an after mouseDown handler is present, it executes it.</p><p/>
  <p>4. The engine finally looks at the object script - If a pass mouseDown or no mouseDown handler is present, it moves on to the parent object.</p><p/>
  <p>A <b>before</b> handler allows developers to produce behavior scripts which can handle messages sent to a control without having any effect on the message path, unlike front and back scripts.</p><p/><p/>
  </description>
</doc>