Skip to main content
Inspiring
August 24, 2011
Answered

Media size using OSMF

  • August 24, 2011
  • 1 reply
  • 635 views

Hi,

I am playing around with the OSMF plug in and I am trying to set the size of the SWF to the size of the media in the MediaPlayerSprite. I can set the media to the size of the SWF but I want the other way round, the SWF to the size of the media. I have two questions:

1.     Is it possible to load a media (FLV, jpg etc) and then set the size of the SWF

2.     How do you get the size of the media e.g. trace( mediaWidth); trace(mediaHeight);

my code:

var sprite:MediaPlayerSprite = new MediaPlayerSprite();
            addChild(sprite);
            sprite.width=stage.stageWidth;
            sprite.height=stage.stageHeight;
            sprite.x=0;
            sprite.y=0;
            sprite.scaleMode=ScaleMode.STRETCH;

               sprite.resource = new URLResource("5.jpg");
            trace(sprite.stage.stageWidth);
            trace(sprite.stage.stageHeight);

This topic has been closed for replies.
Correct answer Kenneth Kawamoto

You cannot set the size of the SWF with AS. If you want to change the size at runtime you have to ask the container of the SWF to change the size, i.e. in case of web page you need to call JavaScript to change the size of the Flash object in the HTML.

1 reply

Kenneth Kawamoto
Community Expert
Kenneth KawamotoCommunity ExpertCorrect answer
Community Expert
August 24, 2011

You cannot set the size of the SWF with AS. If you want to change the size at runtime you have to ask the container of the SWF to change the size, i.e. in case of web page you need to call JavaScript to change the size of the Flash object in the HTML.

TezS56Author
Inspiring
August 25, 2011

Yes that is what I thought. thanks again.