That tutorial has been one of the most popular things I have written for IBM. So it made sense to update it this year. The tutorial used Firefox 3 as a XUL runtime. When I wrote it, Firefox 3 was in alpha stage. Obviously it has been released since then and is in wide use. So the opportunity for web developers to use XUL to create desktop applications is greater than ever. This week IBM published the updated tutorial, so go check it out.
Showing posts with label air. Show all posts
Showing posts with label air. Show all posts
Wednesday, November 05, 2008
You Want XUL, You Got XUL
Monday, June 09, 2008
Gears and Flash
This was not too hard. It is just a matter of using ExternalInterface to create a bridge between the two worlds. I wrote a quick POC, using a simple DB table for storing name/value pairs. I think it would be fun to re-implement the flash.data package that is normally only available in AIR apps...
Here is the JavaScript code:
function dbCall(sql, args){
var db = google.gears.factory.create('beta.database');
var rs = null;
try{
db.open('database-test');
db.execute('create table if not exists little_table (key varchar(20), value varchar(100))');
rs = args ? db.execute(sql, args) : db.execute(sql);
data = [];
while (rs.isValidRow()){
row = {};
for (var i=0;i<rs.fieldCount();i++){
var name = rs.fieldName(i);
row[name] = rs.field(i);
}
data.push(row);
rs.next();
}
return data;
} finally {
rs.close();
}
}
Here is the ActionScript code:
import flash.external.ExternalInterface;
[Bindable]
private var rs:Array = [];
private function load():void{
rs = ExternalInterface.call('dbCall', 'select * from little_table');
}
private function save():void{
var key:String = keyIn.text;
var value:String = valueIn.text;
ExternalInterface.call('dbCall', 'insert into little_table values(?,?)', [key, value]);
keyIn.text = "";
valueIn.text = "";
load();
}
private function clearData():void{
ExternalInterface.call('dbCall', 'delete from little_table');
load();
}
And here is the MXML I used to test it out:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="load()">
<mx:DataGrid x="202" y="59" id="grid" dataProvider="{rs}">
<mx:columns>
<mx:DataGridColumn headerText="Key" dataField="key"/>
<mx:DataGridColumn headerText="Value" dataField="value"/>
</mx:columns>
</mx:DataGrid>
<mx:Label x="10" y="251" text="Key"/>
<mx:TextInput x="74" y="249" id="keyIn"/>
<mx:Label x="242" y="251" text="Value"/>
<mx:TextInput x="285" y="249" id="valueIn"/>
<mx:Button x="460" y="249" label="Save" click="save()"/>
<mx:Button x="243" y="298" label="Clear" click="clearData()"/>
</mx:Application>
Labels:
actionscript,
air,
flash,
flex,
google gears,
javascript,
ria
Wednesday, March 12, 2008
JsonViewer Updated
I updated Flex Builder 3 to the GA version and updated AIR to 1.0. I imported the old project. It picked up my Subversion settings and what not, very nice. I did a new "export release version" and it worked just fine. I tried to execute the .air file and it bombed. It told me that my AIR file was damaged.
WTF!? I tried to run the app directly from Flex Builder. It did nothing. No errors, just nothing. So I tried debugging. Then I finally got an error message about using the wrong version of AIR. I opened up the JsonView-app.xml. There was no "setting" in here for AIR version, but then I saw this
<application xmlns="http://ns.adobe.com/air/application/1.0.M6">
Yep the .M6 was killing me. I removed it from the XML namespace declaration, and voila! Everything worked perfectly. Show your appreciation for my pain by downloading JsonViewer.
Tuesday, February 12, 2008
New Version of JsonViewer: Now Open Source!
So you can get the latest version here, or you can check out the source code for yourself. I was almost embarrassed to show the source because it so trivial!
Wednesday, October 17, 2007
New IBM Tutorial on XUL
Monday, October 01, 2007
eBay Desktop
Subscribe to:
Posts (Atom)