Well, here is the first public release of Alph:
Alph is a Ruby/Java/Flash (I know...I am insane) that bridges the Ruby and Flash runtimes (and Java too...but that is to solve the cross-platform projector problem that Macromedia will not solve.) With Alph and Ruby (>= 1.8.1) you can create Flash user interfaces (forms, etc) that are fully coded in, and controlled by Ruby. No Actionscript required, no Flash IDE required, just Ruby (and those dependent runtimes). Here is a simple ruby script:
This example demonstrates the List Box family of components (ComboBox, ListBox, Grid). See: http://www.ultrashock.com/tutorials/flashmx2004/ui-components06.php
$:.unshift '../lib' require 'alph' app = Alph::Application.new frame = app.new_frame frame.control.setBounds(100, 100, 640, 480)
flash = frame.flash
myComboBox = flash.new_component("mx.controls.ComboBox",
:editable=>false, :rowCount=>5,
:_x=> 14, :_y=>26, :_width=>291, :_height=>22)
myComboBox.labels = ['Organic Snacks',
'Recycled Office Paper', 'Wind Energy',
'Solar Power']
myComboBox.change do |event|
# The myComboBox.selectedItem method returns
# the label (not an object) because the data is not set.
puts "You selected #{myComboBox.selectedItem}."
end
myList = flash.new_component("mx.controls.List",
:_x=> 14, :_y=>66, :_width=>291, :_height=>120)
# Data provider is an array of anonymous objects (label/data)
myList.dataProvider = [
{:label=> "Organic cotton underwear", :data=> 7.25},
{:label=> "Organic T-Shirt", :data=> 15},
{:label=> "Recycled Office Paper", :data=> 6.99},
{:label=> "Organic Cola", :data=> 1.25}
]
myList.change do |event|
# The myList.selectedItem method returns an object with
# a label and data property because the data _is_ set.
item = myList.selectedItem
puts "#{item.label} costs $#{item.data}"
end
myDataGrid = flash.new_component("mx.controls.DataGrid",
:_x=> 14, :_y=>200, :_width=>291, :_height=>120)
# Column names align with column ids
myDataGrid.setColumnNames( ["Product", "Price", "Quantity"] )
# Data provider is an array of anonymous objects (keys = column ids)
myDataGrid.dataProvider = [
{:Product=> "Underwear", :Price=> 7.25, :Quantity=> 3},
{:Product=> "T-Shirt", :Price=> 15, :Quantity=> 1},
{:Product=> "Paper", :Price=> 6.99, :Quantity=> 7},
{:Product=> "Cola", :Price=> 1.25, :Quantity=> 24}
]
myDataGrid.change do |event|
# The myDataGrid.selectedItem method returns the anonymous object
item = myDataGrid.selectedItem
puts "#{item.Product} costs $#{item.Price} (#{item.Quantity} left in stock)"
end
# You can rename column names by index
myDataGrid.getColumnAt(0).headerText = "Product Name";
myDataGrid.getColumnAt(1).headerText = "Price";
myDataGrid.getColumnAt(2).headerText = "Quantity Left";
flash.new_component("mx.controls.Button", :label=>" Close",
:_x=>380, :_y=>89, :_width=>120, :_height=>35,
:icon=>"icon_16x16_warning") do |closeButton|
closeButton.click do
frame.control.close
exit
end
end
frame.control.show app.wait_until_done
Pretty sweet eh?
Go download it, and let me know what you think.
From what I read on the wiki it appears that the examples only work with the stand alone Flash Projector. Is there an easy way to get this to work on the web as well? Or does that already work?
Just curious, I haven't tried the examples on my own machine yet but will give it a go very soon. This has great potential!
Posted by: Wally Atkins | Tuesday, October 05, 2004 at 09:42 AM
This works on the standalone player/projector I created. The Web thing is easy though, I will likely post how to do that soon (the current code is focused on local execution).
Posted by: Richard Kilmer | Tuesday, October 05, 2004 at 12:11 PM
Hi sounds really interesting I was trying to work out how to get ming/ruby running and came accoss this, not yet done any ruby yet but it is installed on my pc under XP and I have the pixaxes 2 book can you give me a really simple explaination into getting this running on my local machine?
Many thanks
Justin
Posted by: JLM | Sunday, November 28, 2004 at 07:16 PM
I could not get the required SWT runtime from eclipse.org.
Where do I get this? Do I need to have Eclipse installed ?
Posted by: anon | Tuesday, November 30, 2004 at 06:33 PM
This project sounds really interesting. I just got started with doing ActionScript for work, but I'd like to work with Ruby instead. I installed the JRE1.4, SWT runtime and the other components, but I run the examples I get an exception about the "Browser" class being undefined on line 72 of Obsidian.java. Do I have to have Eclipse SDK installed? Also, in the latest SWT runtime "swt-pi.jar" doesn't exist.
Posted by: Don Quach | Wednesday, December 08, 2004 at 04:12 PM
Hi,
The Alph project looks and sounds great! Would it be possible to use this with the Ruby Application framework "Arrow"? Would it be possible to access code libraries that a flashprojector/flash web player imports? I think when that works one could build powerful Webservice applications with Alph. I wish you luck on this project, keep it up!
Sharriff
Posted by: Sharriff | Sunday, February 20, 2005 at 02:22 PM
This looks incredibly promising as well as wicked cool, but the wiki is hosed. Can you provide an alternate download link? I just found Ruby and ROR the past couple weeks, but I primarily develop desktop and rich client apps. This would totally be something I could use!
Posted by: Jason Foreman | Tuesday, March 29, 2005 at 04:54 PM
the alph wiki has been spammed. are you stil working on this project?
Posted by: oliver oli | Monday, July 25, 2005 at 09:54 AM
Rich, this looks great - unbelievably seems to have passed with little note in the Macromedia development community. let me know if/how we can help with this project.
Thanks,
Robin
Posted by: Robin Hilliard | Tuesday, August 09, 2005 at 09:33 AM
I'd be very interested in looking at this, but alph.rubyforge.net is very broken. Where is the download now?
Posted by: Mike Pearson | Wednesday, April 12, 2006 at 09:23 AM
The wiki on rubyforge is completely spammed. I tried to reverse a revision, but it seems the spammers managed to remove these too.
Posted by: Bèr | Monday, May 15, 2006 at 05:46 AM
I'm always into discussions on anything organic, so this read made me feel at home.
I'll bookmark the site and subscribe to the feed!
Posted by: Acai Berry Detox | Sunday, August 24, 2008 at 04:34 PM