Copy link to clipboard
Copied
Hello
I have created an application which includes a menu system for selecting videos and a video player. Currently when the application opens the flv player video starts on load. I would like to change this to show a preview image which would not disappear until my users click on a button to view a video.
I have tried to use the preview image function in the flv player and received this error:
"The preview image is displayed at authoring time only. To generate a runtime preview image, use the export button and load the image back by writing your own ActionScript.”
Can someone please help me with the actionscript i need to create to load my image into the player?
Thanks
:
...
import fl.video.*;
import fl.video.VideoEvent;
showPosterFrame(null);
display.autoPlay=false;
function showPosterFrame(event:Event):void {
myPoster.visible = true;
}
function hidePosterFrame(event:Event):void {
myPoster.visible = false;
}
function playMovie(event:MouseEvent):void {
hidePosterFrame(event);
display.play();
}
myPoster.addEventListener(MouseEvent.CLICK, playMovie);
// Create variables
var safeVideo:String="videos/Fotolia_12024529_V_M (safe video).flv";
var safeVideoPlaying:Boole
Copy link to clipboard
Copied
disable it on start-up and enable it when a button is clicked.
p.s. please mark this thread as answered, if you are able.
Copy link to clipboard
Copied
so i need to add a line to my script? Sorry not sure where to make the change
Copy link to clipboard
Copied
:
import fl.video.*;
import fl.video.VideoEvent;
showPosterFrame(null);
display.autoPlay=false;
function showPosterFrame(event:Event):void {
myPoster.visible = true;
}
function hidePosterFrame(event:Event):void {
myPoster.visible = false;
}
function playMovie(event:MouseEvent):void {
hidePosterFrame(event);
display.play();
}
myPoster.addEventListener(MouseEvent.CLICK, playMovie);
// Create variables
var safeVideo:String="videos/Fotolia_12024529_V_M (safe video).flv";
var safeVideoPlaying:Boolean=false;
var videoToPlay:String;
// Handle video complete events
function videoCompletedHandler(event:VideoEvent):void {
// If the safe video just finished, then play the selected video
if (safeVideoPlaying) {
safeVideoPlaying=false;
display.source=videoToPlay;
} else {
showPosterFrame(null);
}
}
display.addEventListener(VideoEvent.COMPLETE, videoCompletedHandler);
display.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, hidePosterFrame);
// Respond to a button click
function buttonClickedHandler(event:MouseEvent):void {
var videoNum:String=event.currentTarget.name.substr(6);
videoToPlay = "videos/video"+videoNum+".flv";display.autoPlay=true;
// Play safe video
safeVideoPlaying=true;
display.source=safeVideo;
}
for(var i:uint=1;i<=12;i++){
this["Button"+i.toString()].addEventListener(MouseEvent.CLICK,buttonClickedHand ler);
}p.s. make sure there are no forum artifacts like spaces in object/variable names.
Copy link to clipboard
Copied
Teriffic, the autoPlay was my issue. I had it called earlier but forgot to add it under the button.
Thank you Kglad ... I really appreicate all your guidance and assistance!!
Copy link to clipboard
Copied
you're welcome.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more