-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined Property onInit using animate cc #59
Comments
Please mark this as a question, I cant seem to find where i am going wrong full code below import com.leapmotion.leap.events.LeapEvent; var controller = new Controller(); controller.addEventListener( LeapEvent.LEAPMOTION_INIT,onInit ); function onFrame( event:LeapEvent ):void
|
is there a space before oninit in the code?
…On Thu, Oct 19, 2017 at 6:24 AM, Anthony Lombard ***@***.***> wrote:
Please mark this as a question, I cant seem to find where i am going wrong
full code below
import com.leapmotion.leap.events.LeapEvent;
import com.leapmotion.leap.Frame;
import com.leapmotion.leap.Hand;
import com.leapmotion.leap.Finger;
import com.leapmotion.leap.Vector3;
import com.leapmotion.leap.util.LeapUtil;
import com.leapmotion.leap.Controller;
import com.leapmotion.leap.Listener;
var controller = new Controller();
trace(controller);
controller.addEventListener( LeapEvent.LEAPMOTION_INIT,onInit );
controller.addEventListener( LeapEvent.LEAPMOTION_CONNECTED, onConnect );
controller.addEventListener( LeapEvent.LEAPMOTION_DISCONNECTED,
onDisconnect );
controller.addEventListener( LeapEvent.LEAPMOTION_EXIT, onExit );
controller.addEventListener( LeapEvent.LEAPMOTION_FRAME, onFrame );
function onFrame( event:LeapEvent ):void
{
trace("On Frame");
// Get the most recent frame and report some basic information
var frame:Frame = event.frame;
trace( "Frame id: " + frame.id + ", timestamp: " + frame.timestamp + ",
hands: " + frame.hands.length + ", fingers: " + frame.fingers.length + ",
tools: " + frame.tools.length );
if ( frame.hands.length > 0 )
{
trace("hand if function");
var hand:Hand = frame.hands[ 0 ];
// Check if the hand has any fingers
var fingers:Vector.<Finger> = hand.fingers;
if ( fingers.length > 0 )
{
// Calculate the hand's average finger tip position
var avgPos:Vector3 = Vector3.zero();
for each ( var finger:Finger in fingers )
avgPos = avgPos.plus( finger.tipPosition );
avgPos = avgPos.divide( fingers.length );
trace( "Hand has " + fingers.length + " fingers, average finger tip position: " + avgPos );
}
// Get the hand's sphere radius and palm position
trace( "Hand sphere radius: " + hand.sphereRadius + " mm, palm position: " + hand.palmPosition );
// Get the hand's normal vector and direction
var normal:Vector3 = hand.palmNormal;
var direction:Vector3 = hand.direction;
// Calculate the hand's pitch, roll, and yaw angles
trace( "Hand pitch: " + LeapUtil.toDegrees( direction.pitch ) + " degrees, " + "roll: " + LeapUtil.toDegrees( normal.roll ) + " degrees, " + "yaw: " + LeapUtil.toDegrees( direction.yaw ) + " degrees\n" );
}
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#59 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADjNWrZJDVEQJ0iQDpNdcM0dQObZ8yuyks5st02SgaJpZM4P_OFC>
.
|
As the title states Iam getting this error on this line
controller.addEventListener( LeapEvent.LEAPMOTION_INIT,onInit );
The text was updated successfully, but these errors were encountered: