Archive for the ‘flash’ Category

No custom headers for FileReference.upload. Why?

19 March 2008 | filed under actionscript, air, flash | 10 comments »

ActionScript iconI got excited when I learned that YouTube opened their API for third party developers. This would enable me to - for example - create a nifty AIR widget to quickly upload videos to my YouTube account. Drag-and-drop a video file onto the AIR app and have the uploading done in the background. Cool!

So I took off, did the authentication stuff with the ClientLogin API so I was able to login into my YouTube account with Flash.

Next: add uploading functionality. Again, the docs are clear and I’m halfway done when I re-read the URLRequest.requestHeaders documentation, only to find out that custom headers (required for the YouTube upload to succeed) are not supported by FileReference.upload!

So much for my YouTube upload AIR widget…

Adobe, PLEASE consider removing this restriction from a future Flash player. Or please tell me why this restriction is imposed on the upload method, as I fail to see why we shouldn’t be allowed to create our own POST request headers for the upload method.

Adobe MAX 2007

20 October 2007 | filed under community, design, flash, flex, software | 4 comments »

MAX 2007

This week I attended to the first ever Adobe MAX in Europe. It was held in beautiful Barcelona, which is a reason on its won to visit MAX of course. I was joined by two of my co-workers at Lost Boys, we had a great time attenting to the various sessions. The two things that are still on top of my mind now that I’m back in The Netherlands, are AIR and Thermo.

AIR packageRegarding AIR, I have to say I underestimated the technology upon hearing about it for the first time. When it was first announced, I got some rather unpleasant Macromedia Central flashbacks, but after seeing the various demos and playing around with it for myself, I’m convinced that AIR may have a bright future ahead. Sure, the runtime still measures 10 megabytes at the moment, but Adobe has been smart about the way that install can be triggered; through the (browser embedded) Flash Player (from version 6.0.65 and up). Also, the ability to drag files/links/data/etc to and from(!) an AIR application has great potential. Especially the mixing of desktop applications and online services and websites offers some very interesting perspectives. You can download the beta version AIR from the Adobe Labs site.

Thermo iconThe other application that really stood out goes by the codename of Thermo. Thermo allows designers to quickly trow together a clickable demo of their artwork. After importing for example a Photoshop file, it is relatively easy to convert parts of the design into functional components that actually respond to user input. What’s more, an application or demo created in Thermo can be loaded into Flex Builder, as Thermo generates Flex code. Then, a developer can further improve upon the elements the designer already put together. This may allow for a much smoother workflow, although Thermo has often been perceived as a demo-creation app, not as a collaboration tool. Adobe though targets Thermo as an app that would actually allow the designer to create an initial setup of an application, which is then finished by a developer. I’m not sure if this is really going to happen, but Thermo is most definitely a very interesting technology to watch closely. More about Thermo on Adobe Labs.

Apart from these two highlights, MAX 2007 has been great. As always, Natzke’s presentation was fabulously inspiring and I also very much enjoyed the sneak previews on some of the new technologies like seam carving that Adobe is working on. If you didn’t make it this year, make sure to attend next time there’s a MAX event near you!

mProjector WindowResizer class

20 September 2007 | filed under flash | 1 comment »

ActionScript iconAs I mentioned earlier, I’m working on a new version of FLV Player. This new version will be created with mProjector, the Screentime tool to create standalone executables with. While working on this project, I found out that there is no built-in functionality in mProjector to drag-resize a window (like mWindow.startDrag, which allows you to move windows around).

So, I created a wrapper class which may be of use for other people working on mProjector projects: WindowResizer. The class resizes an mProjector window, supports min/max dimensions of the window and dispatches 3 events; at resize start, update and end.

I also created a class to turn any clip into a window dragger (moves the window, doesn’t do resizing). Handy when you want the entire background of your window to act as a window dragger. This class is included in the download below:

Please note that I’m using some classes from the ASAP Framework in the WindowResizer class. You’ll need to download the ASAP Framework in order to be able to use the WindowResizer class.

Looking for FLV Player bèta testers

30 July 2007 | filed under flash, software, video | 52 comments »

I am looking for people who’d like to bèta test a new version of FLV Player.

This new version has full screen mode (finally!), metadata inspection, a brand new look and all logic has been completely rewritten. Mostly because of that last fact, rewritten code, I would very much like to have some users testdrive this new version before it gets released.

If you’d like to give the new version a try, please leave your name and email address in the comments below you’ll have to be a bit patient and wait for round two, commenting is now closed… Once I think FLV Player is stable enough for bèta testing, I will let you know.

But, first things first, I’m going on vacation tomorrow! I’ll be enjoying sunny Bali for two weeks. Once I return, I’ll make a list of people who’d like to take part in bèta testing. I’ll be back - all tanned and relaxed - in two weeks.

Cheers!

Commenting now closed, I want to keep the initial testing team small. Thanks for all the enthusiastic reactions!

ImageLoader class for Flash 8

17 August 2006 | filed under flash | 3 comments »

ActionScript iconThis piece of code has been lying around for some time. I wrote it due to the fact that Flash 8 doesn’t smooth dynamically loaded images by default. This means that scaling and rotating any dynamically loaded image will make it look “jagged”.

The first (for as far as I know) to write Flash code to circumvent this issue was Master Tinic Uro himself; he is one of the engineers at Adobe working on the Flash Player. He wrote a handy function to load an image dynamically and then smooth it using a neat BitmapData / MovieClip trick

I wrapped his idea and some extras (events from MovieClipLoader class are relayed and the PNG transpareny solution is also included) in a single class I dubbed ImageLoader (duh).

Usage is as follows:

Actionscript:
  1. var loader:ImageLoader = new ImageLoader();
  2. loader.addListener(this);
  3. loader.loadImage( “some_image.jpg”, some_mc );

In the sample above, the ‘this’ context will receive all events normally fired by the MovieClipLoader class while loading an image.

ImageLoader smoothing

Using HTTP Authorization headers with Flash

9 May 2006 | filed under flash | 4 comments »

Today, I needed a way to load XML data from a password protected source (user: testuser, pass: testpass), preferably without a login popup. So I have been poking around in the HTTP header specs and found a solution by using the Authorization field.

In essence it is - like most things - quite simple. I guess this has been done a thousand times before, but the Flash related sources on this topic were very sparse.

When accessing a password protected source on a server, that server will challenge the client with a so-called WWW-Authenticate field in the response header. The client then has to answer that challenge correctly and access is granted.

The W3C has written a lengthy document on this, describing the details of the authorization system. What I needed though, was a way to prevent the WWW-Authenticate request from happening and access the data immediately. This can be done by adding an Authorization field to the HTTP header when making the initial request.

Luckily, Flash supports custom HTTP headers through the addRequestHeader method (for both the XML and LoadVars class). Using this method, you can add the correct field to the HTTP header during the initial request, supplying the server with the right credentials, so the protected data is transferred immediately.

One thing to keep in mind is the way the content of the Authorization field is constructed. This depends on the server, but is usually based on the ‘basic’ scheme. This means that the full Authorization request is constructed like so:

BASIC username:password

Note that the username:password part has to be Base64 encoded. I have included some sample code below, demonstrating both the use of a Base64 encoding class and the .addRequestheader method of the XML object:

Actionscript:
  1. var pass:String = “testuser:testpass”;
  2. pass = Base64.Encode(pass);
  3.  
  4. var xmlReceiver:XML = new XML();
  5. xmlReceiver.onLoad = function( success:Boolean ) { 
  6.     trace(“XML loaded: “ + success + \n\n + this);
  7. }
  8.  
  9. var xmlSender:XML = new XML();
  10. xmlSender.addRequestHeader(“Authorization”,“BASIC “ + pass);
  11. xmlSender.sendAndLoad(“http://www.martijndevisser.com/xmltest/settings.xml”, xmlReceiver);

Download the source files here (includes Base64 class).

Please bear in mind that:

  • This solution does not work from a browser environment. It should work from a standalone executable though (that is what I needed). UPDATE - the problem with a browser environment is that the browser strips the “Authorize” field from the header, thus triggering the login popup to appear. I donot know the rationale behind this behaviour, but I experienced it in both IE and FF.
  • Also, this code will not work when the server you send the request to uses an authorisation scheme other than BASIC.

We won gold and silver!

14 April 2006 | filed under flash, projects | no comments »

SpinAwards logoLast night, the Dutch Spinawards (an annual happening where the best Dutch online creations are rewarded) were held at the Westergasfabriek and guess what: we won two prizes! So we really had something to celebrate at the party afterwards!

We won the first prize in the category “best online campaign” with the Hi Bling Bling project we did for Hi, a Dutch mobile operator. I’m especially proud of that prize, as I was very much involved in creating and delivering that project.
On top of that we won one of the silver ’spins’ (no gold was awarded in this category) for “best gaming concept” with a project called Sportlife DEEP, we did for Sportlife.

Right now, I’m sitting behind my desk with some strong coffee, trying to clear my somewhat foggy head, as there is another deadline to meet today… :-)