Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help creating preview image for flv player

New Here ,
Feb 05, 2010 Feb 05, 2010

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

TOPICS
ActionScript
3.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 08, 2010 Feb 08, 2010

:



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

...
Translate
Community Expert ,
Feb 08, 2010 Feb 08, 2010

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2010 Feb 08, 2010

so i need to add a line to my script?  Sorry not sure where to make the change

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2010 Feb 08, 2010

:



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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 08, 2010 Feb 08, 2010

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!!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2010 Feb 08, 2010
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines