Dynamic Flash

Confessions of a serial code abuser
  • rss
  • Home
  • MTASC
  • Archives
  • About me
  • Goodies
    • Base64 encoder/decoder class
  • My Bookshelf
  • My Talks

On X-UA-Compatible

Tuesday, 22 January 2008

I started to write a long post about why Microsoft’s proposal to fix web standards with a proprietary meta tag / header is both utterly futile and offensive to developers that care about web standards. Mike Davies, a fellow Yahoo! and one of the best guys you could hope to meet, has said everything I wanted to say - much more eloquently than I tend to be when ranting, I might add - in his End of line Internet Explorer article.

The biggest barrier to Microsoft adopting web standards is Microsoft’s own clients, or rather Microsoft’s promise to them of backwards compatibility. They have a plan to solve this, but it demands that web developers sacrifice the future compatibility of their sites.

Having spent most of the evening reading various blog posts on this debacle, it’s interesting to see how Microsoft have managed to divide the opinions of leading members the web standards community so fiercely. I wonder who might benefit from such a situation?

Read Mike’s article in full

Comments
2 Comments »
Categories
General, Web Standards, rant
Tags
internet explorer, microsoft, Web Standards
Comments rss Comments rss
Trackback Trackback

foundationas3.com has launched

Tuesday, 15 January 2008

foundationas3.comJust a little note to say that I’ve just launched the Foundation ActionScript 3.0 book companion site at foundationas3.com.

There’s precious little there at the moment except some illustration errata for Chapter 14: Flex by Example, but I hope to build this into a site full of great resources for readers and prospective readers of the book.

Comments
No Comments »
Categories
ActionScript, Books, Flash, Flex 2, Flex 3
Comments rss Comments rss
Trackback Trackback

FileReference.upload doesn’t support custom headers

Monday, 14 January 2008

At work we're working on an application that makes heavy use of the FileReference.upload() method to upload files to the server. We recently had a change request to add some custom HTTP headers to the upload request, which I didn't think would be a problem. I was wrong.

When using the FileReference.upload() method to upload a file to a server, you can specify additional variables to be sent along with that upload request by means of a URLRequest object like so:

PLAIN TEXT
Actionscript:
  1. // Create new request object and point it at the right URL
  2. var request:URLRequest = new URLRequest();
  3. request.url = "/upload.php";
  4.  
  5. // Specify additional variables to be sent with request as POST data
  6. request.method = URLRequestMethod.POST;
  7. request.data = new URLVariables();
  8. request.data.foo = "bar";
  9.  
  10. // Upload file using data from request object
  11. fileRef.upload(request);

Since you can send custom headers using the URLRequest object's requestHeaders property, I should have been able to specify custom headers for my file upload request fairly easily:

PLAIN TEXT
Actionscript:
  1. // Create new request object and point it at the right URL
  2. var request:URLRequest = new URLRequest();
  3. request.url = "/upload.php";
  4.  
  5. // Specify additional variables to be sent with request as POST data
  6. request.method = URLRequestMethod.POST;
  7. request.data = new URLVariables();
  8. request.data.foo = "bar";
  9.  
  10. // Specify additional headers to be sent with request
  11. var header:URLRequestHeader = new URLRequestHeader('X-Test-Header', 'Hello');
  12. request.requestHeaders.push(header);
  13.  
  14. // Upload file using data from request object
  15. fileRef.upload(request);

Sadly, the above code doesn't work. I checked the raw request and response using Charles and the custom X-Test-Header I was trying to send just wasn't coming through. I tried a number of different variations of the same code, all with the same result.

The problem, I have just discovered, is that there are a number of restrictions placed on the URLRequest object when used in conjunction with the FileReference methods. One of these restrictions is that the requestHeaders property is completely ignored when using the FileReference.upload() method, so it's impossible to send custom HTTP headers along with a file upload.

To be completely fair to Adobe, this and the other restrictions are stated quite clearly in the documentation for the URLRequest object:

The FileReference.upload() and FileReference.download() methods do not support the URLRequest.requestHeaders parameter.

Since I can't see any security or technical reason why the URLRequest object should be restricted in this way, I'm off to file a bug with Adobe to see if we can get this addressed in a future version of the Flash Player.

Lesson learned: RTFM.

Comments
3 Comments »
Categories
ActionScript, Flash, Flex 2, Flex 3
Tags
ActionScript, air, file upload, filereference, Flash, flex, urlrequest
Comments rss Comments rss
Trackback Trackback

Foundation ActionScript 3.0 now available

Sunday, 13 January 2008

Foundation ActionScript 3.0 with Flash CS3 and Flex

Somehow this slipped under my radar, but better late than never. Foundation ActionScript 3.0 for Flash CS3 and Flex, my big book-writing project from last year, is now available in all good bookshops.

Here's some of the blurb from Amazon.com:

Whether you are an aspiring ActionScript developer, or an experienced ActionScript developer who wants to upgrade your knowledge to version 3.0, this book teaches all you need to know to start to harness the power of ActionScript 3.0 using Flash CS3, Flex 2 or Flex 3. It covers all the essential techniques from the ground up, allowing you to get up and running quickly and easily.

The book is available to purchase right now at Amazon.com and Amazon.co.uk and all good bookshops.

Comments
6 Comments »
Categories
ActionScript, Books, Flash, Flex 2
Tags
ActionScript, actionscript 3.0, book, designer, Flash, flex
Comments rss Comments rss
Trackback Trackback

About Dynamic Flash

Steve Webster is a Senior Web Developer for Yahoo! in London, UK.

He is more than a little concerned that he defines himself in terms of his career, and that he talks about himself in the third person.

Find out more

Recent Posts

  • Yahoo! London seeks Junior Developers
  • I am Singularity
  • Yahoo! Astra component library 1.1 released
  • On X-UA-Compatible
  • foundationas3.com has launched

Tags

ActionScript actionscript 3.0 air book conference designer filereference file upload Flash flex internet internet explorer jobs junior microsoft opportunities singularity08 skin urlrequest web developer web development Web Standards Yahoo!

Stuff

Singularity?
Flex.org - The Directory for Flex
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox