[Borges-users] borges+ming = swf on the fly
Слепнев Владимир
slepnev_v at rambler.ru
Sat May 8 14:22:13 EDT 2004
Hi,
some days ago I tried to use Borges+Ming to generate Flash (.swf)
content from numerical data (taken from a database) on the fly, and
show it in a component. It's easy. Here's how.
def flash_graph(r, blah blah blah) # r is the HTMLBuilder passed to
render_on
# create an SWF movie, called m, with Ming, from blah blah blah...
then do this:
tf = Tempfile.open("blahblah",".")
tf.binmode
m.save(tf.path)
r.set_attribute :src, r.url_for_document(tf.read,
"application/x-shockwave-flash")
r.set_attribute :width, w
r.set_attribute :height, h
r.tag "embed"
tf.close(true)
end
(A possible enhancement would be to use a customized RequestHandler
for the SWF data, to make it expire properly...)
Also, if anyone's in need of a Ming+Ruby build on Windows (this can't
be obtained from the Ming website), I have it, you only have to ask. I
made it myself. Not exactly an easy task :-)
Vladimir Slepnev
More information about the Borges-users
mailing list