Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Flash component
I am trying to display a swf file within a window, very simple like in the tutorial 5.15.1 Embedded Objects
Just does not work for me, could someone help out here please ?
public class FusionchartapplicationApplication extends Application
{
@Override
public void init()
{
System.out.println("inint ");
this.setTheme("fusionchartapplicationtheme");
Window w = new Window();
setMainWindow(w);
w.addComponent(getFlash());
}
public Component getFlash()
{
// Create a Shockware Flash resource
final ClassResource flashResource = new ClassResource(
"swf/opener.swf", getMainWindow().getApplication());
// Display the resource in a Embedded compoant
final Embedded embedded = new Embedded("Embedded 12345 Caption",
flashResource);
// This is the default type, but we set it anyway.
embedded.setType(Embedded.TYPE_OBJECT);
// This is recorgnized automatically, but set it anyway.
embedded.setMimeType("application/x-shockwave-flash");
return embedded;
}
}
Thanks
Chris
Have you tried to set a width and height to your embedded component and see if it matters?
Or have you checked what ends up in the DOM e.g. using Firebug?
http://demo.vaadin.com/sampler#FlashEmbed is an example of how you can embed flash.
Take a look at a working sample at http://uilder.virtuallypreinstalled.com/run/youtube/
This loads the flash from ExternalResource (i.e. YouTube) instead from a ClassResource, but the Embedded part is the same.
The ClassResource seems to ignore the path to the file, in Fierbug I can see that the path is always APP/1/swift3d.swf
final ClassResource flashResource = new ClassResource(
"swf/swift3d.swf", this);
I switched to ThemeResource and it workes
Thanks
CHris
Chris Roffler: The ClassResource seems to ignore the path to the file, in Fierbug I can see that the path is always APP/1/swift3d.swf
A ClassResource is loaded by the classloader from the classpath so for using that the file should be in the source/build folder in your project. The url is a generated url used internally by Vaadin to load the resource.
If your resource is in the theme folder you should use ThemeResource, that one will be directly loaded from the theme folder so the url will not be a generated one.