3 * Copyright(c) 2006-2009 Ext JS, LLC
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.45'</tt>.
18 flashVersion : '9.0.45',
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>.
34 * The URL of the chart to include. Defaults to <tt>undefined</tt>.
42 * @cfg {Boolean} expressInstall
43 * True to prompt the user to install flash if not installed. Note that this uses
44 * Ext.FlashComponent.EXPRESS_INSTALL_URL, which should be set to the local resource. Defaults to <tt>false</tt>.
46 expressInstall: false,
48 initComponent : function(){
49 Ext.FlashComponent.superclass.initComponent.call(this);
51 this.addEvents('initialize');
54 onRender : function(){
55 Ext.FlashComponent.superclass.onRender.apply(this, arguments);
58 allowScriptAccess: 'always',
59 bgcolor: this.backgroundColor,
62 allowedDomain: document.location.hostname,
63 elementID: this.getId(),
64 eventHandler: 'Ext.FlashEventProxy.onEvent'
67 new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
68 this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params);
70 this.swf = Ext.getDom(this.id);
71 this.el = Ext.get(this.swf);
74 getSwfId : function(){
75 return this.swfId || (this.swfId = "extswf" + (++Ext.Component.AUTO_ID));
79 return this.id || (this.id = "extflashcmp" + (++Ext.Component.AUTO_ID));
82 onFlashEvent : function(e){
91 this.fireEvent(e.type.toLowerCase().replace(/event$/, ''), e);
95 this.onSwfReady(!!this.isInitialized);
96 this.isInitialized = true;
97 this.fireEvent('initialize', this);
100 beforeDestroy: function(){
102 swfobject.removeSWF(this.swf.id);
104 Ext.FlashComponent.superclass.beforeDestroy.call(this);
107 onSwfReady : Ext.emptyFn
111 * Sets the url for installing flash if it doesn't exist. This should be set to a local resource.
115 Ext.FlashComponent.EXPRESS_INSTALL_URL = 'http:/' + '/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
117 Ext.reg('flash', Ext.FlashComponent);