【问题标题】:How to display swf file in browser for Liferay vaadin portlet 6.1?如何在 Liferay vaadin portlet 6.1 的浏览器中显示 swf 文件?
【发布时间】:2012-10-22 20:41:20
【问题描述】:

我必须将 swf 文件列表保存在本地系统的本地目录中,而不是项目文件夹中。

我必须使用其名称从该路径调用 swf 文件,并将其显示在 liferay 6.1 中的 vaadin portlet 的浏览器中。

谁能分享一下如何实现这一点的想法?

提前致谢

【问题讨论】:

    标签: flash liferay vaadin


    【解决方案1】:

    为此,您必须使用 Stream Resource .. 只需检查以下示例代码..

    祝您签证顺利:)

        Window window = new Window();
    
        setMainWindow(window);
    
        Label label = new Label("Embed tag");
    
        label.setDebugId("lblMsg");
    
    
        window.addComponent(label);
    
        StreamSource s = new StreamResource.StreamSource() {
    
        @Override
        public InputStream getStream() {
        File f = new File("C:/test/test.swf");
        FileInputStream fis=null;
        try {
        fis = new FileInputStream(f);
        } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        }
        return fis;
        }
        };
    
        StreamResource r = new StreamResource(s,"application/x-shockwave-                        flash",getMainWindow().getApplication());
        Embedded e = new Embedded();
        e.setType(Embedded.TYPE_OBJECT);
        e.setMimeType("application/x-shockwave-flash");
        e.setSource(r);
        e.setWidth("400px");
        e.setHeight("400px");
    
        window.addComponent(e);
    

    【讨论】:

      猜你喜欢
      • 2015-09-03
      • 1970-01-01
      • 1970-01-01
      • 2012-12-25
      • 1970-01-01
      • 2023-04-09
      • 1970-01-01
      • 1970-01-01
      • 2017-03-27
      相关资源
      最近更新 更多