Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

phidget and AS3

New Here ,
Jan 19, 2013 Jan 19, 2013

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);

                    }

}

}

TOPICS
ActionScript
704
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Jan 19, 2013 Jan 19, 2013

Here it says the Syntax should be:

                              trace (evt.Data);

                              trace(evt.Index);

Translate
Guru ,
Jan 19, 2013 Jan 19, 2013

Here it says the Syntax should be:

                              trace (evt.Data);

                              trace(evt.Index);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 19, 2013 Jan 19, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 20, 2013 Jan 20, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 20, 2013 Jan 20, 2013
LATEST

You're welcome and good luck!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines