PDA

View Full Version : Sizing and centering FlashComponent



expertmo
19 Nov 2010, 1:51 AM
Hi,
I have the following problem, and I'm not able to find a solution.
I have a viewport, with border layout, and a center region. In this center region I want to put a FlashComponent. And that's simple.

The problem is that I want this FlashComponent not to fill the entire center region: I want it to have an height that is 3/4 of the width (so I need to dimension the Flash initially depending on the container size, and then every time the user resize the browser in order to mantain the proportions).

More... I would like that the FlashComponent remains in a center position into the center region.
Is it possibile to achieve such a solution?

I've tried with differents layouts but with no results. My current solution is to use hbox and center align:




var my_flash = new Ext.FlashComponent({
hideMode : 'visibility',
border: false,
url: 'flash/ConceptualMap.swf?lang=1040',
controls:true,
start:true,
params: {
wmode : 'transparent'
}
});

var center_panel = new Ext.Panel({
autoScroll: false,
layout:'hbox',
region: 'center',
layoutConfig: {
padding:'5',
pack:'center',
align:'middle'
},
border: false,
items: [my_flash]
});


And using the resize event on center_panel I adjust the size of the my_flash component: it's correctly sized but it's completely off from center :-(

Thanks in advance.