In the previous post i created an example of loading the Youtube player into your application, as2 or as3. To do this i had created a wrapper class component to make it simple to just drag and drop the component into your as2 application. With this you can start using Youtube videos, and controlling playback. Simple really.
This is an example of what you can do with that sort of functionality simply and more importantly, very quickly. At its core, it’s an instance of the youtube wrapper component, a list component, some code to let users add in new youtube songs, and retrive all the songs from the database. And all i’ve done is hide the video player.
Be aware though that a video must be enabled to share on youtube before you can use it. So Official videos from bands usually aren’t enabled for sharing, and as such you’ll need to find one added by a fan instead.
Here’s some demo code of how to get youtube into AS3. Simply put, you load the youtube player into an as2 wrapper swf, then load that swf into your as3 file. A bit of LocalConnection communication between the two and you’re good to go. There’s already a few examples around the internet, but they seem to overcomplicate what is a pretty simple task.
Here i’ve made an as2 class to wrap the youtube player, handle all the loading, state changes etc, and converted it into an open component. This is dropped into an as2 swf with some buttons to show it working. I’ve used Grant Skinners SWFBridge to handle the communcation between the as2 swf and the as3 swf, like the youtube wrapper class i made, it just serves to make it even easier to plumb together.
I’ve made it easy to delete all the controls from the as2 version and shrink the swf size to the size you want the player to be. Then simply load into any as3 swf and copy the SWFBridge code to control the video playback.
Google Spreadsheet forms are an ideal way to collect information from users, like messages, comments or feedback. You don’t need to do any work on your part to store it, no databases, files or anything like that. It relies only on the fact that you have a google account, and can put together a very simple spreadsheet form.
As a very simple example, if you were making a flash site for a client and wanted to put in a contact form that users could add messages to a stored list, then this would be an ideal way to provide a solution that you wouldn’t have to maintain, and that your client would have instant access to in an easy format. They can even output it to excel.
All you need to do is pass in your LoadVars or URLVariables in post format variables like this:
sender[“entry.0.single”] = “my string to add to spreadsheet”;
Where the number between entry and single is an incrementing number denoting the control in the form to mirror. So in this example the entry.0.single represents the name text field control in the google spreadsheet form.
Crossdomain and php proxy
Unfortunately the google spreadsheets crosssdomain.xml does not allow flash content to access the spreadsheets url but by using a fairly simple php proxy we can easily get round this.
So the LoadVars/URLLoader calls the local GoogleSpreadsheetProxy.php passing all the vars and the url for submitting the spreadsheet and simply proxys the request via the url passed.