User Guide
206 Chapter 9: Using Flash, Flash Components, and Other Interactive Media Types
When you insert an ActiveX control in a Director movie, you can view the methods exposed by
the control by clicking the Methods tab of the Control Properties dialog box for the ActiveX
control. The dialog box displays each method supported by the ActiveX control and a description
of the parameters for each method.
In Director, all methods that an ActiveX control supports are methods for the corresponding
sprite. The generic syntax for calling an ActiveX control method is as follows:
ReturnValue = sprite(N).MethodName(param1, param2, ...)
As an example, if the Microsoft Access Calendar control is inserted into a Director movie as the
second sprite on the Score, the following script would increment the year displayed within the
Calendar control:
sprite(2).NextYear()
For the same Calendar control, the following script would decrement the year displayed by the
Calendar control:
sprite(2).PrevYear()
Parameters passed to the ActiveX control are automatically converted from their Director data
types to equivalent ActiveX data types. Likewise, the return value is automatically converted from
an ActiveX data type to an equivalent Director data type.
Using ActiveX control events
Each ActiveX control typically generates a variety of events. For example, a button ActiveX
control may generate a
click event when the button is pressed, and a calendar ActiveX control
may generate a
dateChanged event when the date within the calendar is changed. Director
converts any event generated by the ActiveX control to a sprite event that it can handle. A list of
the control’s events appears in the Events tab of the ActiveX Control Properties window.
To respond to an event generated by the ActiveX control, you must write an event handler to
capture the event. You can place these event handlers in movie scripts, sprite behaviors, scripts
assigned to cast members, or frame behaviors. However, you normally place the handler in the
behavior attached to the sprite for the ActiveX control.
As an example, if the Microsoft Access Calendar control is inserted into a Director movie as
a sprite on the score, the following script would capture the
click event from the
Calendar control:
on click
-- Do something interesting here.
beep 2
end
A sprite behavior is a good location for this handler.