Make Flash Animations, Video, Slideshows, Text Effects, Buttons & Menus. Designer Templates, 250 Effects, plus Components & Video Controls

简体中文 繁體中文 Français Español Italiano 日本 Polski Deutsch SWiSHzone.com
SWiSHzone.com Banner
You are here: Home > Community > Tutorials
Community
FREE TOOLS!
Laboratory
Community Overview
Movies
Components
Effects
Screencast Tutorials
> Tutorials
Official Blog
Forums
Other Forums
Request help
Search Tutorials

 All words
 Any words

 Similar words
 Exact words

Number of Results:
Monthly Newsletter
Get our monthly newsletter for all the latest news
competitions, tutorials and tips > Sign Up Now

SWiSH Jukebox: Using javascript to avoid the 'Click to Activate' issue in Internet Explorer
Creator: David Petley
Website: http://www.swishzone.com
Submitted: Tue Sep 26 2006
Description: Changes to the way media is presented in Microsoft's Internet Explorer' web browser mean that viewers need to 'click to activate' the SWF. Here is a tutorial based on the method recommended by Adobe (creators of the Flash Player) to overcome this 'click to activate' requirement using javascript.
Zip File: Download


Program
Creator: Mike Chrysler
Website: http://www.swishzone.com/
Submitted: Wed Aug 30 2006
Description: Due to a recent change by Microsoft in the way media is presented in their Internet Explorer web browser, SWF content will require activation by users (before they can interact with it) when it is viewed in Internet Explorer 6+. Here is how to apply the method/solution offered by Adobe (makers of the Flash Player) to bypass the ‘click to activate’ controls in Internet Explorer via javascript.
Zip File: Download

 

Programs: SWiSHmax , Notepad or source code editor

Due to a recent change by Microsoft in the way media is presented in their Internet Explorer web browser, SWF content will require activation by users (before they can interact with it) when it is viewed in Internet Explorer 6+.

Here is how to apply the method/solution offered by Adobe (makers of the Flash Player) to bypass the ‘click to activate’ controls in Internet Explorer via javascript.

Using this method, Internet Explorer requires an external javascript file(s), and references to that file in the <head> and <body> tags of the HTML file in order to bypass the ‘click to activate’ controls.

NOTE: A javascript (.js) file is a flat file format like ‘.txt’, which does nothing more than contain javascript which can be referred to in the HTML file.

Links to external .js files can be placed within the <head> tags of your html document, and their functions can be called in the <body> of the document.
The external js file serves as ’decoder and writer'.
The javascript in the <head> serves as a linking mechanism to those files.
The javascript in the <body> serves as encoder and presenter.

The external .js portion.

A javascript file is included in the zip with this tutorial. The ac.js file does not require editing. All that is needed is to edit the html source code in the HTML page, and then upload the .js file, .html file and .swf file to your webspace.

Editing your html document

In Swishjukebox when publishing your player, ensure that the 'Generate HTML page' option is checked in the 'Publish' settings. You will need to make changes to the HTML file created in the publish process.

Browse to the folder you published to. In a WYSIWYG editor, you will need to edit it in source view to apply the changes required. You can also browse to, and R-click on, the HTML file to 'open with', this will allow you to choose Notepad as the editor for your HTML.

Current Default HTML Source View

<html>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="267" height="145">
  <param name="MOVIE" value="Player001.swf">
  <param name="QUALITY" value="HIGH">
     <embed src="Player001.swf"
      quality="high"
      type="application/x-shockwave-flash"
      width="267" height="145"
     >
</object>
</body>
</html>

You should note from the above code that there is no <head> tag in the default HTML, and we need to add one. In that <head> code, we need to add a reference to the external javascript - ac.js

We need to add the <head> tags, and some <head> content to the HTML published by Jukebox.

Copy the code in the table below, including the <head> and </head> tags, and then paste it into your Jukebox HTML file, between the first tag in the HTML code <html>, and the second tag in the code <body>.

<head>

<script src="ac.js" type="text/javascript"></script>

</head>

 

This is what your HTML from Jukebox should look like so far -

<html>
<head>

<script src="ac.js" type="text/javascript"></script>

</head>
<body>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="267" height="145">
  <param name="MOVIE" value="Player001.swf">
  <param name="QUALITY" value="HIGH">
     <embed src="Player001.swf"
      quality="high"
      type="application/x-shockwave-flash"
      width="267" height="145"
     >
</object>
</body>
</html>

 

Editing your object tags within the <body> code.

The current object tag looks like this -

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="267" height="145">
  <param name="MOVIE" value="Player001.swf">
  <param name="QUALITY" value="HIGH">
     <embed src="Player001.swf"
      quality="high"
      type="application/x-shockwave-flash"
      width="267" height="145"
     >
</object>

NOTE: It (the code for object/embed) contains specific data which web browsers use to display your swf. It specifies what player is needed, and what size that player should be, as well as where the SWF content to be played is located, and the parameters for play that you have set when you export.
The data is important, and as such will need to be preserved.

Using this javascript workaround, the method for storing the data changes from an <object>/<embed> tag to a javascript within the <body> tags of your document.

<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0',
'width','267','height','145','src','player001','quality','high',
'pluginspage','http://www.macromedia.com/go/getflashplayer',
'player001','player001' ); //end AC code </script>


You need to replace the values displayed (in red above) in the new script, with those found in your original object embed tags e.g. width, height, object id, object name.
You will also need to provide a <noscript> tag for browsers where javascript is disabled. The <noscript> tag contains the original object/embed information.

NOTE: When editing the values take special care to replace each instance where the movies name and dimensions are listed. In the code above you will see the movies file name and dimensions highlighted in red, and the script below shows where that data needs to appear.

We need to take the existing values from our object/embed tags and place them within the following framework. Note that <script> and <noscript> tags replace existing <object> tags in the HTML, although the old <object/embed> code is included within the new <noscript> tags for browsers without javascript enabled.

Your HTML document should appear like this when complete (view html source of the attached example to see it in action) -

<body>
<center>

<!-- This script tag calls the functions defined in the external JavaScript file to dynamically generate the tags that embed the Flash Movie1 in the page. -->

<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0',
'width','267','height','145','src','Player001'','quality','high',
'pluginspage','http://www.macromedia.com/go/getflashplayer',
'Player001',''Player001' ); //end AC code
</script>
   
<!-- Content inside a NOSCRIPT tag will be displayed if the user does not have Javascript enabled or is using a browser that does not support JavaScript -->

<noscript>

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="267" height="267">
   <param name="Movie1" value=""Player001.swf">
   <param name="quality" value="high">
   <embed src="Player001.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="267" height="145"></embed>
</object>

<p>Note: You do not have JavaScript enabled.</p>
</EM></noscript>
   
</center>
          
</body>
</HTML>

The zipped files provided in the download contain the ac.js javascript file, and a sample HTML page containing a player .swf from SWiSH Jukebox




Search | Privacy policy | Contact us | Site Map | Copyright SWiSHzone.com Pty Ltd 1999-2010