zoukankan      html  css  js  c++  java
  • java窗体与Flash交互

    最近在研究flash,用flash去读取文件很简单,但是存储文件就很麻烦了。

    因此想到用java的窗体进行交互。

    下面是DJNativeSwing-SWT-1-0-3-20140708的下载链接:

    http://pan.baidu.com/s/1o67eIim

    基本原理是用java内嵌式开源浏览器将编译好的swf文件进行展示。

    如果是windows64位系统,需要64位的swt4.3的jar包:

    http://archive.eclipse.org/eclipse/downloads/drops4/R-4.3.2-201402211700/swt-4.3.2-win32-win32-x86_64.zip

    在windows窗体上展示flash文件目前本人亲测可用。

    另:

    java与flash的数据交互据说有以下方法,尚未证明:

    1.flash给swing发送消息:

    ExternalInterface.call("sendNSCommand", "request", msg.toString());

    这里的sendNSCommand是DJNativeSwing已经实现的方法,直接调用即可。

    2.swing接收flash消息的方法:

    flashPlayer.addFlashPlayerListener(new FlashPlayerListener() {
    public void commandReceived(FlashPlayerCommandEvent e) {
    String cmd = e.getCommand();
    if (FlashCommand.EXIT.equals(cmd)) {
    Application.exit();
    } else if ("request".equals(cmd)) {
    MessageServiceServerFlashImpl.this.processRequest((String)(e.getParameters()[0]));
    } else if (FlashCommand.LOG.equals(cmd)) {
    MessageServiceServerFlashImpl.this.processLog(e.getParameters());
    }
    }
    });

    flashPlayer就是DJNativeSwing里的JFlashPlayer。

    3.swing给flash返回信息:

    flashPlayer.invokeFlashFunction("reply", msg.toString());


    4.flash处理swing返回的信息:

    ExternalInterface.addCallback(("reply", onReply);

    onReply就是自定义的回调函数,用来处理swing返回的信息。

  • 相关阅读:
    word2vec
    视频推荐系统
    python基础
    go-elasticsearch
    Docker 部署 go项目
    gohbase
    禅道部署linux
    jmeter 报错 Error occurred during initialization of VM Could not reserve enough space for object heap
    jarvis OJ-DSA
    算法-我的第一本算法书(一)
  • 原文地址:https://www.cnblogs.com/sm21312/p/4203304.html
Copyright © 2011-2022 走看看