Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-18-2011, 07:19 AM   PM User | #1
mark-ids
New to the CF scene

 
Join Date: Mar 2010
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
mark-ids is an unknown quantity at this point
Javascript to Flash

Hi all

I hope you can help.
I've got a video in a .swf file which starts paused (autoplay false), but I need to restart it using javascript. Here is the code:

AS3:
Code:
import flash.external.ExternalInterface;
function playMyVideo():void
{
 video.play();//where video is the name of the video component
}
Javascript:
Code:
function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}

function callToActionscript() 
{
 getFlashMovie("clip1").playMyVideo(); 
}
HTML:
Code:
<div class="bluebox" id="video">
			<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="616" height="450" name="clip1" id="clip1" align="middle">
				<param name="movie" value="../hazard/1.swf" />
				<param name="quality" value="high" />
				<param name="bgcolor" value="#000000" />
				<param name="play" value="true" />
				<param name="loop" value="false" />
				<param name="wmode" value="window" />
				<param name="scale" value="showall" />
				<param name="menu" value="true" />
				<param name="devicefont" value="false" />
				<param name="salign" value="" />
				<param name="allowScriptAccess" value="always" />
				<!--[if !IE]>-->
				<object id="clip1" name="clip1" type="application/x-shockwave-flash" data="../hazard/1.swf" width="616" height="450">
					<param name="movie" value="../hazard/1.swf" />
					<param name="quality" value="high" />
					<param name="bgcolor" value="#000000" />
					<param name="play" value="false" />
					<param name="loop" value="false" />
					<param name="wmode" value="window" />
					<param name="scale" value="showall" />
					<param name="menu" value="true" />
					<param name="devicefont" value="false" />
					<param name="salign" value="" />
					<param name="allowScriptAccess" value="always" />
				<!--<![endif]-->
					<a href="http://www.adobe.com/go/getflash">
						<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
					</a>
				<!--[if !IE]>-->
				</object>
				<!--<![endif]-->
			</object>
</div>
<a href="#" onClick="callToActionscript();">Click me!</a><br>
For some reason I keep getting the

Code:
getFlashMovie("clip1").playMyVideo is not a function
It seems so simple, but I can't see where its going wrong.
Mark
mark-ids is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:08 PM.


Advertisement
Log in to turn off these ads.