Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Aug 2008
    Posts
    105
    Thanks
    9
    Thanked 0 Times in 0 Posts

    Need help with image placeholder & flv player!

    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:

    Code:
    /* 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:
    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>

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #3
    Regular Coder
    Join Date
    Aug 2008
    Posts
    105
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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:

    Code:
    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.addChild(l)
    
    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")
    		flvPlayer.play();
    	else
    		flvPlayer.pause();
    }
    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?
    Last edited by sethwb; 06-12-2009 at 03:42 PM.

  • #4
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Well your embed code was missing some " marks, but I meant can I see the whole embed code?
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • #5
    Regular Coder
    Join Date
    Aug 2008
    Posts
    105
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Ah yes I accidentally pasted the OLD code in the original post, here is the whole thing:

    Code:
    flashvars2 = {
        source: "Karting_ENG.flv",
        image: "temp.jpg"
    		};
    swfobject.embedSWF("condensed.swf", "#video2", "250", "178", "9.0.28", null, flashvars2, {AllowScriptAccess:'always'});
    
    <table>
        <tr>
            <td>
                <div id="#video2">
                    <object id="#video2" height="175" width="257" style="visibility: visible;">
                        <param name="flashvars" value="source=test.flv&image=temp.jpg"/>
                    </object>
                </div>
            </td>
        </tr>
    </table>

  • #6
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    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.

    Code:
    flashvars2 = {
        source: "Karting_ENG.flv",
        image: "temp.jpg"
    		};
    swfobject.embedSWF("condensed.swf", "video2", "250", "178", "9.0", null, flashvars2, {AllowScriptAccess:'always'});
    
    <table>
        <tr>
            <td>
                <div id="video2"> </div>
            </td>
        </tr>
    </table>
    It appears I lost track of this for a couple days, sorry!
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • Users who have thanked gnomeontherun for this post:

    sethwb (06-16-2009)

  • #7
    Regular Coder
    Join Date
    Aug 2008
    Posts
    105
    Thanks
    9
    Thanked 0 Times in 0 Posts
    not a problem, i appreciate the help as always i will shoot you an update once fixed!


    -seth


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •