Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / docs / source / FlashComponent.html
1 <html>\r
2 <head>\r
3   <title>The source code</title>\r
4     <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
5     <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
6 </head>\r
7 <body  onload="prettyPrint();">\r
8     <pre class="prettyprint lang-js"><div id="cls-Ext.FlashComponent"></div>/**
9  * @class Ext.FlashComponent
10  * @extends Ext.BoxComponent
11  * @constructor
12  * @xtype flash
13  */
14 Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
15     <div id="cfg-Ext.FlashComponent-flashVersion"></div>/**
16      * @cfg {String} flashVersion
17      * Indicates the version the flash content was published for. Defaults to <tt>'9.0.45'</tt>.
18      */
19     flashVersion : '9.0.45',
20
21     <div id="cfg-Ext.FlashComponent-backgroundColor"></div>/**
22      * @cfg {String} backgroundColor
23      * The background color of the chart. Defaults to <tt>'#ffffff'</tt>.
24      */
25     backgroundColor: '#ffffff',
26
27     <div id="cfg-Ext.FlashComponent-wmode"></div>/**
28      * @cfg {String} wmode
29      * The wmode of the flash object. This can be used to control layering. Defaults to <tt>'opaque'</tt>.
30      */
31     wmode: 'opaque',
32
33     <div id="cfg-Ext.FlashComponent-url"></div>/**
34      * @cfg {String} url
35      * The URL of the chart to include. Defaults to <tt>undefined</tt>.
36      */
37     url: undefined,
38     swfId : undefined,
39     swfWidth: '100%',
40     swfHeight: '100%',
41
42     <div id="cfg-Ext.FlashComponent-expressInstall"></div>/**
43      * @cfg {Boolean} expressInstall
44      * True to prompt the user to install flash if not installed. Note that this uses
45      * Ext.FlashComponent.EXPRESS_INSTALL_URL, which should be set to the local resource. Defaults to <tt>false</tt>.
46      */
47     expressInstall: false,
48
49     initComponent : function(){
50         Ext.FlashComponent.superclass.initComponent.call(this);
51
52         this.addEvents('initialize');
53     },
54
55     onRender : function(){
56         Ext.FlashComponent.superclass.onRender.apply(this, arguments);
57
58         var params = {
59             allowScriptAccess: 'always',
60             bgcolor: this.backgroundColor,
61             wmode: this.wmode
62         }, vars = {
63             allowedDomain: document.location.hostname,
64             elementID: this.getId(),
65             eventHandler: 'Ext.FlashEventProxy.onEvent'
66         };
67
68         new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
69             this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params);
70
71         this.swf = Ext.getDom(this.id);
72         this.el = Ext.get(this.swf);
73     },
74
75     getSwfId : function(){
76         return this.swfId || (this.swfId = "extswf" + (++Ext.Component.AUTO_ID));
77     },
78
79     getId : function(){
80         return this.id || (this.id = "extflashcmp" + (++Ext.Component.AUTO_ID));
81     },
82
83     onFlashEvent : function(e){
84         switch(e.type){
85             case "swfReady":
86                 this.initSwf();
87                 return;
88             case "log":
89                 return;
90         }
91         e.component = this;
92         this.fireEvent(e.type.toLowerCase().replace(/event$/, ''), e);
93     },
94
95     initSwf : function(){
96         this.onSwfReady(!!this.isInitialized);
97         this.isInitialized = true;
98         this.fireEvent('initialize', this);
99     },
100
101     beforeDestroy: function(){
102         if(this.rendered){
103             swfobject.removeSWF(this.swf.id);
104         }
105         Ext.FlashComponent.superclass.beforeDestroy.call(this);
106     },
107
108     onSwfReady : Ext.emptyFn
109 });
110
111 <div id="prop-Ext.FlashComponent-EXPRESS_INSTALL_URL"></div>/**
112  * Sets the url for installing flash if it doesn't exist. This should be set to a local resource.
113  * @static
114  * @type String
115  */
116 Ext.FlashComponent.EXPRESS_INSTALL_URL = 'http:/' + '/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
117
118 Ext.reg('flash', Ext.FlashComponent);</pre>    \r
119 </body>\r
120 </html>