Marcos is Currently...
- @s9i これは見てないでしょ: http://snurl.com/62ibe | 19 hours ago
- About to present at fitc unconference at max | Yesterday
- @ Max, keynote is rocking. Our demo is about to go live. | 3 days ago
- Setting up our demos backstage of MAX. Whole setup and logistics for this event are quite impressive. | 5 days ago
- lovin' ajax. hacked up a dojo livesearch widget in no time. will post source soon. | 4 weeks ago
shared items in Google Reader
- John Oliver and John King’s Magic Wall | Yesterday
- Google Hosts 10 Million Historic Time-Life Photos [Google] | 2 days ago
- Emergence Project: Representing a Textual Discourse | 2 days ago
- fLux Binary Waves: Urban Visualization Installation | 2 days ago
- Let the computer figure out your cutlist | 3 days ago
recent photos on flickr
recent trips
- Returned from a trip to Seoul. | last month
- Started a trip to Seoul. | last month
- Finished a trip to Toronto. | April 2008
- Started a trip to Toronto. | April 2008
- Finished a trip to Montevideo. | March 2008
news / Phidgets AS3
July 17, 2006
Phidgets AS3

Here's an Alpha AS3 rewrite of the AS2 phidgets Library. It's still very early on the developing process, but I thought I'd give everyone who might be interested a quick peek of what you can do with it.
download:
Source and Samples (756 kb)
SWC (Compiled code) (38kb)
you will need to have installed Phidgets.msi and have the PhidgetWebService running in order to properly connect to your phidgets. PhidgetWebService is a super light socket server to which your flash application connects to in order to properly send and receive data from all phidget components. To install Source and Samples in Flex Builder I'd really recommend you to simply choose file> Import > Archive File > Choose the zip you just downloaded If you want to go the SWC way, which is probably simpler, just create a new AS3 project in Flex Builder, Choose a name click next, and on the Library Path Tab click [ add SWC... ] and choose the location of the PhidgetLibrary.swc you just downloaded. Things are still very dirty, If you have any suggestions on how to improve the code, please let me know. I've done my best to resemble the original AS2 API as close as I could. Still, I took the liberty of creating extra objects that allow for even easier Phidget management. There's no documentation at all yet, but there's plenty of samples to dig and learn how to use most of them. If anyone out there wants tp give me a hand with docs I'd really appreciate it. I'll try in the following days to write up some simple tutorials, so if you can't deal with the samples, patience. code sample after the jump.
here's a very simple sample on how to connect and set a servo rotation.
package {
import com.phidgets.*;
import com.phidgets.events.*;
import flash.display.Sprite;
import flash.events.MouseEvent;;
public class PhidgetServoTest extends Sprite {
private var servoControl :PhidgetServoControl;
private var servo :PhidgetServo;
public function PhidgetServoTest() {
servoControl = new PhidgetServoControl();
servoControl.addEventListener(PhidgetEvent.CONNECT, onConnect);
servoControl.connect("localhost",5001,"pass");
}
private function onConnect(evt:PhidgetEvent):void{
trace("onConnect");
servo = servoControl.getServo(0);
stage.addEventListener(MouseEvent.MOUSE_DOWN,onMouseDown);
}
private function onMouseDown(evt:MouseEvent):void{
servo.rotation = Math.floor(Math.random()*180);
}
}
}
[ What Are Phidgets?
Phidgets are an easy to use set of building blocks for low cost sensing and control from your PC. Using the Universal Serial Bus (USB) as the basis for all Phidgets, the complexity is managed behind an easy to use and robust Application Programming Interface (API). Applications can be developed quickly in Visual Basic, VBA (Microsoft Access and Excel), LabView, Java, Delphi, C and C++. ]
... and AS3 now of course!
I should probably mention all phidgets you see in the image above where an awesome present by Teiichi. After I told him how I almost cry after realizing my original Phidget Box was lost somewhere inbetween Tokyo and Milan, 3 days later he dropped by with a new kit under his arm. Thank you so much!
Alright, so here you go.
Happy Hacking!



















