PDA

View Full Version : Ext.FlashComponent - Parameters?



casbar
4 Aug 2009, 8:30 AM
Hello,
I have a FlashComponent object, but my swf file needs more parameters, in this case the mp3 file path which has to been opened!

How its possible to do it?

THANK YOU!!
casbar

casbar
5 Aug 2009, 3:54 AM
nobody any idea?

casbar
5 Aug 2009, 5:01 AM
Before the FlashComponent I done it in this way, but with the FlashComponent it would be much more easier, if I could send the component a parameter (the red one):


var htmlCode = '<object data="./apps/WebPlayer/swf/webplayer.swf" type="application/x-shockwave-flash" width="240" height="64" style="z-index:0;">';
htmlCode += '<param name="movie" value="./apps/WebPlayer/swf/webplayer.swf">';
htmlCode += '<param name="menu" value="false">';
htmlCode += '<param name="scale" value="noscale">';
htmlCode += '<param name="bgcolor" value="#FFFFFF">';
htmlCode += '<param name="wmode" value="transparent" />';
htmlCode += '<param name="flashvars" value="src='+file+'&amp;autostart=yes&amp;loop=yes">';
htmlCode += '</object>';


var wp_Panel = new Ext.Panel({
collapsible:true,
html: htmlCode
});



There isn't any way to do it?

thank you,
casbar

casbar
6 Aug 2009, 2:19 AM
I also tried this:



this.movie = new Ext.FlashComponent({
// its important to set the FlashComponents hideMode to offsets
hideMode : 'offsets',
url : './apps/WebPlayer/swf/webplayer.swf',
expressInstall: true,
flashVars: {
src: this.file,
autostart: 'yes',
loop: 'yes'
}
});


...but it dont works :(

I NEED HEEEEELP! :((

Animal
6 Aug 2009, 2:22 AM
When you say "dont works" What does the resulting DOM actually look like?

Animal
6 Aug 2009, 2:28 AM
Because when I execute



Ext.getBody().update('');
new Ext.FlashComponent({
renderTo: document.body,
height: 400,
width: 400,
// its important to set the FlashComponents hideMode to offsets
hideMode : 'offsets',
url : './apps/WebPlayer/swf/webplayer.swf',
expressInstall: true,
flashVars: {
src: "some_file",
autostart: 'yes',
loop: 'yes'
}
});


in a test page I end up with



<object width="100%" height="100%" type="application/x-shockwave-flash" data="./apps/WebPlayer/swf/webplayer.swf" id="extflashcmp1470" style="visibility: visible; width: 400px; height: 400px;">
<param name="allowScriptAccess" value="always"/>
<param name="bgcolor" value="#ffffff"/>
<param name="wmode" value="opaque"/>
<param name="flashvars" value="allowedDomain=&elementID=extflashcmp1470&eventHandler=Ext.FlashEventProxy.onEvent"/>
</object>


Which looks rightwrong.

casbar
6 Aug 2009, 2:28 AM
the whole element is oke.... i can see the flash file but it dont gets any parameter! I recognized it because the player dont start playing my music file!

the path to the file is ok because with the panel containing the ugly hardcoded html it works!!

i dont know why!

casbar

casbar
6 Aug 2009, 2:35 AM
Because when I execute



Ext.getBody().update('');
new Ext.FlashComponent({
renderTo: document.body,
height: 400,
width: 400,
// its important to set the FlashComponents hideMode to offsets
hideMode : 'offsets',
url : './apps/WebPlayer/swf/webplayer.swf',
expressInstall: true,
flashVars: {
src: "some_file",
autostart: 'yes',
loop: 'yes'
}
});
in a test page I end up with



<object width="100%" height="100%" type="application/x-shockwave-flash" data="./apps/WebPlayer/swf/webplayer.swf" id="extflashcmp1470" style="visibility: visible; width: 400px; height: 400px;">
<param name="allowScriptAccess" value="always"/>
<param name="bgcolor" value="#ffffff"/>
<param name="wmode" value="opaque"/>
<param name="flashvars" value="allowedDomain=&elementID=extflashcmp1470&eventHandler=Ext.FlashEventProxy.onEvent"/>
</object>
Which looks rightwrong.


Thats the problem! in the "<param name="flashvars"" row you cant see anywhere the parameters ie the src 'some_file'!
What i do wrong?

Animal
6 Aug 2009, 2:35 AM
Looks like a recent fix has gone into SVN. My ext-all-debug.js has some code which fixes it

try



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

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

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

this.swf = Ext.getDom(this.id);
this.el = Ext.get(this.swf);
}
});

casbar
6 Aug 2009, 2:41 AM
JUHU!! It works !! \:D/ Thanks a lot!!