Sep 06

Adobe Flex RoR SDK

Tag: Flex and RailsDerek Wischusen @ 2:13 am

Hello everyone, as I am sure some of you already know I have been working with Mike Potter on an SDK for Flex and RoR.  You can check it out on our Google Code project here. 

Currently, the SDK contains samples demonstrating: (1) Intergrating with a database, basic CRUD, and rails migrations. (2) Uploading and downloading files. (3) Downloading data directly from Flex and sending data to a new browser window directly from Flex. (4) a simple Directory Explorer.  The last sample uses WebORB for integrating Flex with Rails.

The SDK also contains links to useful resources for Flex and RoR development.

I plan to continue adding samples and I strongly encourage anyone with an interest in Flex and Rails to contribute your own samples.  Or if RoR is not your cup of tea be sure to check out Mike Potter’s PHP SDK, or talk to Mike about starting an SDK for your language of choice.

Mike and I have also been thinking about starting an open source RIA development project using Flex and Rails.  Anybody interested?  Any ideas on what would be a good app for showcasing Flex and Rails?

16 Responses to “Adobe Flex RoR SDK”

  1. Mark Ireland says:

    How about a FlexOnRails version of the real Simple Content Management System? I mean the backend.

    The drag-and-drop part would suit Flex and it would be cool to see a WYSIWYG editor in a Rails scaffolding form.

    Presumably the actually site eventually generated would use a liquid design that was only div tags with unique (ie generated from the db) ids.

  2. Derek Wischusen says:

    Mark,

    I agree. A Content Management System was the first thing that came to my mind as well. I was thinking that you could use ImageMagick and RMagick as part of the backend.

  3. Alex MacCaw says:

    Mark and Derek, funny you should mention that but I’m halfway through a Flex app built with the cairngorm framework and a ruby on rails backend. It uses Flex Data Services(via Weborb). There’s an early screenshot here: http://www.flickr.com/photos/maccman/228526299/ I’ve also just been making a asset manager. When the cms is finished I’ll release it under the MIT license and contribute it to your code. If anyone would like to help or to look at the current code, please email me (maccman@gmail.com).

  4. Ryan says:

    Nevermind, got it. I was close before. I had to copy the Flex files from the Flex Source\flex_issuetracker\bin to the rails public directory and navigate to http://localhost:3000/flex_issuetracker.html . Simple, really, just the included docs don’t say anything about it.

  5. Derek Wischusen says:

    Good point. I’ve update the files so that all you have to do is boot up your server and open a browswer to http://localhost:3000, except for the directory explorer sample. For that one you should point your browser to: http://localhost:3000/examples/flex_directory_explorer.html

  6. Laurent says:

    For the open source RIA application with Flex on Rails, why not a TimeSheet application…The UI would be a Calendar (as the iCal in Mac), and we should enter the activities…
    What do you think?

  7. duksh says:

    I am a 2nd year IT BSc student, and am really very impressed with the power of Flex on Rails.

    In my opinion it would have been better if you or we could work on a sample project starting from basic to advance set of apps so that those who are still unaware of flex.

    Then you will automatically get more flex enthusiast. this will bring a long term benfit as the comunity will start to grow!

  8. Chris Maloney says:

    Hi folks,
    Thanks Derek…

    Has anyone actually got any of these samples working – on Webrick?

  9. Flex on Rails says:

    [...] This is unexpected news (to me, at least). Riding Rails reports that Adobe is releasing an official Rails SDK for Flex Flex on Rails. Read more at Flex on Rails. [...]

  10. Umang says:

    Hey Folks :)

    Anyone been having problems with embedding .swf in Flex using

    For some reason the animation goes over the panel on the left and the right.

    Cheers…

  11. Marcus Baur says:

    We have developed a visual goal management sollution on three different platforms: Java, .net, and vb/flash. We are now looking at doing a RIA with flex based on the action script code we already developed. Ruby seems very attractive in this context as well.
    We could imagine doing this in a semi-open source fashion, with the programmers earning shares of the project based on theire contribution.
    It would be great to discuss the possibilities…

  12. The Ruby on Rails RIA SDK by Adobe - danielyuen.hk Blog says:

    [...] flexonrails.net » Blog Archive » Adobe Flex RoR SDK [...]

  13. Kay says:

    Hi,

    I just started on flexonrails.. and to be honest, I know absolutely zilch. I started from your article over at

    adobe
    but I couldnt understand why I cannot get it to work by pointing my browser to a localhost:3000 something.

    Now I found out your SDK but I still cannot understand what was the difference that enabled the issue tracker to be displayed on the localhost:3000

    Can you enlighten me?

    I have Flex 2 builder btw.

    Thanks

  14. Derek Wischusen says:

    Hi Kay,

    If you want to launch an app by pointing your browser to http://localhost:3000 you will need to put the swf file for your Flex app in the public folder of your Rails app, and you will need to replace the index.html file in there with with html file that Flex Builder generates for your app.

    Derek

  15. Ajay says:

    I am new to this technology. I am using code from given examples in SDK with flex 3, actionscript 3 and rails for embedding upload functionality in my application. But I am getting the IO error at run time when i run it from flex builder. And when i run it using ruby script/server it runs without any error but doesn’t write any file on disk. Please help me fixing this bug.
    Code i used is:

    —————————application.rb————————

    # Filters added to this controller apply to all controllers in the
    application.
    # Likewise, all the methods added will be available for all
    controllers.

    class ApplicationController ‘3a8f77511f4633ed7c0cb6065d614fec’

    def upload_file
    file_data = params[:Filedata]
    file_name = params[:Filename].to_s
    file_path = params[:folder].to_s
    File.open(file_path + “/” + file_name, “wb”) { |new_file|
    new_file.write(file_data.read) }
    render(:xml => “”)
    end
    end

    ————————PdfStore.mxml—————-

    ———————————-UploadPdf.mxml———————

    ——————————–
    uploadScript.as————————–

    // ActionScript file

    private var uploadFileRefList:FileReferenceList = new
    FileReferenceList();
    private var uploadURL:URLRequest = new URLRequest(”http://localhost:
    3000/application/upload_file”);

    private function uploadFiles():void
    {
    uploadFileRefList.addEventListener(Event.SELECT,
    uploadSelectHandler);

    try {
    var success:Boolean = uploadFileRefList.browse();
    } catch (error:Error) {
    trace(”Unable to browse for files. ” + error);
    }
    }

    private function doUpload(file:FileReference):void
    {
    file.addEventListener(Event.COMPLETE, uploadCompleteHandler);
    file.addEventListener(IOErrorEvent.IO_ERROR, uploadIoErrorHandler);
    file.addEventListener(ProgressEvent.PROGRESS,
    uploadProgressHandler);

    var variables:URLVariables = new URLVariables();
    variables.folder = “public/” + fileFolder;//bin/
    uploadURL.data = variables;

    try {
    file.upload(uploadURL);

    } catch (error:Error) {
    trace(”Unable to upload file. ” + error);
    }

    }

    private function uploadSelectHandler(event:Event):void
    {

    for each (var file:FileReference in uploadFileRefList.fileList)
    filesToUpload.addItem(file.name);

    doUpload(uploadFileRefList.fileList[0]);

    }

    private function uploadProgressHandler (event:ProgressEvent):void
    {
    pb.label = “Uploading ” + event.currentTarget.name + ” ” +
    Math.floor((event.bytesLoaded/event.bytesTotal)*100) + “% complete”;
    pb.setProgress(event.bytesLoaded, event.bytesTotal);
    }
    private function uploadIoErrorHandler (event:Event):void
    {
    trace (”Upload failed: ” + event);
    }
    private function uploadCompleteHandler (event:Event):void
    {
    uploadedFiles.addItem(event.currentTarget.name);

    filesToUpload.removeItemAt(0);

    uploadFileRefList.fileList.splice(0, 1);

    if (filesToUpload.length == 0)
    {
    pb.label = “LOADING 0%”;
    pb.setProgress(0, 0);
    event.currentTarget.removeEventListener(Event.COMPLETE,
    uploadCompleteHandler);
    event.currentTarget.removeEventListener(IOErrorEvent.IO_ERROR,
    uploadIoErrorHandler);
    event.currentTarget.removeEventListener(ProgressEvent.PROGRESS,
    uploadProgressHandler);
    }
    else
    {
    doUpload(uploadFileRefList.fileList[0]);
    }

    }

  16. Ajay says:

    mxml files i used:

    —————–PdfStore.mxml—————-

    ————UploadPdf.mxml———————

Leave a Reply