Flashobject Flash's detection and embedding JavaScript script _flash as

Source: Internet
Author: User
Its characteristics:
1, support all flash built-in parameter setting. And the setting is simpler and more convenient.
2, inline Flash Player upgrade detector, and prompted to upgrade.
3, completely through XHTML 1.0 Strict validation.
4, can solve the impact of IE upgrades to flash, support most browser version.

How to use:
1, first download the above Flashobject.js file, put it in your Web page directory.
2. Call JS file and add in <script type= "Text/javascript" src= "Flashobject.js" ></script>
3, set up the need to insert flash HTM code:
<div id= "Flashcontent" > here put the text you want to replace Flash. </div>
4, in the above code to add flash code:
<script type= "Text/javascript" >
var fo = new Flashobject ("movie.swf", "Mymovie", "M", "M", "7", "#336699");
Fo.write ("Flashcontent");
</script>

The basic parameter settings in the above Flashobject are: file address, ID, width, height, flash version, background color.
Optional parameters are:
Useexpressinstall: Quick upgrade Flash Player value is ture/false;
Quality: Playback quality, the default is "high";
Xiredirecturl: Specifies completion (Useexpressinstall) a directed URL after a quick upgrade of the player.
RedirectURL: Specifies that the Flash Player version is incorrectly directed to the URL.
Detectkey:flash the address parameter of the detected, default is Detectflash. such as: Do not detect flash, you can add to the back of the URL? detectflash=false.

Fo.write ("Flashcontent") is the Flash content written to id= "Flashcontent".

Flash parameter settings:

The general flash parameters are set to:
<param name= "Quality" value= "High" >
<param name= "wmode" value= "Transparent" >

And the Flashobject parameter is set to:
<script type= "Text/javascript" >
var fo = new Flashobject ("movie.swf", "Mymovie", "MB", "100%", "7", "#336699");
Fo.addparam ("Quality", "low");
Fo.addparam ("wmode", "Transparent");
Fo.addparam ("salign", "T");
Fo.write ("Flashcontent");
</script>

More parameters please refer to Macromedia's detailed introduction: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_12701

Flashvars Variable settings:

The general is to give the flash condition variable via flashvars:
<param name= "Flashvars" value= "Variable1=value1&variable2=value2&variable3=value3" >

And the variable after Flashobject is set to:
<script type= "Text/javascript" >
var fo = new Flashobject ("movie.swf", "Mymovie", "M", "M", "7", "#336699");
Fo.addvariable ("Variable1", "value1");
Fo.addvariable ("Variable2", "value2");
Fo.addvariable ("Variable3", "value3");
Fo.write ("Flashcontent");
</script>
After this setting, all the variables are immediately uploaded to the Flash _root.

In addition, Flashobject also provides a getqueryparamvalue () function to invoke the parameters of the URL string.
For example, URL: http://www.example.com/page.html?variable1=value1&variable2=value2
You can pass the above parameters to flash in the following ways.
<script type= "Text/javascript" >
var fo = new Flashobject ("movie.swf", "Mymovie", "M", "M", "7", "#336699");
Fo.addvariable ("Variable1", Getqueryparamvalue ("Variable1"));
Fo.addvariable ("Variable2", Getqueryparamvalue ("Variable2"));
Fo.write ("Flashcontent");
</script>

At the same time, Getqueryparamvalue () also supports reading variables from Location.hash. Example:
http://www.slideshowpro.net/demo/demo_default.php


Flash Player's Quick Install feature

Flashobject fully supports Flash Player's quick Install feature. By adding a section of as code in the first frame of flash, you can easily detect the user Flash Player version and prompt for updates. The expressinstall.as code is as follows:

#include "expressinstall.as"
var expressinstall = new Expressinstall ();
if (expressinstall.needsupdate) {

var upgrademsg = Attachmovie ("Upgrademsg_src", "upgrademsg", 1);
upgrademsg._x = STAGE.WIDTH/2;
upgrademsg._y = STAGE.HEIGHT/2;

UpgradeMsg.upgradeBtn.onRelease = function () {
Expressinstall.init ();
}
Stop ();
}

Note that the as above is placed on the first frame of the main timeline. And do not put any other content on this frame. Specific examples:
Http://blog.deconcept.com/flashobject/expressinstall.html
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.