User Guide
502 Chapter 6: Components Dictionary
7.
Set the desired options for the Automatically Play, Use Preferred Media Size, and Respect
Aspect Ratio check boxes.
8.
Set the control placement to the desired side of the MediaPlayback component.
9.
Add a cue point toward the end of the media; this cue point will be used with a listener to open
a pop-up window that announces that the movie is on sale. Give the cue point the name
cuePointName.
Next, you’ll set the cue point time such that it is within a few seconds of the end of the clip.
10.
Double-click a Window component to place on the Stage; then delete it.
This places a symbol called Window in your library.
11.
Create a text box and write some text informing the user that the movie is on sale.
12.
Select Modify > Convert to Symbol to convert the text box to a movie clip, and give it the name
mySale_mc.
13.
Right-click (Windows) or Control-click (Macintosh) the mySale_mc movie clip in the library,
select Linkage, and select Export for ActionScript.
This places the movie clip in your runtime library.
14.
Add the following ActionScript to Frame 1. This code creates a listener to open a pop-up
window informing the user that the movie is on sale.
// Import the classes necessary to create the pop-up window dynamically
import mx.containers.Window;
import mx.managers.PopUpManager;
// Create a listener object to open sale pop-up
var saleListener = new Object();
saleListener.cuePoint = function(evt){
var saleWin = PopUpManager.createPopUp(_root, Window, false, {closeButton:
true, title: "Movie Sale ", contentPath: "mySale_mc"});
// Enlarge the window so that the content fits
saleWin.setSize(80, 80);
var delSaleWin = new Object();
delSaleWin.click = function(evt){
saleWin.deletePopUp();
}
saleWin.addEventListener("click", delSaleWin);
}
myMedia.addEventListener("cuePoint", saleListener);