Javascript Flash Communication

Sometimes back I made a simple set of Flash component and JavaScript code to abstract the JavaScript-Flash-JavaScript communication. I named it JSFCommunicator Library.
It can be seen here .
I hope it helps someone…
cheers,

  • Kai Tischler

    Hello, dear Mr. Abdul Qabiz !!
    I plan to do the following: Using FlashRemoting as the Client-Server gateway of choice for my website, which shall consist of potential flash parts and mainly of HTML/Javascript parts.
    In the course of searching for a way for data exchange between a so-called “gateway flash proxy object” and HTML/Javascript, I found Your neat and promising JSFCommunicator Library.
    My question is now as follows: Does it make sense to use the combination FlashRemoting/JSFCommunicator for providing a client-server gateway to/from HTML/Javascript ?
    Of course such a gateway would need to support complex data like arrays, structs and queries.
    I hope that a FlashRemoting solution could be more robust and faster than other, native Javascript client-server gateways (e.g. SimpleRemoteScripting (SRS;
    http://www.electricsheep.co.nz/products/srs/;
    at the end of that page there are links to some other remote scripting resources))
    TIA for Your answer
    Kai Tischler from Northrhine-Westfalia in Germany

  • B

    I downloaded and implemented this code fine on IE/PC however it does not seem to function correctly on IE/MAC or IE/SAFARI. I know Safari has loads of problems with Javascript, so I’d be happy to just get it to work on IE/MAC.
    Any opinions?

  • Hi,
    I am sorry for that its not working in IE/MAC. I tested on some of the browsers on MAC and it worked.
    Could you please tell me what problem you are facing, that would help me finding the exact reason?
    Thanks,
    Abdul

  • mark

    Hi there I found your JSFC component. I have tried to run it through the Opera Browser.
    The flash to Java part works
    The Java to flash part does not.
    Version 7.54u1
    Build 3918
    Platform Win32
    System Windows 98 IE 6.0.2800
    I am getting these errors. At a glance can you tell what the problem is?
    ANy help would be great.
    file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/example.html
    Javascript URL thread: “javascript:runTestCode();”
    Error:
    name: TypeError
    message: Statement on line 110: Expression did not evaluate to a function object: this.flashMovie.GetVariable
    Backtrace:
    Line 110 of linked script file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/JSFCommunicator.js
    var result = this.flashMovie.GetVariable(propName);
    Line 130 of linked script file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/JSFCommunicator.js
    var flag = this.getVariable(“/:triggerFn”);
    Line 33 of inline#1 script in file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/example.html
    fc.callFunction(“_level0”, “setInfo”, [“Rajiv”, 22]);
    In unknown script
    runTestCode();
    Javascript URL thread: “javascript:runTestCode();”
    Error:
    name: TypeError
    message: Statement on line 110: Expression did not evaluate to a function object: this.flashMovie.GetVariable
    Backtrace:
    Line 110 of linked script file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/JSFC/JSFCommunicator.js
    var result = this.flashMovie.GetVariable(propName);
    Line 130 of linked script file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/JSFC/JSFCommunicator.js
    var flag = this.getVariable(“/:triggerFn”);
    Line 33 of inline#1 script in file://localhost/C:/WINDOWS/Desktop/map%20viewer/Map%20viewer1.1/JSFC/example.html
    fc.callFunction(“_level0”, “setInfo”, [“Rajiv”, 22]);
    In unknown script
    runTestCode();

  • Hi Guys,
    I am working on a fix, that would make this library to work on most of the browsers and platforms.
    Thanks for your feedback and patience…
    -abdul

  • Nandini Easwar

    I haven’t been able to get this to work. I follow the instructions as they are specified, but it throws a JavaScript error from within the JSFCommunicator.js file, where it tries to call the GetVariable(“/:triggerFn”) on line 111. I have tried to debug and find the exact error, but nothing…is there some other component that I need to include in the Flash file? Or in the HTML container page? Pls let me know.
    Nandini

  • Mark Weber

    Problem with JSFCommunicator library
    Hi Nandini or anybody else who might know – I just wanted to know if you ever found out or got feedback from anyone regarding the JavaScript error on line 111 of the JSFCommunicator.js file.
    I have the same problem (using IE 6.029) and was able to resolve it by dropping the JSFCommunicator Helper
    Component from the library to the stage (and then deleted it from the stage).
    This way it works when I deploy everything on my local server.
    However as soon as I try to get it to work on an external server
    I am getting again that JavaScript error on line 111 “Unspecified error”.
    Help would be greatly appreciated.

  • Hi Mark,
    In case of Nandini, she sent me a file offlist, the code she was using had some problems. I hope, JSFC is working for her now.
    Line 111 error could come only when Flash Player in a particular browser or platform doesn’t support methods like:
    SetVariable(…)
    GetVariable(…)
    I know currently it doesn’t work on Netscape 6, Opera on Windows, Firefox on MacOS.
    I am working to come up with a more stable version of JSFC. Which should work on all platforms and different browsers.
    Mark, I would like to resolve your problem if you can provide the code you are using. How are you creating instance of JSFCommunicator class etc..You can contact me offlist at mail_at_abdulqabiz.com
    Guys, thanks for the feedback, I am working to improve JSFC.
    -abdul

  • madhav

    Hey abdul i have used your component and it is working fine.
    But it is not working in mac safari and in firefox. did u able to solve it?
    Thanks in advance.
    Madhava ram.

  • Hi Madhav.
    That is known issue because of Brower’s limitation to set/get value to/from flash plugin in respective browsers.
    I was working on a fix, actually a fallback mechanism where it would use LocalConnection in browsers where SetVariable(..)/GetVariable(..) methods of plugin are not supported.
    But at the same time, Macromedia released Flash-JavaScript Integration Kit, which is very cool and I stopped on fix. I might do it for the sake of completness.
    I suggest, you to look at http://weblogs.macromedia.com/flashjavascript/
    It is cool. If you are targetting Macromedia Flash Player 8 onwards, then you would not need any extra library. You can use ExternalInterface to do most of things like:-
    * Passing (primitive or complex) data to-from between javascript(or host) and Flash Player
    * Calling ActionScript functions from Javascript, requires ActionScript functions to be allowed for calls from JS.
    Hope that helps…However I would be glad to help you more, if you want my help please feel to contact me offline (mail_at_abdulqabiz.com)….
    -abdul

  • Ulhas

    I have some odd question but i want to implement it. I want to catch the drag & drop events occured in flash file in javascript & then again in the C++ program in which this web page is embedded. Is it possible to get the string from javascript to C++.
    please guide me.