
Chapter 11
318
As an example, if the Microsoft Access Calendar control is inserted into a Director movie as the
second sprite on the Score, the following Lingo code would increment the year displayed within
the Calendar control:
sprite(2).NextYear()
For the same Calendar control, the following Lingo code 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 Lingo code 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
Page 1: ...Using Director MX Macromedia Director MX ...
Page 12: ...Contents 12 ...
Page 156: ...Chapter 4 156 ...
Page 202: ...Chapter 6 202 ...
Page 244: ...Chapter 7 244 ...
Page 292: ...Chapter 10 292 ...
Page 330: ...Chapter 12 330 ...
Page 356: ...Chapter 13 356 ...
Page 372: ...Chapter 14 372 ...
Page 442: ...Chapter 16 442 ...
Page 472: ...Chapter 18 472 ...
Page 520: ...Chapter 19 520 ...
Page 536: ...Chapter 20 536 ...
Page 562: ...Chapter 23 562 ...
Page 566: ...Chapter 24 566 ...
Page 602: ...Chapter 27 602 ...