[Newbies] Integrating Seaside and Flash

Ramon Leon ramon.leon at allresnet.com
Fri Sep 5 16:47:40 UTC 2008


> I would like to include a Flash component in a seaside page. 
> The component needs to write data back to the seaside app.  I 
> can think of two ways to communicate with the server:
> 1. define a static URL, that the component can call, and 
> somehow process the returned data
> 2. have a form embedded on the page (that contains the flash 
> component) and get the component to write its data into the 
> form, and then submit it
> 
> I was going towards the first option, but Ramon put a comment 
> on my blog that made me realise that I probably don't 
> understand the seaside approach yet. So, could anyone give me 
> a simple example of what they feel is the best approach?
> 
> cheers
> Andy

Both options are viable.  In your blog post you didn't exactly say what you
were wanting to parse the request for, I was trying to tell you that under
normal circumstances you don't need to do that, post your form and let
Seaside bind the values up to your model for you.  Flash talking to the
server and saving data is not a normal circumstance.

I'd use Scriptaculous to hook some event you're interested in so when that
event occurred a callback was done to pass data back to the server using
some JavaScript to read the data from the client side element if it's a
simple value...

html div
   onMouseOut: (html request 
      callback: [ :value | value inspect ]
      value: (SUStream new nextPutAll: 'fetchFlashData()'))

If it's more complex with a bunch of fields, I'd post a form back on some
event as you state in #2...

html div
   onMouseOut: (html updater
        id: #someStatusIndicator ;
        triggerForm: #someId ;
        on: #renderStatusOn: of: self)

Or just use a request instead of updater if you don't care about showing any
feedback.

The form itself of course would be bound to instance variables of some class
and rendered with either dynamic JavaScript generated using the generated
id's of the fields so the Flash JS knows what field names to write into, or
I'd just hardcode simple manual id's to the fields and use some static
JavaScript bound to known names.

Ramon Leon
http://onsmalltalk.com



More information about the Beginners mailing list