Loader vs URLLoader

October 30th, 2009

Today I tried to load an image, and I failed.  I failed because I was trying to use the URLLoader class.  As I discovered this won’t work, because although it will perform a load and happily dispatch a complete event, it doesn’t have the facility to display anything.

What you need for displaying is the Loader class, or more specifically it’s content property, which is a DisplayObject.  Like so:


//create new Loader object
var myLoader = new Loader();
//set up a listener
myLoader.contentLoaderInfo.addEventListener(
Event.COMPLETE,loadComplete);
//trigger the load
myLoader.load(new URLRequest("my_image.gif"));
//
function loadComplete(evt:Event):void {
//clean up the listener
evt.target.contentLoaderInfo.removeEventListener(
Event.COMPLETE,loadComplete);
//add the image to the display
addChild(evt.target.content);
}

So basically the difference is this: Loader for display objects, URLLoader for data connections.

Auto-Save for Flash

September 30th, 2009

My CS4 just crashed.  Again.  Although I try to be good about saving, sometimes I get focused on what I’m doing, and it’s always at these times when Flash decides that clicking that last frame was in some way offensive.  Much swearing ensues and a short break is taken, then I begin that complex string of animations again.

This time though I thought to employ google, and turned up a neat little extension on flashguru: Flash Auto-Save.

Pay no attention to the comment about it not working on CS4, I’ve installed it and it works fine.  The only thing to be aware of is that it needs to be visible at all times, and hiding it in a panel group will stop it working.

I hope this saves more people a bit of fury :)

Find SWF dimensions with PHP

July 14th, 2009

Wow, so it’s been a long time since I posted here.  It’s quite alarming to think how much has happened since March 2008!  Hopefully I’ll start posting here more often again, more as a written record of things I’ve found useful that will benefit me.  With that in mind,  here’s something that came up today.  It’s a very simple thing, but I’m going to find it very useful in developing the banner section of Biff’s portfolio site.

It is possible to find the dimensions of a SWF using PHP’s  getimagesize() function.  Here’s an example:


print_r(getimagesize('example.swf'));

// Outputs:
//
// Array ( [0] => 400 [1] => 300 [2] => 13 [3] => width=”400″ height=”300″ [mime] => application/x-shockwave-flash )

Back to basics

March 16th, 2008

Have you ever considering how bewildering the world would seem to a baby, with so much unexplained? That’s how I feel right now.

Having finally got round to trying something, anything, on my Red Hat box, I decided that I should install Python. As if learning one new thing isn’t hard enough, I wanted to learn by doing something else I had no idea how to do. Great idea. I had forgotten that there was once a day that I didn’t know DOS commands until the LINUX terminal was in front of me and I had to navigate to a folder, now I know how my parents feel.

Free 5GB web space

March 13th, 2008

Continuing their ‘if you can’t beat them, shamelessly copy them’ policy, Microsoft have released SkyDrive, a free to use 5GB web based storage facility. It’s actually not bad, which won’t surprise you if you get on as well with the newer version of Hotmail as I do.

So what does it do? Well, it allows you to upload data in 50MB chunks (so sharing larger files is awkward). Your data can be stored in a variety of folder types: personal, shared and public. I’m sure those names are fairly self explanatory, but I’m going to drone on about them anyway.

Read the rest of this entry »

FireShot Firefox Extension

March 12th, 2008

Looking through Firefox extensions always causes me to install something, and often not what I was originally looking for. That was the case with FireShot, a nifty little tool that captures your current browser viewport, or the entire page, and lets you perform various actions with the resulting image.

You can just save your grab as a jpg, png, bmp or compressed file, but before you do that you might want to edit it, adding text and graphics. Alternatively you can copy it, upload it, mail it or open it in a pre-selected editor of your choice.

The built in editor seems pretty well featured at a glance, the only obvious omission being an option to resize. I can see this getting a lot of use.

It’s late…

March 12th, 2008

…but victory is mine.  The ugly top bar is no more, and my portfolio is successfully integrated into the pages list on the right.

I sleep now, the rest of the design can wait.

I’ve been published!

March 11th, 2008

Well, kinda.

Last weekend I wrote a tutorial on an AS2 sliding tile puzzle game I wrote a little while ago. It was my first attempt at writing coherent instructions for others to follow, so I was very pleased when it was accepted by the wonderful folks at </dream.in.code>. Thanks to Chris et al!

For anyone who isn’t familiar, DIC is a large community of programmers and web developers who are very helpful and knowledgeable on a huge range of technologies.

Here’s the direct link to the tutorial: http://www.dreamincode.net/forums/showtopic45655.htm

Enjoy!

CSS3 Compatibility

March 11th, 2008

Following on from the last post, but worthy of it’s own, Daniel Glazman has created a test of CSS3 selector support. Top marks to the latest build of Opera for passing every test!

You can read Daniel Glazman’s blog here.

CSS3 Selectors

March 10th, 2008

While trying to answer a question on a forum today I found myself browsing the range of selectors available for CSS3. I’m late to the CSS3 party, having being bogged down in projects and due to my majority of my work audience using IE, but I like what I have found and feel good about the future.
Read the rest of this entry »