Products for USB Sensing and Control
It is currently Mon May 20, 2013 9:41 pm

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Wed Jul 25, 2012 4:51 pm 
Offline
Phidgetsian

Joined: Wed Jul 25, 2012 1:24 pm
Posts: 12
(posted this here as well in case the Mac forum wasn't appropriate)

Tearing my hair out here. I keep getting the following error when I compile my flash file from within CS5:

Quote:
Phidget Error Event: Error #2031: Socket Error. URL: localhost


I've triple checked that my webservice is running. I've added the flash file to the list of trusted locations in flash global security settings. But continue to receive this error. I'm running Mac OSX 10.7.4.

Here's my code:

Code:

public var phid:PhidgetInterfaceKit;
      
      public function PhidgetTest() {
         
         addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
         
      }
      
      public function onAddedToStage(e:Event):void {
         trace("Added to stage");
         removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
         phid = new PhidgetInterfaceKit();
         
         phid.addEventListener(PhidgetErrorEvent.ERROR, onError);
         phid.addEventListener(PhidgetEvent.DETACH,   onDetach);
         phid.addEventListener(PhidgetEvent.ATTACH,   onAttach);
         phid.addEventListener(PhidgetEvent.CONNECT,   onConnect);
         phid.addEventListener(PhidgetEvent.DISCONNECT,   onDisconnect);
         
         phid.open("localhost", 5001);
         
         tracesensor_btn.addEventListener(MouseEvent.CLICK, onTraceSensor);
         tracesensor_btn.buttonMode = true;
      }
      
      public function onTraceSensor(e:MouseEvent):void {
         trace(phid);
         //output_txt.appendText( "TRACE DEVICE: " + phid.Device.Name + ", Serial Number: " + phid.Device.serialNumber.toString() + "\n" );
         output_txt.appendText("PHID: " + phid + "\n");
      }
      
      public function onError(e:PhidgetErrorEvent):void {
         trace("**ERROR**: " + e);
         output_txt.appendText("**ERROR**: " + e);
      }
      
      public function onAttach(e:PhidgetEvent):void {
         
         trace("ATTACH: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
         output_txt.appendText( "ATTACH: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
      }
      
      public function onDetach(e:PhidgetEvent):void {
         
         trace("DETACH: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
         output_txt.appendText( "DETACH: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
      }
      
      public function onConnect(e:PhidgetEvent):void {
         
         trace("CONNECT: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
         output_txt.appendText( "CONNECT: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
      }
      
      public function onDisconnect(e:PhidgetEvent):void {
         
         trace("DISCONNECT: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
         output_txt.appendText( "DISCONNECT: " + e.Device.Name + ", Serial Number: " + e.Device.serialNumber.toString() + "\n" );
      }



Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group