Hi Everyone,
I have used this code which resizes the background with the width of the window and it centres the background image as well,
Code:
backgroundimg.scaleX=stage.stageWidth/1280;
backgroundimg.y=stage.stageHeight/2-backgroundimg.height/2;
backgroundimg.scaleY = backgroundimg.scaleX;
I am streaming a video, and used the same code to resize the video (to scale to the width of the stage and keep it in the centre)
Code:
video.scaleX=stage.stageWidth/1280;
video.y=stage.stageHeight/2-video.height/2;
video.scaleY = video.scaleX;
However the code is not working for the video, it makes the video smaller than the stage and it is positioned to the left of the stage, but in the middle (from the top).
The stage size is 1280 by 1024, and the video is also that size, but when the video streams, it comes up 320 by 240? not sure why this is happening.
Any ideas why the same resize code is not working for the streaming video?
The videos come up the correct size with this code:
Code:
video.width = item.width;
video.height = item.height;
video.x = (stage.stageWidth - video.width) / 2;
video.y = (stage.stageHeight - video.height) / 2;
But it doesn't resize correctly, when the stage is resized? it is not positioned to the centre of the stage.
Hope you can help.
Many thanks