- JS to determine if flash loading is complete
(function() {varFlash =a Flash object on the Web page. varInterval = SetInterval (function () { Try{if(Flash. IsPlaying ()) {//one way to poll flashCallBack &&callback.call (Flash, args);//callback function Clearinterval (interval); } } Catch(ex) {}},1000);varCallBack =function() {alert (' loaded '); } })();
In the specific application, flash into the setinterval or settimeout function closure, may be due to JavaScript single-threaded problems, cause flash can not call Flash Player functions such as isplaying, or call the result of the wrong condition , there is a temporary workaround, we can read the Totalframes property of the flash in the polling function, we can think that Flash has been fully loaded into the page.
- JS to determine if flash play ends to the last frame
<script type= "Text/javascript" >functionGototestpage () {//get Flash obj, only work normally in IE varFlash = document["Shockwaveflash1"]; //get current page number varCurrentframe=Flash. Currentframe (); //is the total, if End if(currentframe==30 && $ (' #isOpen '). html () = = "0"){ $(' #isOpen '). HTML ("1")); Alert ("Please start the test."); //Popup The page with SharePoint Dialogue windowOpenpopuppage ("/en/hr/pages/isonlinetest.aspx",function() {window.location.href= "/en/hr/pages/informationsecuritytraining.aspx";},960,800); }}//go to the function each 5 secondsSetInterval (gototestpage,5000); </script>//Set Open popup page status<div id= "IsOpen" style= "Display:none" >0</div>
/* followed by a list of JS methods to control Flash Player */
Play ()----------------------------------------play animation
Stopplay ()------------------------------------stop animation
IsPlaying ()-----------------------------------whether the animation is playing
Gotoframe (frame_number)----------------jump to a frame
Totalframes ()-------------------------------Gets the total number of frames in the animation
Currentframe ()------------------------------The number of frames in which the current animation is located-1
Rewind ()-------------------------------------return the animation to the first frame
Setzoomrect (left,top,right,buttom)-------enlarge specified area
Zoom (percent)------------------------------change animation size
Pan (x_position,y_position,unit)------------pans The animation in the X, y direction
percentloaded ()----------------------------returns the percentage of animation loaded
Loadmovie (Level_number,path)-----------loading animations
Tgotoframe (movie_clip,frame_number)-Movie_clip jump to the specified number of frames
Tgotolabel (movie_clip,label_name)------Movie_clip jump to the specified label
Tcurrentframe (Movie_clip)---------------callback Movie_clip Current frame-1
Tcurrentlabel (Movie_clip)-----------------Callback movie_clip current tab
Tplay (Movie_clip)---------------------------play Movie_clip
Tstopplay (movie_clip)----------------------stop movie_clip Playback
GetVariable (variable_name)-----------------Get variables
SetVariable (variable_name,value)-----------variable assignment
Tcallframe (Movie_clip,frame_number)---Call action on the specified frame
Tcalllabel (Movie_clip,label)----------------call action on the specified label
Tgetproperty (Movie_clip,property)--------get the specified property of Movie_clip
Tsetproperty (Movie_clip,property,number)-sets the specified properties of the Movie_clip
JS to determine if flash play ends