<doc>
	<legacy_id>1723</legacy_id>
	<name>intersect</name>
	<type>function</type>

	<syntax>
		<example>intersect(<i>object</i>,<i>object </i>[<i>,threshold</i>] )</example>
	</syntax>

	<synonyms>
	</synonyms>

	<summary><glossary tag="return">Returns</glossary> true if two <glossary tag="object">objects</glossary> overlap, false otherwise.</summary>

	<examples>
<example>intersect(field &quot;Comment&quot;,the selectedField)</example>
<example>if intersect(button &quot;target&quot;, button &quot;crosshairs&quot;) then flashScreen</example>
<example><p>if intersect(graphic &quot;spaceship&quot;, graphic &quot;asteroid&quot;, &quot;opaque pixels&quot;) then endGame</p></example>
<example>answer intersect(image &quot;gradient&quot;, grc &quot;solid&quot;,125)</example>
	</examples>

	<history>
		<introduced version="1.0">Added.</introduced>
		<deprecated version=""></deprecated>
		<removed version=""></removed>
		<changed version="5.0">5.0</changed>
	</history>

	<objects>
	</objects>

	<platforms>
		<mac/>
		<windows/>
		<linux/>
		<ios/>
		<android/>
	</platforms>

	<classes>
		<desktop/>
		<server/>
		<web/>
		<mobile/>
	</classes>

	<security>
	</security>


	<classification>
		<category>Appearance &amp; Positioning</category>
	</classification>

	<references>
		<function tag="within">within Function</function>
		<property tag="layer">layer Property</property>
	</references>

	<description>
	<overview>Use the <b>intersect</b> <control_st tag="function">function</control_st> to determine whether one <glossary tag="object">object</glossary> obscures part of another <glossary tag="object">object</glossary>, or whether one <glossary tag="object">object</glossary> is over another <glossary tag="object">object</glossary>.</overview>

		<parameters>
  <parameter>
    <name>object</name>
    <description>an object reference.</description>
  </parameter>
  <parameter>
    <name>threshold</name>
    <description>The amount of transparency that pixels in the objects must have in order to be counted during the intersect calculation.</description>
    <options title="">
<option>
        <item>alpha value</item>
        <description>An integer between 0 and 255 which specifies a threshold that the alpha value of each pixel must be greater than or equal to in order to be counted during calculation of the intersect.</description>
      </option>
</options>
<options title="Alternative (readable) theshold options">
      <option>
        <item>"bounds"</item>
        <description>(Equivalent to using an alpha value of 0) Specifies that the intersect is calculated using the rect of the two objects.</description>
      </option>
      <option>
        <item>"pixels"</item>
        <description>(Equivalent to using an alpha value of 1) Specifies that the intersect is calculated using pixels of the objects that have are not completely transparent, ignoring completely transparent areas.</description>
      </option>
      <option>
        <item>"opaque pixels"</item>
        <description>(Equivalent to using an alpha value of 255) Specifies that the intersect is calculated using only pixels that are completely opaque.</description>
      </option>
      
    </options>
  </parameter>		</parameters>

	<value>The <b>intersect</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> true or false.</value>
	<comments>If both <i>objects</i> are <function tag="stacks">stacks</function> or <glossary tag="card">cards</glossary>, the <b>intersect</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> true if the <glossary tag="stack window">stack windows</glossary> overlap.<p></p><p>The <b>intersect</b> <control_st tag="function">function</control_st> uses screen coordinates for <function tag="stacks">stacks</function> and <glossary tag="card">cards</glossary>, and <glossary tag="relative coordinates">window coordinates</glossary> for <glossary tag="control">controls</glossary>. This means that if one <i>object</i> is a <object tag="stack">stack</object> or <keyword tag="card">card</keyword> and the other is a <keyword tag="control">control</keyword>, the <b>intersect</b> <control_st tag="function">function</control_st> does not <constant tag="return">return</constant> a reliable result.</p></comments>
	</description>
</doc>