3/29/2014

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; }

10/25/2012

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

5/25/2012

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.

9/03/2011

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.

6/20/2011

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.

6/19/2011

Looping Gallery

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

6/09/2011

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.

5/29/2011

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.