# Macromedia Flash with Ruby on rails

**URL:** <https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715>\
**Category:** Rails\
**Created:** [March 13, 2007, 1:31pm UTC](https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715 "2007-03-13T13:31:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 13, 2007, 1:31pm UTC](https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715/1 "2007-03-13T13:31:05Z")

</div>

Hello everybody,

I have been given the thankless task of implementing a Flash GUI with  
a ruby back-end. Naturally I argued for the merits of HTML (of RHTML)  
but to no avail, and so here I am a prodding and a poking around FLASH  
and XML sockets. Firewalls aside, this looks like my best approach,  
and the plugin known as juggernaut as the best implementation of this  
sort of work. Has anyone implemented a similar solution using a  
different approach or set of tools?

Any suggestions before the-off would be greatly appreciated…

John

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 13, 2007, 3:30pm UTC](https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715/2 "2007-03-13T15:30:28Z")

</div>

Why not expose your back-end with web services? You can more easily  
test them, Flash can use them, and if you needed to drop the flash  
front end you wouldn’t have to touch a line of code.

XML sockets in flash are for more immediate data like chat rooms,  
multiplayer games, etc.

-Shawn

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 13, 2007, 3:56pm UTC](https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715/3 "2007-03-13T15:56:31Z")

</div>

Cheers Shawn,

I want to retain state throughout the one swf. It is a game with  
tasks, and every time a user completes a task both the score and state  
are stored in a database. The user can finish the game at any time  
and return to their last completed task. I thought of XML sockets  
because they allow the client and server communicate without  
submitting a new HTTP request. This is really what I am aiming for.

john

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 13, 2007, 4:29pm UTC](https://www.ruby-forum.com/t/macromedia-flash-with-ruby-on-rails/102715/4 "2007-03-13T16:29:41Z")

</div>

Ahh, well you could also retain state much the same way state is  
retained in HTTP, use a session identifer (one that you send with each  
request, through the SOAP header perhaps). Then you can associate the  
information in the database (or wherever) with that session.

I haven’t played around with it, but you might be able to pass the RoR  
session ID into flash through the HTML embed, pass it through to the  
web services, and retrieve the RoR session?

Either way you decide to go, good luck!

-Shawn
