]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui3/build/swf/swf.js
Release 6.2.2
[Github/sugarcrm.git] / include / javascript / yui3 / build / swf / swf.js
1 /*
2  Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3  Code licensed under the BSD License:
4  http://developer.yahoo.com/yui/license.html
5  version: 3.3.0
6  build: 3167
7  */
8 YUI.add('swf',function(Y){var Event=Y.Event,SWFDetect=Y.SWFDetect,Lang=Y.Lang,uA=Y.UA,Node=Y.Node,FLASH_CID="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",FLASH_TYPE="application/x-shockwave-flash",FLASH_VER="10.0.22",EXPRESS_INSTALL_URL="http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+Math.random(),EVENT_HANDLER="SWF.eventHandler",possibleAttributes={align:"",allowFullScreen:"",allowNetworking:"",allowScriptAccess:"",base:"",bgcolor:"",menu:"",name:"",quality:"",salign:"",scale:"",tabindex:"",wmode:""};function SWF(p_oElement,swfURL,p_oAttributes){this._id=Y.guid("yuiswf");var _id=this._id;var oElement=Node.one(p_oElement);var flashVersion=p_oAttributes["version"]||FLASH_VER;var flashVersionSplit=(flashVersion+'').split(".");var isFlashVersionRight=SWFDetect.isFlashVersionAtLeast(parseInt(flashVersionSplit[0]),parseInt(flashVersionSplit[1]),parseInt(flashVersionSplit[2]));var canExpressInstall=(SWFDetect.isFlashVersionAtLeast(8,0,0));var shouldExpressInstall=canExpressInstall&&!isFlashVersionRight&&p_oAttributes["useExpressInstall"];var flashURL=(shouldExpressInstall)?EXPRESS_INSTALL_URL:swfURL;var objstring='<object ';var w,h;var flashvarstring="yId="+Y.id+"&YUISwfId="+_id+"&YUIBridgeCallback="+EVENT_HANDLER+"&allowedDomain="+document.location.hostname;Y.SWF._instances[_id]=this;if(oElement&&(isFlashVersionRight||shouldExpressInstall)&&flashURL){objstring+='id="'+_id+'" ';if(uA.ie){objstring+='classid="'+FLASH_CID+'" ';}
9 else{objstring+='type="'+FLASH_TYPE+'" data="'+flashURL+'" ';}
10 w="100%";h="100%";objstring+='width="'+w+'" height="'+h+'">';if(uA.ie){objstring+='<param name="movie" value="'+flashURL+'"/>';}
11 for(var attribute in p_oAttributes.fixedAttributes){if(possibleAttributes.hasOwnProperty(attribute)){objstring+='<param name="'+attribute+'" value="'+p_oAttributes.fixedAttributes[attribute]+'"/>';}}
12 for(var flashvar in p_oAttributes.flashVars){var fvar=p_oAttributes.flashVars[flashvar];if(Lang.isString(fvar)){flashvarstring+="&"+flashvar+"="+encodeURIComponent(fvar);}}
13 if(flashvarstring){objstring+='<param name="flashVars" value="'+flashvarstring+'"/>';}
14 objstring+="</object>";oElement.setContent(objstring);this._swf=Node.one("#"+_id);}
15 else{var event={};event.type="wrongflashversion";this.publish("wrongflashversion",{fireOnce:true});this.fire("wrongflashversion",event);}};SWF._instances=SWF._instances||{};SWF.eventHandler=function(swfid,event){SWF._instances[swfid]._eventHandler(event);};SWF.prototype={_eventHandler:function(event)
16 {if(event.type==="swfReady")
17 {this.publish("swfReady",{fireOnce:true});this.fire("swfReady",event);}
18 else if(event.type==="log")
19 {}
20 else
21 {this.fire(event.type,event);}},callSWF:function(func,args)
22 {if(!args){args=[];};if(this._swf._node[func]){return(this._swf._node[func].apply(this._swf._node,args));}else{return null;}},toString:function()
23 {return"SWF "+this._id;}};Y.augment(SWF,Y.EventTarget);Y.SWF=SWF;},'3.3.0');