Copy link to clipboard
Copied
Hi all,
I am trying to move my game characters using phidgets.
I have the following code but got these error messages when I run it.
1119: Access of possibly undefined property data through a reference with static type com.phidgets.events:PhidgetDataEvent.
1119: Access of possibly undefined property index through a reference with static type com.phidgets.events:PhidgetDataEvent.
Cant figure out where the problem is from. I need help
Another question is: How can i access the sensors connected to a phidget?
package{
import com.phidgets.events.*;
import com.phidgets.*
public class spacegame extends MovieClip
{
public var phid:PhidgetInterfaceKit;
public function spacegame()
{
phid = new PhidgetInterfaceKit();
phid.open("localhost", 5001);
phid.addEventListener(PhidgetDataEvent.SENSOR_CHANGE, onSensorChange);
}
public function onSensorChange(evt:PhidgetDataEvent):void
{
trace (evt.data);
trace(evt.index);
}
}
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
A static class reference means you don't need to make an instance of a class and you can directly use the class.
e.g. a class isntantiation (not what you need:
var someClass:aClass = aClass();
someClass.propertyName = 123;
That's accessing normal NON-static properties.
Your errors are saying your properties are static. Therefore you'd access them via:
var myNumber:Number = SomeClass.someStaticNumber;
var myString:String = SomeClass.someString;
var myObject:Object = SomeClass.someObject;
Chance the class and tyoe names to your taste.
Copy link to clipboard
Copied
I have sorted it out. Now I can move my game character. Thanks to you both.
Will definitely give you a shout out if im stuch again.
Copy link to clipboard
Copied
You're welcome and good luck!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now