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