
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.
Summary of Contents for DIRECTOR MX 2004-USING DIRECTOR
Page 1: ...DIRECTOR MX 2004 Using Director...
Page 16: ...16 Chapter 1 Introduction...
Page 82: ...82 Chapter 3 Sprites...
Page 98: ...98 Chapter 4 Animation...
Page 134: ...134 Chapter 5 Bitmaps...
Page 242: ...242 Chapter 10 Sound and Synchronization...
Page 274: ...274 Chapter 11 Using Digital Video...
Page 290: ...290 Chapter 12 Behaviors...
Page 302: ...302 Chapter 13 Navigation and User Interaction...
Page 334: ...334 Chapter 15 The 3D Cast Member 3D Text and 3D Behaviors...
Page 392: ...392 Chapter 16 Working with Models and Model Resources...
Page 418: ...418 Chapter 18 Movies in a Window...
Page 446: ...446 Chapter 22 Managing and Testing Director Projects...