PDA

View Full Version : [FIXED][3.0.0] Fix: Ext.FlashComponent pass parameters to swfobject



Ronaldo
29 Jul 2009, 1:07 PM
Hi all,

I love the Ext.FlashComponent already :) But I wanted to pass in extra parameters to the swf file, and since I discovered ext uses swfobject, I knew it was possible. So with the fix below in the Ext.FlashComponent's onRender method, I can use:


var movie = new Ext.FlashComponent({
url : '/movie.swf',
flashVars: {
myParameter: 'a value',
anotherOne: 2
}
});In Actionscript 3, now you can use:

root.loaderInfo.parameters.myParameter (='a value') and root.loaderInfo.parameters.anotherOne (=2)



onRender : function(){
Ext.FlashComponent.superclass.onRender.apply(this, arguments);

var params = {
allowScriptAccess: 'always',
bgcolor: this.backgroundColor,
wmode: this.wmode
}, vars = Ext.apply(this.flashVars||{},{
allowedDomain: document.location.hostname,
elementID: this.getId(),
eventHandler: 'Ext.FlashEventProxy.onEvent'
});

new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params);

...
},Best regards,
Ronaldo

evant
29 Jul 2009, 5:55 PM
Fixed in SVN.

mjlecomte
29 Jul 2009, 6:10 PM
I'm swf ignorant. There's no need to also do similar with the params also?

Ronaldo
30 Jul 2009, 12:19 AM
Hi,

I'm not sure if being able to change the params variable is valuable too. Heck, it might be usefull to be able to override all parameters. :-?

Search for 'swfobject.embedSWF' in the swfobject API docs (http://code.google.com/p/swfobject/wiki/api),
in my standalone swfobject usage, I used the flashvars parameter to pass information to the flash file, and that works.

Ronaldo