Subscribe to RSS
get email updates
home | about | pixDif AIR app | video tutorials
polyGeek.com

place your ad here

Web Premium



Get Qwest High Speed Internet



Creating a user poll using Flash Media Server and Remote SharedObjects

October 23rd, 2008 . by polygeek

NOTE: this example only works when Flash Media Server is running on my PC and it’s connected to the Internet.

Flash Media Server is good for a lot more than just streaming video and audio. With Remote Shared Objects you can store persistent data on the server to do things like create chat applications or a user poll.

I’ve created lots of polls in the past using AMFPHP – there’s one sitting to the far right column ->. It’s easy to do and very reusable. Storing data in a database has many advantages over using Remote Shared Objects but the RSO approach has one very distinct advantage: it automatically updates while you’re looking at the data. Check out the poll below. Submit your vote and then open this page in another Tab/Window ( I’d suggest opening in another Window so that you can see both at the same time. ) Submit you vote again and see it update the chart from your original vote. Cool, eh?

And the best thing of all is that it doesn’t take any extra code to achieve that. It pretty much comes with. It’s just a combination of the Sync event on the RSO and DataBinding.

view source

Getting Dirty
This example is very similar to my first two RSO examples except that I’m storing an ArrayCollection of Data Transfer Objects in the RSO. In practice it is no different than storing a String, Number, etc. except that FMS doesn’t actually notice that the value of the RSO has changed when you use setProperty().

All you have to do after calling setProperty() is call the setDirty() method on the RSO and that will do the trick for you. I have an entire post dedicated to setDirty with a simple example.

The best of both worlds
It would be very easy – if you have FMS and AMFPHP going for you – to set up a killer poll that used a database to store the data but used Remote SharedObjects to connect concurrent users so that when one user updated it would fire the Sync event for everyone viewing the poll and then we could go to the database to refresh the data. More about that later.

If something here has proved valuable to you then feel free to drop a couple of bucks in the tip-jar.

Post to Twitter Post to Delicious Post to Facebook Post to Reddit Post to StumbleUpon


similar posts

7 Responses to “Creating a user poll using Flash Media Server and Remote SharedObjects”


comment number 1 by: Ricky

I dont understand where your executable .swf is generated from?

comment number 2 by: polyGeek

@Ricky, I'm using Flex Builder to write the code and export a release build which creates the swf file.

comment number 3 by: Designer Sunglasses

Waht is this I actually did not understand that Waht is creating a user poll using flash media server and remort shared abject. Will you explain it.

comment number 4 by: Andy

Dear Sir,

I would be happy to make a donation for this Flex RemoteShared Object Poll, if you can tell me what is missing to make it work (on your site or for me).I was thinking that I don't see any serverside .ASC file, to maybe parallel the RSO Definitiions. In other words, it is not working on your site or when I try it on mine, so I was thinking that maybe there is a deleted or unreachable file for the serverside FMS File. This is definitely worth at least $20 to me.

Andy

comment number 5 by: polygeek

@Andy: The reason the app isn’t working is that I don’t have FMS online anymore. Thanks for pointing that out. I need to add a note to alert users to that. There are no .ASC files – because I’ve never made one. I honestly can’t remember how it works. It’s been ages since I messed with FMS stuff.

comment number 6 by: digital media

Thanks for pointing that out. I need to add a note to warn users about it.

comment number 7 by: Essay

Thanks a lot for interesting post.

   Welcome back (Change)

Leave a Reply

comment feed RSS   subscribe to this comment thread

Recent Posts

   



polyGeek.com

© Copyright 2008 polyGeek.com / Dan Florio, All Rights Reserved Except Where Explicitly Stated
Web Developement Blogs - Blog Catalog Blog Directory
M2 Websites
Local Directory for Los Angeles, CA

Better Tag Cloud