How to create a dynamically resizable flash player

Morning drives! So my question today is not about any code, but about how to do it right from the very beginning. I have a video player created for a static size (max. 800x600), which I will have to transcode every time I need it to have a different size.

What I need to do in the near future is to dynamically resize itself and all the elements inside it based on a variable width of 1, which it will receive from HTML or XML.

Now for me there are 2 ways to do this:

  • Start with the smallest possible size and resize to the larger side, but I'm not sure how the Flash movie will actually expand upwards, as it is now
  • Or 2, start with the largest possible size (in this case 800x600) and reduce everything.

Step 1, I think, seems to be the best way to do this (in the style of YouTube), but Step 2 also seems that it could be easier? My friend said that I have to go with a large size and have the dimensions of the elements in each class, and then fix in the upper left corner. However, for the player to fit into certain div columns on sites, blogs, wherever he says, there should be HTML / CSS side ... this means that the div containing the resized flash player will have to cover areas from the Flash movie, which should not be shown? Can I put an 800x600 flash movie into a divider with a width of less than 800 pixels? And cover it with another thing?

In any case, my mission is to have a player with dynamic sizes like this:

alt text
(: flickr.com)

? ? , ?

+3
2

. , , - , . flash , :

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align =  StageAlign.TOP_LEFT;

, , swf. , . , , .

+3

greg-, "resize" . stage.stageWidth stage.stageHeight swf, . :

public function Main() {
    addEventListener(Event.ADDED_TO_STAGE, addedToStage);
}

function addedToStage(e:Event) {
    // clean up our listeners
    removeEventListener(Event.ADDED_TO_STAGE, addedToStage);

    stage.scaleMode = StageScaleMode.NO_SCALE;
    stage.align =  StageAlign.TOP_LEFT;
    stage.addEventListener(Event.RESIZE, resize);

    // force a resize event
    dispatchEvent(new Event(Event.RESIZE));
}

function resize(e:Event) {
    var W:uint = stage.stageWidth;
    var H:uint = stage.stageHeight;
    mysprite1.x = W - mysprite.width;
    mysprite2.height = H;
    //etc...
}
+3

Source: https://habr.com/ru/post/1722343/


All Articles