Monday, October 12, 2009

Flex fun never stops - Image loading and resizing

It doesn't seem that any particular aspect of what I'm working on is simple. Or easy.

The post I was pretty much about to recreate is summed up nicely by Alastair’s Axioms blog.

Here’s the brief load an external image into Flex, resize it to fit in a container (but don’t make it bigger than the original), center it in the container, and smooth the image to get rid of any aliasing. Sounds like a simple job, slap down a VBox, set vertical and horizontal alignment, add an Image component and set it’s width and height to 100%, grab some handy image smoothing code, you’re done no? No. There’s a issue with every one of those steps.

Thursday, October 01, 2009

Web Services - Basic Authentication in Flex

I need to expand on this - but critically when using webservices and basic authentication in Flex, go to the import WSDL option in the File menu. From there you can set your authentication credentials as follows:


var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(_username + ":" + _password);
var encodedCredentials:String = encoder.flush ();

if (message.httpHeaders == null)
message.httpHeaders = {};
message.httpHeaders["Authorization"] = "Basic " + encodedCredentials;


More here on the Flex Live site.