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

    Swap Video when Link is clicked

    Hey, I am trying to set up this html page so there is a default video. When the user clicks on the links below the default video that video loads in the place where the default is. (kind of like a swap). Im having a real hard time. I would appreciate any help.

    Right now I have but it doesnt work:

    <script type="text/javascript">
    	function playMovie( a, href ) {
    		// remove element if exists
    		var container	= document.getElementById( "playing" );
    		var flash_movie	= document.getElementById( "flash_movie" );
    		if( flash_movie ) {
    			container.removeChild( flash_movie );
    		// create new element
    		var embed = document.createElement( "EMBED" );
    		embed.setAttribute( "src",
    	"http://origin.eastbaymedia.com/embed/player.swf" );
    		embed.setAttribute( "allowFullScreen", "true" );
    		embed.setAttribute( "allowscriptaccess", "always" );
    		embed.setAttribute( "flashvars",
    		embed.setAttribute( "width", "500" );
    		embed.setAttribute( "height", "350" );
    		// clear out the cell
    		cell = a.parentNode;
    		cell.id	= 'playing';
    		while( cell.hasChildNodes() ) {
    			cell.removeChild( cell.firstChild );
    		// insert the element into the cell
    		cell.appendChild( embed );
    	</script><p>&nbsp;</p><table cellspacing="5" cellpadding="3" width="200" bgcolor="#59b323" border="0"><tbody><tr><td><div id="flash_movie"><embed bgcolor="undefined" flashvars="streamer=rtmp://fms.ebmcdn.net/8004B6/origin.eastbaymedia.com&amp;duration=00:02:12&amp;file=nyls/flash/virtual_open_house/VOH_040309_HD.flv&amp;image=http://origin.eastbaymedia.com/nyls/flash/thumbnails/virtual_open_house-VOH_040309_HD.flv.png?1239309765" src="http://origin.eastbaymedia.com/embed/player.swf" allowscriptaccess="always" allowfullscreen="true" width="500" height="350"></embed></div><p><span style="font-size: 12px; color: rgb(255,255,255)"><a onClick="playMovie( this,
    );" href="#">Open House Opening Video</a></span></p><p>&nbsp;</p></td></tr></tbody></table><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Thanked 0 Times in 0 Posts
    Why not just make the link flash? Then when the link is clicked it will load the movie no problems. Being complicated isn't always the way to go. Believe me... My flash site I created is over 300 layers... Very complex and I confuse myself in it.

  • #3
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Thanked 238 Times in 229 Posts
    Look at using ExternalInterface to have Flash and JS talk.

    How to send variables to flash using externalinterface.addcallback.

    What you should do is have a function inside of Flash that changes the movie, and the JS only allows you to invoke that function.
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.


    Tags for this Thread

    Posting Permissions

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