3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
8 * @class Ext.FlashComponent
9 * @extends Ext.BoxComponent
13 Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
15 * @cfg {String} flashVersion
16 * Indicates the version the flash content was published for. Defaults to <tt>'9.0.115'</tt>.
18 flashVersion : '9.0.115',
21 * @cfg {String} backgroundColor
22 * The background color of the chart. Defaults to <tt>'#ffffff'</tt>.
24 backgroundColor: '#ffffff',
28 * The wmode of the flash object. This can be used to control layering. Defaults to <tt>'opaque'</tt>.
33 * @cfg {Object} flashVars
34 * A set of key value pairs to be passed to the flash object as flash variables. Defaults to <tt>undefined</tt>.
39 * @cfg {Object} flashParams
40 * A set of key value pairs to be passed to the flash object as parameters. Possible parameters can be found here:
41 * http://kb2.adobe.com/cps/127/tn_12701.html Defaults to <tt>undefined</tt>.
43 flashParams: undefined,
47 * The URL of the chart to include. Defaults to <tt>undefined</tt>.
55 * @cfg {Boolean} expressInstall
56 * True to prompt the user to install flash if not installed. Note that this uses
57 * Ext.FlashComponent.EXPRESS_INSTALL_URL, which should be set to the local resource. Defaults to <tt>false</tt>.
59 expressInstall: false,
61 initComponent : function(){
62 Ext.FlashComponent.superclass.initComponent.call(this);
74 onRender : function(){
75 Ext.FlashComponent.superclass.onRender.apply(this, arguments);
77 var params = Ext.apply({
78 allowScriptAccess: 'always',
79 bgcolor: this.backgroundColor,
81 }, this.flashParams), vars = Ext.apply({
82 allowedDomain: document.location.hostname,
83 YUISwfId: this.getId(),
84 YUIBridgeCallback: 'Ext.FlashEventProxy.onEvent'
87 new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
88 this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params);
90 this.swf = Ext.getDom(this.id);
91 this.el = Ext.get(this.swf);
94 getSwfId : function(){
95 return this.swfId || (this.swfId = "extswf" + (++Ext.Component.AUTO_ID));
99 return this.id || (this.id = "extflashcmp" + (++Ext.Component.AUTO_ID));
102 onFlashEvent : function(e){
111 this.fireEvent(e.type.toLowerCase().replace(/event$/, ''), e);
114 initSwf : function(){
115 this.onSwfReady(!!this.isInitialized);
116 this.isInitialized = true;
117 this.fireEvent('initialize', this);
120 beforeDestroy: function(){
122 swfobject.removeSWF(this.swf.id);
124 Ext.FlashComponent.superclass.beforeDestroy.call(this);
127 onSwfReady : Ext.emptyFn
131 * Sets the url for installing flash if it doesn't exist. This should be set to a local resource.
135 Ext.FlashComponent.EXPRESS_INSTALL_URL = 'http:/' + '/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
137 Ext.reg('flash', Ext.FlashComponent);