The Space For App Developers

Beyond Plain Old HTML Objects

Flerry 1.1.0 released with a two-way Flex-Java communication

with 10 comments

I would like to proudly announce that Flerry 1.1.0 was released! For those of you that don’t know what is Flerry, it’s a Flex-Java bridge for Adobe AIR 2.0. This new release brings possibility to call/initiate communication from Java to Flex/AS3 code. This functionality was solely developed by Jhonny Everson, big kudos to Jhonny!!! I love when open source really works and community contributes their work, with that said I encourage any of you that use Flerry to commit to the project ;)

You can grab latest FB4 project with Flerry and demo app from here.

Usage is really simple:

First create instance of NativeObject either in MXML or AS3 (binPath is path to jar file with compiled Java source classes):

<flerry:NativeObject id="nativeObject" singleton="true" 
binPath="./jars/flerry-demo.jar"  source="net.riaspace.flerrydemo.MyJavaObject" />

Next subscribe to messages sent from Java side, “sendMsg” parameter defines message identifier:

// Subscribe to receive remote messages.
nativeObject.subscribe("sendMsg", messageHandler);

On the Java side you have static method sendMessage on NativeObject class with message parameter and again message identifier:

NativeObject.sendMessage(map, "sendMsg");

Written by Piotr Walczyszyn

June 30th, 2010 at 10:30 am

Posted in Releases

Tagged with , ,

10 Responses to 'Flerry 1.1.0 released with a two-way Flex-Java communication'

Subscribe to comments with RSS or TrackBack to 'Flerry 1.1.0 released with a two-way Flex-Java communication'.

  1. [...] Continue reading here: Flerry 1.1.0 released with a two-way Flex-Java communication … [...]

  2. thanks for sharing, good piece of code.

    malczak

    30 Jun 10 at 11:30 am

  3. Thank you for the information………..

    Anitha

    30 Jun 10 at 11:44 am

  4. Great! It’s good to see this project evolving! Keep the good work! :)

    Carlos Rovira

    30 Jun 10 at 11:44 am

  5. This is great, thanks!

    Just one question. Why Java api is different than AS3 api? In AS3 you have nativeObject.JavaMethod(args) but in Java you must work with message subscribing. Wouldn’t it be much more easier if Java side has the same api as AS3, something like nativeObject.As3Method(args)?

    Prasad

    1 Jul 10 at 5:12 pm

  6. [...] and download the flerry and flerry-demo projects. You may also find my previous posts (Post 1 | Post 2) [...]

  7. Hello o/

    nice work \o/

    actually i´m studying this lib to use in one project then i reviewing the code and found 1 problem in this function on NativeObject.as where when i execute the demo application the Thread start the second return value from java cause the follow Erro 2006 [ The supplied index is out of bounds. ] so…

    i solve the problem hehe with this change on NativeObject.as, on the function [ onOutputData ]

    messageBytes.clear();
    nativeProcess.standardOutput.readBytes(…

    and after first if

    //create object from the collected bytes
    var message:AcknowledgeMessage;

    if(messageBytes.bytesAvailable > 0)
    { messageBytes.position = 0;
    message = messageBytes.readObject() as AcknowledgeMessage;
    }

    now working fine \o/

    Erko Bridee

    21 Jul 10 at 4:22 am

  8. I have a Question about flerry:
    When setting singleton to “false”,
    how can I instantiate and differentiate between different istances of the java Object?

    julakali

    29 Sep 10 at 9:49 am

  9. I’ve used Flerry sucessly in a desktop enviroment. WinXP / Win 7 with JRE 6, with only little adjustements to source code.

    But, i saw that Flerry needs the Java executable to send information between the process.

    Is there an adaptation or alternative to use Flerry in Android?

    The Aibo

    4 Jul 11 at 10:34 pm

  10. I love your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz reply as I’m looking to design my own blog and would like to know where u got this from. thanks a lot

    weathervane

    2 Oct 11 at 5:30 am

Leave a Reply