Migrated to GitLab https://gitlab.com/logotype/LeapMotionAS3
logotype / leapmotionas3 Goto Github PK
View Code? Open in Web Editor NEWLeap Motion AS3 API.
Leap Motion AS3 API.
change use getDefinitionByName:
private static function getNativeApplicationClassReference():*
{
try
{
return getDefinitionByName("flash.desktop.NativeApplication");
}
catch(error:Error)
{
trace("[LeapNative] getNativeApplicationClassReference: " + error.message);
}
return null;
}
//-----------------------------------------------------------------
var NativeApplicationClass:* = getNativeApplicationClassReference();
if(NativeApplicationClass)
{
NativeApplicationClass.nativeApplication.addEventListener("exiting", onNativeApplicatonExitHandler );
}
Hi,
I've been a Flash dev for a couple of years, but I'm a complete Leap/socket newbie so forgive if the answer is obvious.
I have been working on Windows so far and everything worked fine.
I switched to Mac (OSX 10.8.3) a couple of weeks ago and have been trying to solve this issue but with no success.
I work on Flash Pro CS5.5, Flash Player 11.6 and Flex SDK 4.6.0.
When compiling (in the debug mode, regular compiling uses the old Flash Player without JSON support) the app does not work and I get the following runtime errors:
[LeapNative] tryCreatingExtensionContextClassReference: Error #1065: Variable ExtensionContext is not defined.
SecurityError: Error #2010: Local-with-filesystem SWF files are not permitted to use sockets.
at flash.net::Socket/internalConnect()
at flash.net::Socket/connect()
at flash.net::Socket()
at com.leapmotion.leap.socket::LeapSocket()
Any ideas what might help and how I can get this to work?
Cheers!
Matt
I few times Im have found the web socket connection created by flash unable to carry on.
The flash parser assumes there will never be larger than a 16 bit exteneded header length.
" The length of the "Payload data", in bytes: if 0-125, that is the
payload length. If 126, the following 2 bytes interpreted as a
16-bit unsigned integer are the payload length. If 127, the
following 8 bytes interpreted as a 64-bit unsigned integer (the
most significant bit MUST be 0) are the payload length."
Also, the flash socket does not handled fragmentation.
http://tools.ietf.org/html/rfc6455#section-5.4
Ive been using browser websockets but would like to use AIR and this library would help. However, the stability is an issue due to issue number 1 above. Review of the code brings out issue number 2. Somewhere I have some bit-shift code related to this. Ill see If I can dig it up and translate it to as3.
I have Win7 x64 system, and latest SWC libraries is not working.
Even when I try to attach it (LeapMotionAS3.swc) to "browser-sample" fla, there is only "Initialized" string appears, and nothing more. When I attach LeapMotionAS3-asc2.swc, which is located in "browser-sample" folder, everything is fine, as well as in my own project. The problem is LeapMotionAS3-asc2.swc is pretty old version of library, so many methods and properties in API is absent.
Also, when I am trying to use LeapMotionAS3.ane (i tried do it in Flash CC), nothing good happen at all - the console logs that :Controller can not be found. When I tried to use it in AIR project in Flash Builder 4.7, i got error when trying to compile:
Probably it caused by 64-bit version of FB4.7, now i am trying to use 32-bit version.
So, the only way now for me to make everything work is using old LeapMotionAS3-asc2.swc, but it is OLD. May be anyone can compile new LeapMotionAS3 with asc2 (may be it will solve problem)? Or may be you can describe me how to do it on Windows, I am new to such kind of tasks, but I can try it.
Hi Guys,
i just purchased the leapmotion controller and i'm ready start buiding apps for educational purposes.
Now for the hard part. I need an simple start in native gestures working with flash.
for example. Much of my apps use a click to drag gesture. Is there a way to compile this on a gesture from Leapmotion.?
An easy tutorial would be helpfull.
Many thanks in advance
NEW NOTE: More better solution, if available; an codefragment in a .xml file i can import in flash codefragments.
MANY Thanks!
Paul
Bug filed at Adobe bugbase:
https://bugbase.adobe.com/index.cfm?event=bug&id=3511904
Adding this as an issue here so we keep this on record.
interested in combining this ANE and the Oculus Rift ANE to make some crazy experiences.
did u test performance of creating as3 class object on native side versus writing data to shared ByteArray object on native side and then read it back and fill preallocated class instance with data on as3 side? my guess would be that second idea is faster...
controller.enableGesture( Gesture.TYPE_SWIPE,false );
why the parse above dosen't work?
hi,
i making a app with leapmotion.
and an error message dialog occurs when i run the app.
the error is "Not found Leap.DLL...blah..blah"
but, leap motion is correctly work in the app.
before that,
when i debug in Flash CC, occurs some error that is
[LeapNative] Leap Motion Native Extension is not supported.
[LeapNative] If you are on Windows, add the Leap Motion software folder to your PATH.
[LeapNative] Falling back on Socket implementation.
but, leap motion is correctly work. too.
i did set the system variables and all settings along guide.
OS : windows7 64bit
IDE : Flash CC
AIR : AIRSDK13
and using ac2 version ane.
please help!! if i can't solve this error, i was kill by my boss.
Hi guys,
"You can use this library on both web and AIR projects. If you are using it on an AIR for Desktop project, you can take advantage of the AIR Native Extension."
If I compile it without ANE (using the SWC), I am getting random behavior - The frame events do not seem to fire. Init and Connect do fire alright but the Frame does not. This happens in approx 80% of time (meaning = from 5 app launches it doesn't fire any frame in 4 app launches, it does fire all the frames in 1) I have to restart the application and hope it will do then. Any ideas why this happens? I cannot fire it manually either with controller.frame(). Nothing happens.
Thanks!
This is needed when using protocol 2 to suppress OS integration. Defaults to 100msecs. Look into adding an option to configure this.
When quitting an application (using AIR 3.9), the extension context is disposed twice.
Error: Error #3501: The extension context has already been disposed.
This error triggers in run/debug the project when I want to use the config() or screen() classes, just like:
private function onConnect(event:LeapEvent):void{
trace("Controller connected");
controller.enableGesture(Gesture.TYPE_SWIPE);
controller.enableGesture(Gesture.TYPE_SCREEN_TAP);
if(controller.config().setFloat("Gesture.Swipe.MinLength", 200.0) && controller.config().setFloat("Gesture.Swipe.MinVelocity", 500)) controller.config().save();
if(controller.config().setFloat("Gesture.ScreenTap.MinForwardVelocity", 30.0) && controller.config().setFloat("Gesture.ScreenTap.HistorySeconds", .5) && controller.config().setFloat("Gesture.ScreenTap.MinDistance", 1.0)) controller.config().save();
//etc...
}
The complete output:
Error: Native Context not available. The Config class is only available in Adobe AIR.
at com.leapmotion.leap::Config()[/Users/logotype/Documents/Work/Repositories/LeapMotionAS3/src/com/leapmotion/leap/Config.as:129]
at com.leapmotion.leap::Controller/config()[/Users/logotype/Documents/Work/Repositories/LeapMotionAS3/src/com/leapmotion/leap/Controller.as:495]
at objects::DestroyableSpriteLeap/onConnect()[C:\Users\CASA\Documents\00_INTERACTIVE\LEAP\Gamelabs\src\objects\DestroyableSpriteLeap.as:171]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.leapmotion.leap.interfaces::DefaultListener/onConnect()[/Users/logotype/Documents/Work/Repositories/LeapMotionAS3/src/com/leapmotion/leap/interfaces/DefaultListener.as:17]
at com.leapmotion.leap.socket::LeapSocket/readLeapMotionHandshake()[/Users/logotype/Documents/Work/Repositories/LeapMotionAS3/src/com/leapmotion/leap/socket/LeapSocket.as:711]
at com.leapmotion.leap.socket::LeapSocket/onSocketDataHandler()[/Users/logotype/Documents/Work/Repositories/LeapMotionAS3/src/com/leapmotion/leap/socket/LeapSocket.as:245]
I am using Flashdevelop and Starling in this project.
The Flashdevelop template is AS3 Projector.
I place the ANE file directly in the root folder of my project and add it to the library (right click/add to library).
Any thoughts?
Thanks for your help!
Adobe's site lists this extension as being for the following devices
iOS/Android/Windows/Mac OSX
I presume Adobe have got it wrong, as this repo only seems to contain implementations for OSX and Windows.
I don't need to use this extension, I was just reviewing what ANE's were available for which platform. So if this ANE is not for iOS or Android, perhaps you can tell Adobe (not that they are renowned for responding to any form of communication :-( )
Same issue as before. The moment i set Controller.POLICY_IMAGES or any other policy i constantly get connect/disconnect traces. The example with the bitmaps never shown any.
When i don't set the policy i get tracking but the number of fingers is always reporting 5 (for 1 hand) even when i make a fist. the number of hands does work.
I'm on Windows, compiling with Air 15, setting the inline and swf version command lines.
added both the leap dll's to AIR 15's bin folder.
Could it be a windows thing? are you testing on Windows?
I'm in native mode (not trough a socket or something)
_controller.setPolicyFlags(Controller.POLICY_OPTIMIZE_HMD);
when i put in above code with that or any other policy it makes things fail.
the debug log shows a constant
...
LNLeapListener::ServiceConnect
LNLeapListener::ServiceConnect
LNLeapListener::ServiceDisconnect
LNLeapListener::ServiceDisconnect
....
And i don't get any frame events.
I would like to get the bitmap data from the ir camera and set HMD mode.
am i doing anything wrong?
Thanks!
Hola, agradecer primero por la librería, quería hacer una consulta y es la siguiente 👍
yo estoy recuperando la posición x "stabilizedTipPosition.x", si muevo mi dedo a la izquierda puedo mover el cursor que he implementado a la izquierda, si muevo a la derecha el cursor tambien se mueve a la derecha.
Cuando yo recupero la posición Y "stabilizedTipPosition.y" si muevo mi dedo arriba, el cursor que implemente se mueve hacia abajo, y si muevo mi dedo hacia abajo, el cursor que implemente se mueve hacia arriba.
I can't seem to get the newest version of this working with AIR, because the ThrottleEvent and related classes are not available. Anyone else run into this and figure out how to get around it?
hi !
thanks for this project !
i recompiled it for x64 AIR on Windows, thought i'd share it.
use x86 DLLs for debug and x64 for release
MacOS support not included
LeapMotion_AS3_x64.zip
I always get the message "The content cannot be loaded because there was a problem loading an extension: Error: Requested extension com.leapmotion.leap.air.native.LeapNative is not supported for MacOS-x86." when I am trying to test the movie. When I go into the extracted files and change the MacOS-x86-64 to MacOS-x86 in both the xml and the folder name everything is running fine.
Problem is I can't compile it in the end, it then comes up with the same message again.
Mac OS X 10.10.3 (14D136)
Flash 2015.0 15.0.0.173
AIR 18.0.0.143
why that happenned when i run my project?
it happenned after several minutes. this is the output
SyntaxError: Error #1132: Invalid JSON parse input.
at JSON$/parseCore()
at JSON$/parse()
at com.leapmotion.leap.socket::LeapSocket/onSocketDataHandler()[/Users/logotype/Documents/Repositories/LeapMotionAS3/src/com/leapmotion/leap/socket/LeapSocket.as:301]
I build .swf for using in KRPano plugin, and everything works fine when I launch the tour (and hence included swf plugin for Leap interaction) just by executing .swf file from my PC. But if I put it in local server (WAMP) or remote server (web-hosting), the plugin is not working. It lauch, but the only event which is called - LeapEvent.LEAPMOTION_DISCONNECTED. I checked the similar thing happens when I create new Controller with wrong IP (not default or localhost or 127.0.0.1). So I think the problem is when my SWF trying to connect to Leap Device from server, it can not connect to my computer.
Does anyone have any minds about this problem? May be someone faced similar problem?
Hi,
I've noticed that I start receiving Error #2002: Operation attempted on invalid socket.
when sending the heartbeat while the Leap device is disconnected. This happens after one minute or so, probably because the write buffer is full.
The stack trace is uninteresting:
Error: Error #2002: Operation attempted on invalid socket.
at flash.net::Socket/writeBytes()
at com.leapmotion.leap.socket::LeapSocket/sendUTF()[.../LeapMotionAS3/src/com/leapmotion/leap/socket/LeapSocket.as:771]
at com.leapmotion.leap.socket::LeapSocket/onSendHeartBeatHandler()[.../LeapMotionAS3/src/com/leapmotion/leap/socket/LeapSocket.as:170]
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
Note that the socket is marked as not connected when this happens (as expected).
This does not prevent the library from working in release build, but that's inconvenient. I'll make a pull request that exits sendUTF
when the socket is not connected if that's fine.
Gestures are working without enable and isRight and isLeft methods are not working
The instantaneous framerate.
The rate at which the Leap Motion software is providing frames of data (in frames per second). The framerate can fluctuate depending on available computing resources, activity within the device field of view, software tracking settings, and other factors.
Note to self:
Retarded error, forgot to assign the value!
1.all of bin files have been copyed to C:\windows folder;
2.there are two ane files, each one can run without error,but not connect;
3.then , with no ideas , I try to rebuilder the dll & the ane file ,also,failed...
fb 4.6
os win7 32
anyone who really really run successful????? what did i missed??
please help me ......
As the title states Iam getting this error on this line
controller.addEventListener( LeapEvent.LEAPMOTION_INIT,onInit );
[Fault] exception, information=TypeError: Error #1010: A term is undefined and has no properties.
LeapStocket.as
final private function parseJSON( json:Object ) :void ->
pointable.btipPosition = new Vector3( json.pointables[ i ].btipPosition[ 0 ], json.pointables[ i ].btipPosition[ 1 ], json.pointables[ i ].btipPosition[ 2 ] );
pointable.btipPosition is null.
The touchDistance attribute of pointable objects is not pulled in properly because it is referred to as pointable.touchDist but it should be pointable.touchDistance
I no longer get gesture data, neither in the Samples or in new projects.
I'm trying to get the Image API to work, but when running in Socket mode I only get an empty array. I assume I need the ANE to work for the Image API to function?
This brings me to my second problem: when trying to run an app with the ANE, I get the same issue which was posted previously regarding not being supported by MacOS-x86, but rather MacOS-x86-64.
I've tried with the AIR 18 runtime (stable), AIR 19 (beta), AIR 19 - 64 bit (beta, requested from Adobe) - all with the same result. I've also tried the previous version of the ANE - which compiles, but with an empty image array just like with the socket implementation. Perhaps the Image API wasn't added in that version of the ANE?
I'm using Adobe Flash Builder 4.7 to build the app on a Mac running OS X Yosemite.
I've got access to the cameras using the official Objective-C wrapper so there doesn't appear to be a technical fault with the device.
Is it possible to upload a new ANE which is compatible with the latest GM version of AIR? Or am I doing something else wrong?
Thanks!
I'm noticing some issues utilizing the algorithm in the source samples set for converting points in the leap coordinate space to points in other coordinate spaces. I've tried with both a flash project utilizing the stage coordinate space and also starling coordinate space.
It seems like when the resolution is set higher (I'm creating an adobe air app that outputs to a tv at 1920x1080 resolution) that I'm getting clipping problems. The points don't seem to span the entire screen. I've tried to account for that by adjusting the X sensitivity as the finger moves up and down the Y axis (given that the device FOV is an inverted pyramid). It helps a little but not perfect. Is there an issue possibly with the algorithm that is shown in the sample set?
Hi
Could anyone help look into compiling the binary? In Xcode, I get the following errors (for all Adobe AIR header files):
Undefined symbols for architecture x86_64:
"_FREAcquireBitmapData", referenced from:
leapnative::LNLeapDevice::getFrame() in LNLeapDevice.o
"_FREDispatchStatusEventAsync", referenced from:
...
...
Check the dev branch and the Xcode project in native/osx-xcode/LeapNative.xcodeproj
Thanks
Steps: Create a pure AS3 project and run a trace in the frame event handler when two hands are in view:
trace("two hands",frame.hands[0].id,frame.hands[1].id);
Observation: The id will change even though both hands remain in view.
Expectation: The ids will persist to allow hands to cross over by tracking ids instead of X position.
*I'm not sure if this is on the extension side or on Leap's SDK. I've logged a bug with them as well.
The amount of seconds a hand or pointable has been tracked for. This can be used for filtering or for fading in visual feedback.
When either closing the window or calling NativeApplication.nativeApplication.exit() in OSX, ADL crashes. Happens with the Sample.as file. Haven't checked with the others.
Here's a crash log
https://docs.google.com/document/d/1roJtR_JVkzpvEc6LAdw-7pbHzsoTh3IA0yJ3bFAXGSI/edit
Hi there,
I get "[LeapNative] Leap Motion Native Extension is not supported" when trying to run an example. The app starts well (no compilation error), meaning that the ANE is correctly embedded.
I've added the Leap Motion folder (C:\Program Files (x86)\Leap Motion) to my PATH (User and System).
Environment:
My app.xml contains:
<initialWindow> ...</initialWindow>
<supportedProfiles>extendedDesktop</supportedProfiles>
<extensions>
<extensionID>com.leapmotion.leap.air.native.LeapNative</extensionID
</extensions>
Any help would be much appreciated!
"Native Context not available. The Screen class is only available in Adobe AIR."
With Apple's new policy of all apps being 32 and 64 bit compatible, do you have any plans to update the ANE to support this? It would be much appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.