Partager via


fireEvent Method (Script Component)

 

Sends notification of a custom event from the script component to the host application.

Syntax

fireEvent(eventName[,...])

Values

  • eventName
    The name of the event as defined in the <event> element.

Remarks

You can only fire events if they have been declared in the <public> element.

Note

The Behavior handler exposes a fireEvent method that is similar to the Automation handler version, but which includes support for event objects. For details, see Exposing Custom Events in Behavior Script Components.

The following shows a fragment of a script component that defines the event namechanged and shows how to fire it.

Note

A CDATA section is required to make the script in the <script> element opaque. For details, see Script Component Files and XML Conformance.

<public>
   <property name="name">
      <get/>
      <put/>
   </property>
   <event name="namechanged">
</public>

<script language="VBScript">
<![CDATA[
var name
Sub get_lowercaseName()
   get_lowercaseName = name
End Sub

Sub put_lowercaseName(newLCName)
   name = newLCName
   fireEvent("namechanged")
End Sub
]]>
</script>

See Also

<event> Element
Exposing Events
fireEvent method (Behavior Handler Reference)