4
votes

I'm having trouble getting the hang of resizing videos and the stage properly in AS3.

I have set up a netstream and I'm able to play a video, but whenever I set the height and width I want the embedded object to be on the page in swfobject, the video disappears.

I can still hear the audio, and I can tell the object is the right size, but no video. I have tried setting the stage.stageWidth/stageHeight properties but they don't see to take my assignment. Example:

stage.stageWidth = 400;
trace(stage.stageWidth); // equals 500 for some reason

The stage.stageWidth/Height properties also seem to have nothing to do with the area the flash object takes up in the browser (its the full screen). I have also tried setting stage.width/height and I get an error stating the Stage class doesn't implement these properties. I'm pretty perplexed.

1
stageWidth/stageHeight are effectively read only. If the scale mode is anything but NO_SCALE then even after scaling the size will report the original swf size. Show your code (where you play the video) and your swfobject code may be useful too.BadFeelingAboutThis
you use stage.fullScreenWidth to get monitor's full width. You can't set the width/height of the stage from within flash, the container needs to do that.BadFeelingAboutThis
setting stage.scaleMode = StageScaleMode.NO_SCALE, and then specifying the video object height and width seems to have fixed it. thanks for pointing me in the right direction with scale.Rob Allsopp
are you using event:NetStatusEvent of video stream? to get initial size of video?Mehdi Golzadeh
Can you post your code? Lots of things might be happening here, and without code it's hard to assess what's wrong.Gerrit Bertier

1 Answers

0
votes

You can't change the size of the stage from SWF e.g. by stage.stageWidth = 600; but you can tell containing HTML page to change width/height properties of embedded SWF then in your SWF you can respond to stage size change e.g.

stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.addEventListener(Event.RESIZE, onStageResized, false, 0, true);

and update layout from there.

If you resize the / elements in your HTML, that will resize the stage of the SWF.

The content of the SWF however will scale unless you specify that there will be no scaling within AS3:

stage.scaleMode = StageScaleMode.NO_SCALE;

It is also important to note when working with scalable SWFs that by default, the exported stage dimensions will always sit centred within the resized area.

I find it easier when everything is measured from the top-left of the resized area, which can be done by adding this as well:

stage.align = StageAlign.TOP_LEFT;