View Full Version : Need help with image placeholder & flv player!

06-10-2009, 10:09 PM
Hey guys new to flash/as3 here...

We're trying to get this placeholder image to appear in front of the flash until the user clicks on it, but we can't get the damn thing to show up! Any ideas what is going wrong?

This is the library we're using to grab the player:

/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>

Here's our code:

var flashvars = {
source: "test.flv",
image: "temp.jpg"

<object id="#video2" height="175" width="257" style="visibility: visible;"><param name="flashvars" value="source=test.flv&image=temp.jpg/></object>

06-11-2009, 10:12 PM
There are some errors with your embed code. Read the post in my signature about embeding Flash, and it should help you out. Otherwise I need to see the whole embed code.

What FLV player? Unless the FLV player supports a preview image, nothing you do in the embed code will make it work.

06-12-2009, 04:27 PM
So it looks like we are doing it the dynamic way...

I'm definitely thinking that there is an error with our embed code, and not the SWF because it looks like its trying to put an image in front, but it just turns grey then dissapears once the rest of the page loads...

Plus there is this:

import fl.video.FLVPlayback;
import flash.events.MouseEvent;

flvPlayer.alpha = 0;

var fp:FLVPlayback = flvPlayer;
//fp.playPauseButton = ppb;
fp.seekBar = sb;
fp.backButton = backb;
fp.volumeBar = vb;

ppb.buttonMode = true;
ppb.mouseChildren = true;
backb.buttonMode = true;
backb.mouseChildren = false;

var varName:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

fp.source = String(paramObj["source"]);
var placeholderImg:String = String(paramObj["image"]);

var l = new Loader();
l.load(new URLRequest(placeholderImg));

placeholderImage.addEventListener(MouseEvent.CLICK, onClickHandler);
ppb.addEventListener(MouseEvent.CLICK, onClickHandler);
placeholderImage.buttonMode = true;

function onClickHandler(myEvent:MouseEvent) {
flvPlayer.alpha = 1;
if(flvPlayer.state == "playing" || flvPlayer.state == "buffering" || flvPlayer.state == "stopped")

This is the code from the flv player... something looks funny about the way it adds the image to the page, but then I'm used to javascript not as3... any ideas from looking at this what to do?

06-12-2009, 09:11 PM
Well your embed code was missing some " marks, but I meant can I see the whole embed code?

06-12-2009, 10:30 PM
Ah yes I accidentally pasted the OLD code in the original post, here is the whole thing:

flashvars2 = {
source: "Karting_ENG.flv",
image: "temp.jpg"
swfobject.embedSWF("condensed.swf", "#video2", "250", "178", "9.0.28", null, flashvars2, {AllowScriptAccess:'always'});

<div id="#video2">
<object id="#video2" height="175" width="257" style="visibility: visible;">
<param name="flashvars" value="source=test.flv&image=temp.jpg"/>

06-16-2009, 09:39 AM
You are using the dynamic mode, so no need for object tags at all. SWFObject does it for you. Also, the # in the ID might be causing issues. Only use alphanumeric characters and - or _. You have also ignored using the attributes, which you may want to use.

flashvars2 = {
source: "Karting_ENG.flv",
image: "temp.jpg"
swfobject.embedSWF("condensed.swf", "video2", "250", "178", "9.0", null, flashvars2, {AllowScriptAccess:'always'});

<div id="video2"> </div>

It appears I lost track of this for a couple days, sorry!

06-16-2009, 06:53 PM
not a problem, i appreciate the help as always i will shoot you an update once fixed!