0
votes

I have load flash swf file to my flex project.
I have used SWFLoader for that to load the swf file.

var loader:SWFLoader = new SWFLoader();
loader.load("player/VideoPlayer.swf");
loader.width = 320;
loader.height = 280;
parentContainer.addElement(loader);

In which parentContainer is <s:BorderContainer. It's width 320 and height 280.

I have also tried to set like following, but didn't got succeeded:

function onComplete(event:Event):void
{
    loader.width = 320;
    loader.height = 280;
}

Problem: But when i run it swf file load to full width and height.
How can i set it's width and height to it's parent container?

I have also tried like:

<s:BorderContainer id="parentContainer" width="320" height="280">

    <s:SWFLoader width="320" height="280" scaleContent="false" autoLoad="true"
                         source="@Embed(source='player/VideoPlayer.swf')"  />
</s:BorderContainer>

But still it take 100% size of application. Application size is 600 X 500.

Edit:

swfloader cover whole application and all other flex component hide beside the swfloader

1

1 Answers

0
votes

From the documentation:

scaleContent A flag that indicates whether to scale the content to fit the size of the control or resize the control to the content's size. If true, the content scales to fit the SWFLoader control. If false, the SWFLoader scales to fit the content.

I do not know why do not work because the default value for scaleContent is true, try to set the property:

<s:BorderContainer id="parentContainer" width="320" height="280">

    <s:SWFLoader width="320" height="280" scaleContent="true" autoLoad="true"
                     source="@Embed(source='player/VideoPlayer.swf')"  />
</s:BorderContainer>

Or:

var loader:SWFLoader = new SWFLoader();
loader.load("player/VideoPlayer.swf");
loader.width = 320;
loader.height = 280;
loader.scaleContent = true;
parentContainer.addElement(loader);