Recently I was playing around with scaling background images and had issues with how the scaling behaved and image quality. When scaling an image in proportion you want to make sure that the image container is centered to the movie clip it belongs to.
My example below is the scaling code within a stage listener which will re size the background image according to the stage width & height.
Stage.align = "TL";
Stage.scaleMode = "noScale";
//Get Background Image Container Movie Clip Name (instance)
var backgroundImage:movieClip = "MovieClip Instance Name"
// Create an object for the stage listener
stageListener:Object = new Object();
// Create a function for the event you want to listen for
stageListener.onResize = function() {
//Get the stage width & height
var sw:Number = Stage.width;
var sh:Number = Stage.height;
//Check to see if image width or height needs adjusting
if ((sh / sw) > (backgroundImage._height / backgroundImage._width)) {
//get image width and adjust height to fit
scale = backgroundImage._width / backgroundImage._height;
backgroundImage._height = sh;
backgroundImage._width = sh * scale;
} else {
//get image height and adjust width to fit
scale =backgroundImage._height / backgroundImage._width;
backgroundImage_width = sw;
backgroundImage._height = sw * scale;
}
//Center the background Image
backgroundImage._x = (sw - backgroundImage._width) / 2;
backgroundImage._y = (sh - backgroundImage._height) / 2;
};
// Add listener for the Stage object
Stage.addListener(stageListener);
Now the the simple line of code that makes this work so well is the quality preservation part. Just add this after your dynamic image has loaded.
backgroundImage.forceSmoothing = true;
An actionscript 3 version would not be much different to this and should be fairly easy to workout. If your struggling just let me know.
Buy great image scaling software after you learn the roulette slang and online roulette history you need to beat roulette at CasinoBonus.org!
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
What is dompdf? Well basically its a HTML to PDF converter. It's rendering engine is built in PHP and is style-driven which means it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements.
I won't go into detail of how to use it (unless you want me to or would like to write about it), but recently I had an issue with images not rendering in the pdf. At first I thought it was a permissions problem, then I thought it was an image type problem. It turns out it was a file location issue.
instead of the file location being:
<img src="images/myimage.jpg" style="width:200px;height:200px">
It should be:
<img src="/var/www/images/myimage.jpg" style="width:200px;height:200px">
So as you can see it needs to reference the file from the server side file directory and not just from within the web directory.
Wish someone wrote this, when I needed it....
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post
I'm sure most of us use swfObject, which in my opinion is the best option when it comes to embedding flash.
Lately I've been having a lot of fun with mootools and needed a way to embed flash dynamically. Basically I wanted my flash file to be embedded after a mootools click event was triggered.
So without further ado..
window.addEvent('domready', function() {
//get the div I want to embed my flash into.
var flashcontainer = $('flashcontainer');
//set all the flash properties
var file = 'file.swf';
var moviename = 'nameMyFlash';
var width = '640';
var height = '424';
var version = '9';
var bgcolor = '#000000';
//create the function that will fuse swfObject with mootools
var embedFlash = function(){
var so = new SWFObject(file, moviename, width, height, version, bgcolor);
so.addParam("quality", "high");
so.addParam("align", "middle");
so.addParam("play", "true");
so.addParam("loop", "true");
so.addParam("scale", "exactfit");
so.addParam("allowFullScreen", "true");
so.addVariable("variable1", "variable 1 value goes here");
so.addVariable("variable2", "variable 1 value goes here");
so.write(flashcontainer);
}
//get button by id
var myButton = $('mybutton');
// create click event to fire my function called "embedFlash()"
myButton.addEvent('click', embedFlash);
});
And that's it.. Hope it helps....
You can download the latest tools used above from the links below:
MooTools - download release 1.2.3 or SWFObject 2.2
Your slots payouts will be out of proportion from the progressive slots when you hit the slots bonus using the slots secrets of CasinoBonus.org!
Plurk This Post
Buzz This Post
Delicious
Digg This Post
Ping This Post
Reddit
Stumble This Post