Flash problem and flashvar

Hi. I have this code:

   ClassResource flashResource =  new ClassResource("videochat.swf", TheMainApp);
   flash = new Embedded("Video", flashResource);
   flash.setType(Embedded.TYPE_OBJECT);
   flash.setMimeType("application/x-shockwave-flash");
   flash.setParameter("allowScriptAccess", "sameDomain");
   flash.setParameter("quality", "high");
   flash.setParameter("bgcolor", "#ffffff");
   flash.setParameter("flashvars", "address=localhost/video&channel="+ticket.key+"&inittype=subscribe")

It works fine, it shows flash.

However, flashvars are NOT passed to flash, so movie can not start propertly

How to pass flashvars.
Please don’t redirect me to some complicated example, since I only want to pass that flashvars to to flash, nothing more.

Thanks!

I have to say before anything that I am absolutely no expert on this matter, and I haven’t done anything with Flash in Vaadin.

However, as I see it, Embedded doesn’t have the support to pass this flashvars. There is in VEmbedded this code (line 126 forward in Vaadin 6.1)


setHTML("<object width=\"" + width + "\" height=\"" + height
+ "\"><param name=\"movie\" value=\""
+ getSrc(uidl, client) + "\"><embed src=\""
+ getSrc(uidl, client) + "\" width=\"" + width
+ "\" height=\"" + height + "\"></embed></object>");

how I see it, it should be something more like this to work:


setHTML("<object width=\"" + width + "\" height=\"" + height
+ "\"><param name=\"movie\" value=\""
+ getSrc(uidl, client) + "\"><embed src=\""
+ getSrc(uidl, client) + "\" width=\"" + width
+ "\" height=\"" + height + "\">"
+ "<param name=\"flashVars\" value=\"" + getParameter("flashvars",uidl)
+ "\" />"
+"</embed></object>");

Just a wild hunch. You could test this if you’re at all familiar with doing own components.

This is a known issue:
#3367

Thanks,
I hope fix will arrive soon.

There is a bit of a temporary workaround to this if you can’t wait till the 6.1.2 bugfix release that it is hoped the Embedded param issue is fixed in.

I could solve my
issue
by bodging the OBJECT\embed tags into a label and getting the flash resource string from a ClassResource.



public class FlashLabelApplication extends Application {

private String objectHTMLStr =
    "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\"600\" height=\"500\" id=\"Column3D\" >\n" +
    "   <param name=\"movie\" value=\"{1}?chartWidth=600&chartHeight=500\" />\n" +
    "   <param name=\"FlashVars\" value=\"&dataXML=<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showNames='1' decimalPrecision='0' formatNumberScale='0'><set name='Jan' value='462' color='AFD8F8' /><set name='Feb' value='857' color='F6BD0F' /><set name='Mar' value='671' color='8BBA00' /><set name='Apr' value='494' color='FF8E46'/><set name='May' value='761' color='008E8E'/><set name='Jun' value='960' color='D64646'/><set name='Jul' value='629' color='8E468E'/><set name='Aug' value='622' color='588526'/><set name='Sep' value='376' color='B3AA00'/><set name='Oct' value='494' color='008ED6'/><set name='Nov' value='761' color='9D080D'/><set name='Dec' value='960' color='A186BE'/></graph>\">\n" +
    "   <param name=\"quality\" value=\"high\" />\n" +
    "   <embed src=\"{1}\" flashVars=\"&dataXML=<graph caption='Monthly Unit Sales' xAxisName='Month' yAxisName='Units' showNames='1' decimalPrecision='0' formatNumberScale='0'><set name='Jan' value='462' color='AFD8F8' /><set name='Feb' value='857' color='F6BD0F' /><set name='Mar' value='671' color='8BBA00' /><set name='Apr' value='494' color='FF8E46'/><set name='May' value='761' color='008E8E'/><set name='Jun' value='960' color='D64646'/><set name='Jul' value='629' color='8E468E'/><set name='Aug' value='622' color='588526'/><set name='Sep' value='376' color='B3AA00'/><set name='Oct' value='494' color='008ED6'/><set name='Nov' value='761' color='9D080D'/><set name='Dec' value='960' color='A186BE'/></graph>\" quality=\"high\" width=\"600\" height=\"500\" name=\"Column3D\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n" +
    "</object>";


  @Override
  public void init() {
    Window w = new Window("Flash in a label");
    setMainWindow(w);
    w.getContent().addComponent(getFlashLabel());
  }
  public Component getFlashLabel() {
    // Get the Flash Resource.
    final ClassResource flashResource =
        new ClassResource("FCF_Column3D.swf", this.getMainWindow().getApplication());
    // Replace some variables in the OBJECT and embed tag - in this case just the flash resource
    objectHTMLStr = StringUtils.replace(objectHTMLStr, "{1}", this.getRelativeLocation(flashResource));
    // Create XHTML label and add objectHTMLStr as the data
    Label flashLabel = new Label();
    flashLabel.setContentMode(Label.CONTENT_XHTML);
    flashLabel.setPropertyDataSource(new ObjectProperty(objectHTMLStr, String.class));
    return flashLabel;
  }
}

This could be bad for many reasons I am too naieve to understand but it seems to work !

Cheers

Mat

Thanks.

Anybody know when bug fix will come out?

bye,ivan

Hi Ivan,

The ticket #3367 is scheduled for the
6.1.2
release, which is due the 7th of October.

HTH
/Jonatan