display flex in jsp page

222 views
Skip to first unread message

snera

unread,
Oct 23, 2009, 10:33:15 PM10/23/09
to juicekit
Hi,

I'm developing a web application using jsp and I use flex for my data
visualization. Currently, I display my flex in jsp by embedding the
swf object into the jsp page; however, I have problem making it fit
into the my screen.....it always have scroll bars which I think not
user-friendly at all......Could anyone helps me solve this problem?
Like anyway to use jsp/java or flex code to detect the screen
resolution and fit the swf object accordingly ? Or any other way to
display flex in jsp rather than embed swf object?.......

Chris Gemignani

unread,
Oct 23, 2009, 11:04:37 PM10/23/09
to juicekit
Hi:

Take a look at BrowserCanvas (http://www.dncompute.com/blog/2008/06/23/
browsercanvas-the-worlds-easiest-way-to-dynamically-resize-
flash.html). This uses a really clever technique of Javascript
injection from the SWF to let your SWF resize itself on the page
dynamically. We'll release a Flex component that makes using Browser
Canvas easier in a future JuiceKit. Details, TBD.

There's no way to use Flex without embedding a swf object. We prefer
to use SWFObject (http://code.google.com/p/swfobject/) to dynamically
embed swfs instead of using Adobe's html-template embedding code. It's
dramatically simpler.

Chris

snera

unread,
Oct 24, 2009, 12:08:51 AM10/24/09
to juicekit
Thanks Chris!!! This really helps a lot.....I will try to make it
work.....My current data visualization uses treemap, which gets data
from a csv file. However, when I change the data inside the csv file,
the treemap does not reflect the change, it still show the old data
even though the old data was not there anymore.....how could I make it
automatically refresh and get the updated data from my csv file? Or I
must recompile the mxml file again to generate the new swf file and
display it to jsp page?

On Oct 24, 11:04 am, Chris Gemignani

Chris Gemignani

unread,
Oct 27, 2009, 2:45:07 PM10/27/09
to juicekit
Hi Snera:

This is almost exactly the same problem Tracy is having. Try and
verify that you're getting the right data from the server. Can you
pull the url containing the delimited data in a regular browser window
and make sure you're getting the data from the server you expect? You
may need to clear your browser cache.

Another approach is to look at the result data in a datagrid.

/* Add this right below private var d:Array; */
[Bindable] public var dataAC:ArrayCollection;

/* Add this in public function resultHandler(... below d=new
DelimitedTextConverter(... */
dataAC = new ArrayCollection(d);

/* Add this in your mxml to display the DataGrid */
<mx:DataGrid dataProvider="{dataAC}"/>

Best of luck. If you have the right data loaded, the treeMap should be
generated correctly.

- Chris
Reply all
Reply to author
Forward
0 new messages