User Guide

Create the application (Flash Professional only) 39
12. Open the Actions panel (Window > Actions) and type, or copy and
paste, the following code:
// Stop timeline, register soft keys, and start video.
stop ();
fscommand2 ("SetSoftKeys", "Home", "Pause");
caféVideo.play ();
var playing:Boolean = true;
// Soft key event handler code:
Key.removeListener (myListener);
var myListener:Object = new Object ();
myListener.onKeyDown = function () {
var keyCode = Key.getCode ();
if (keyCode == ExtendedKey.SOFT1) {
gotoAndPlay ("home");
}
else if (keyCode == ExtendedKey.SOFT2) {
if (playing) {
// If video is playing, pause it,
// set status variable (playing) to false,
// and set right soft key label to 'Play'.
caféVideo.pause ();
playing = false;
rightSoftKeyLabel.text = "Play";
}
else {
// If video is paused, resume its playback,
// set status variable (playing) to true,
// and set right soft key label to 'Pause'.
caféVideo.resume ();
playing = true;
righttSoftKeyLabel.text = "Pause";
}
}
};
// Register listener object:
Key.addListener (myListener);
//
// Video status handler code.
//
caféVideo.onStatus = function (infoObject:Object) {
var code = infoObject.code;
if (code == "completed") {
// If video has finished playing, set playing=false,
// and set right soft key label to "Replay":
playing = false;
rightSoftKeyLabel.text = "Replay";
}
};