![]() |
|
Flash Player 6 r65.
The event recorder provides a basic mechanism to record and playback a series
of events issued to FMXIS components, or any component that defines an execEvent
method. This functionality might be useful in that a subject-matter expert could
record a sequence of actions on a device, store that sequence, and then playback
that sequence as part of a help function in the training (or even a wizard type
of functionality).
Important: This recorder does not take a snapshot of the system state before recording, it merely records any sequence of events it receives once the user has started recording. For playback, it does not set the system in the original state as when the recording took place--the developer must do this in whatever way is appropriate for the simulator.
![]() |
| FMXISEventRecorder component panel. |
You use the record event features, do the following:
recorder,
and a FMXISPotentiometer's instance name was pot,
you would say pot.addListener(recorder); , or pot.addEventListener("onValChg",
recorder); . "[no recorded events]", it means you did not
set up the recorder to listen to the events correctly. Check your code that
sets up the listener to the recorder.Once you have the sequence of events, you can store them in a function or method,
and then play them back whenever you want. To play back a sequence of events,
you need to have the FMXISEventRecorder component on the Stage.
The simulator can be in a different position during playback from where it was
during recording. The event recorder uses the relative position of the simulator
(given in the movie clip instance property of the event recorder) as an offset
for the cursor, rather than assuming the same positioning from recording to
playback.
You most likely will need to clean up the events with respect to timing and sometimes mouse position. You can also filter the events in case it has recorded events you don't want to playback. Let's look at an example sequence produced by the recorder:
ra.recObjs.push(new mx.fmxis.recordedEvent(22, 156, 234, ra.targClip.b1, "onSet"));
The key elements are the arguments to the recordedEvent constructor.
The first parameter is the number of milliseconds since the last event occurred.
The second and third parameters are the x and y coordinates of the mouse when
the event occurred. The fourth parameter is the component that generated the
event, and the fifth parameter is any value associated with that component.
To playback the events, do the following:
display
panel property is set to false.By default, the playback mechanism starts the cursor at the actual user mouse position. If you want to start the cursor somewhere else, set the value for X and Y coordinates in the recorder property panel. If you want to set the cursor back to start at the mouse position, enter "mouse", or simply something non-numeric.
We have made it possible to replace the default cursor with whatever graphic you want. Simply create a new movie clip with the functions outlined below, and assign it a linkage ID. In the event recorder panel, type the linkage ID in the cursor linkage ID property value.
A custom cursor must define the movie clip with the graphic such that the upper left corner is the hotspot. You also must define two functions within the movie clip:
showCursor(f) : Takes a Boolean value (f) and
makes the cursor visible (f == true) or invisible (f ==
false).activateCursor(f): Takes a Boolean value (f) indicating
whether or not to activate a cursor animation, if any.Here are the public events for the event recorder:
Playback:
playRec. Starts playing the recorded events.stopPlay. Stops playing the recorded eventsRecord:
startRec. Starts the event recording process.resetRec Resets the event recording process.pauseRec Pauses the event recording process.stopRec Stops the event recording process.serialize. Returns the recorded events as a String.Here are the public properties for the event recorder. The properties must be set at initialization time, and therefore are only respected when set through the property inspector.
dispPanel. Whether or not (true or false) to display the panel.targClip. The movie clip on which the components are defined.cursID. The linkage ID of the cursor.cursX. Starting x coordinate of the cursor for playback (default
is user "mouse" position).cursY. starting y coordinate of the cursor for playback (default
is user "mouse" position).![]() |
|