Scale image in flash to fit the size defined in html
I have a flash movie that dynamically loads images from an xml file. I want to reuse this .swf file on different pages, however the images on page 1 are all 400 x 200 and the images on page 2 are all 745 x 422. When I try to reuse this on another page, the uploaded images shrink (resize ) - I'd like them to match the values ββdefined in the width / height, but they scale depending on how that scene is scaled.
im using a loader (AS3) for an image that puts them in a container (sprite)
slideLoader.load(new URLRequest(xmlSlideshow..image[intCurrentSlide].@src));
I tried to make the scene different sizes to start, but I would really like it to be unresponsive if possible, that is: 50 x 50. Then in html the width / height will be set to the width / height of the images loaded.
I am not a flash memory master, so please forgive me if I am not clear, I will try to give more understanding if necessary.
source to share
A couple of things ... first, you need to specify that your application is not scalable. (AS3 code)
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
Then, once your image is loaded (add a listener to the slideLoader object), execute the javascript function using the Flash ExternalInterface class.
ExternalInterface.call('resizeFlashMovie', slideLoader.width, slideLoader.height);
And your javascript function would be something like this:
function resizeFlashMovie(width, height) {
var flash = document.getElementById('yourFlashMovieId');
flash.style.width = width+'px';
flash.style.height = height+'px';
}
source to share
Sorry I don't have the code at hand, but I know you have the option to set without resizing on the canvas at startup.
Ideally, you can pass the height / width using the attributes of the embed tag, don't resize on the canvas, and use the dimensions passed in the dimensions of your images.
source to share