Resizing an image to fit while maintaining aspect ratio

Here's how you resize an image (or any DisplayObject) to fit in a container while maintaining its aspect ratio. image.width=container.width; image.scaleY=image.scaleX; if(image.height>container.height){ image.height=container.height; image.scaleX=image.scaleY; }


Getting url of current page of browser

Here's how you get the current url of the page the swf is hosted in. import flash.external.ExternalInterface; var url:String=ExternalInterface.call("eval","document.location.href"); quick simple snippet


Sending Basic Email from Flash using PHP

Recently had to send an email from Flash. Here's the quickest/easiest way to do it (according to me). It uses a very basic PHP script to send the email.


Loading local file to Flash using FileReference

Been busy... so here's a quick post.
There are plenty of tutorials for uploading a file to a server. Here is one that lets you load a file(image) directly into Flash. Requires Flash Player 10.


BitmapFill and Tiles (and scrolling it infinitely)

You might know about the beginBitmapFill method of the Graphics class. It is perfect for creating tiles that repeat itself. And with matrixes, we can even make it scroll infinitely.


Looping Gallery

Some clever thinking and a small change to our cover flow code in the last post can make the gallery loop...


Storing data in Arrays, Objects, Dictionaries

Flash provides several "quick" ways of storing data. Here's how to use Arrays, Objects, and Dictionaries for the purpose.


Cover Flow

For some reason, people are crazy for a cover flow interface. It's actually not that complicated. Here is a quick run through.