Getting data from hosts that require HTTP Authentication with URLRequest in AS3

Hey Everyone,

just a quick note on getting data from a host that requires HTTP Authentication.. First:

  • It seems to only work with POST
  • If your server is in PHP (probably other languages too), GET or POST is the same thing, doesn’t matter. You can have bogus post data and still pass GET data in the URL.
  • You will require a library to encode in Base64, I suggest this one: http://crypto.hurlant.com/ it contains the class com.hurlant.util.Base64 that is simple to use!

Read more…

Tutorial - Playing FLV video in plain AS3 - Part 2

Hi Everyone,

today I will continue on this topic:

In the first part I only discussed the essentials for playing an FLV. Today I will show how to build a re-usable class around those basic ideas. At the end of this tutorial you will have a solid set of classes (3) that you can reuse as a base to play FLV videos in all your widgets.

Still in the works, last updated June 13th, 2008. Come back in a few days to see the rest!

Read more…

Tutorial - Playing FLV video in plain AS3 - Part 1

Hi Everyone,

today I will explain how to play .FLV files that are hosted on a standard HTTP server, no fancy streaming. You can use pre-made components to do so, but sometimes, for whatever reason, you want to do it yourself. I wrote my first FLV playing algorithm in AS3 about 10 months ago, it has evolved since and here is the breakdown on how I make it work. It’s been used in many widgets, mostly for Music Nation.

Read more…

Tutorial - Consuming REST web services in ActionScript 3 - Part 3

Hi Everyone,

This is the third installment of the series, you can find the first two here:
Part 1 - http://blog.martinlegris.com/?p=87
Part 2 - http://blog.martinlegris.com/?p=90

Today I will develop on the data handling once the data is received from the webservice calls.
I will describe some methodologies I’ve developped that help mainstream data handling by using custom data types to hold the data, and custom iterators to access these data, and custom event types to transport the data.

Starting Point

In the last tutorial, we had a Singleton class calls WSClient which ran the request for us, then dispatched an event once the xml data was received.
Read more…

Getting around AS3’s un-RESTful-ness

Hi Everyone,

Mise en situtation
for those who have been following the development of the AS3 Youtube Data API library development, you might have seen that I hit a serious wall when I tried doing PUT and DELETE requests using flash.net.URLRequest together with flash.net.URLLoader. Simply put, it is impossible to execute such requests directly from the code library provided in Flash CS3. Some people have been trying to get around the problem using raw sockets, but will hit another wall inevitably: you are only allowed to connect raw sockets to the host that served you the .swf file. Hence, impossible to connect to gdata.youtube.com.

I had another idea, using Flex’s HTTPService inside of code compiled using Flash CS3. Hit another wall there. You can dynamically load some of Flex’s classes, like StringUtil, for example, using a Loader + the applicationDomain to get a reference to the Classes embedded in a SWF then instantiating them; but it doesn’t work on my complex Flex classes. You get weird errors, which I don’t understand. After spending a day on that, I decided it was over.

My goal was to keep this library client-side, AS3 only. I didn’t mind loading a SWF to get some of it’s classes, but I didn’t want to use a proxy on a server… and well, it can’t be done.

In comes the proxy
The idea is to provide a very general, generic proxy to help AS3 become RESTful. I had a few ideas, and in the end decided to opt for AMFPHP because of my past experience with it, and the fact that since Patrick Mineault (who has been a friend here in Montreal) has left, it seems it doesn’t get much attention. AMFPHP now talks AMF3, which I think is pretty cool.
Read more…

Tutorial - Consuming REST web services in ActionScript 3 - Part 2

Hi Everyone,

the first part of this tutorial can be found here: Tutorial - Consuming REST web services in ActionScript 3 - Part 1.

Today I will continue on the exploration of consuming REST web services in ActionScript 3. We will cover possible errors first, then create a versatile web service client object which is easily adaptable to all your projects.

Read more…

YouTube Data API - new rollout

Hi Everyone,

YouTube released a few days ago a new version of their data API. You can now interact with the system; you are no longer limited to simply retreiving publicly available information. You can now

  • Add, Remove and Modify Favorites
  • Create, Modify and Delete Playlists
  • Add To, Remove From and Reorder Playlists
  • Upload, Delete and Update Videos
  • Rate and Comment Videos

To enable these actions, you need to login through the standard Google API Authentication procedure. I have succeeded in doing so, and using all the actions mentionned above that can be done using POST and GET. However I realized that with Flash CS3 you are not allowed to use PUT & DELETE http methods.
Read more…

Tutorial - Consuming REST web services in ActionScript 3 - Part 1

Hello Everyone,

today I will discuss the method I have developed to consume RESTfull web services using AS3. This method was developped over time, I have written many different web service clients since last summer, about 20 of them; for different web services. Some of them require no parameters at all, some of them require GET params only, while others require GET & POST parameters. Read more…

Using Google Analytics to track activity inside of a Flash or Flex AS3 application

Hi Everyone,

do you develop complex AS3 applications and wonder how people interact with them? You could build yourself a webservice to which you would send event details, but then how would you visualize the data?

The answer can be quite simple. Read more…

FlashDevelop 3.0.0 Beta 6 is out!

Hi Everyone,

A side-note to start, I have been developing software for over 12 years. I started in C, then came C++, Java (6 years), C#, PHP, the whole shabang. Overall, the best IDE I’ve ever used is Intellij Idea. It is simply brilliant, or used to be some 5 years ago. It introduced Refactoring before anyone else, cleaned up your code for you, removed excessive spaces, just made everything tidier.

Eclipse
Although I consider Eclipse to be a good choice, especially coupled with FDT from PowerFlasher, Eclipse is bloated. Intellij Idea used less than 30 mb of RAM way back then, and I consider an IDE should never use any more than 50 mb of RAM, even for the most complex projects.

FlashDevelop
FlashDevelop is a brilliant alternative. It has gotten significantly better this last year, with true AS3 support, incredible auto-complete, auto-import and now even setter/getter generation built-in. I has a RegEx panel too, I think that one is a plug-in tho.

Basically Mika & Philippe are doing an amazing job. Plus it’s FREE.

Click here to download!

Cheers!

Martin