# sharmaamit/leapmotionas3 architecture

> Architecture diagram of the GitHub repository sharmaamit/leapmotionas3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sharmaamit/leapmotionas3
- Repository: https://github.com/sharmaamit/leapmotionas3

## Overview

LeapMotionAS3 is an ActionScript 3 client framework for Leap Motion tracking, with an optional AIR Native Extension and a socket fallback. The principal workflow is application code creating a Controller, receiving lifecycle/frame events, and consuming typed Frame and hand/pointable/gesture data. The README also documents configuration, calibrated-screen/device queries, and gesture support. Native excerpts show FRE dispatch and device serialization; ActionScript implementation details were not sampled, so links beyond documented behavior are omitted or marked unverified.

Main entry points: [`src/com/leapmotion/leap/Controller.as`](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Controller.as) (Controller), [`src/com/leapmotion/leap/Frame.as`](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Frame.as) (Frame Data), [`native/src/LNLeapDevice.cpp`](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNLeapDevice.cpp) (Native Device), [`native/src/LNExtension.cpp`](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNExtension.cpp) (FRE Dispatcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_as3["ActionScript API"]
  node_controller["Controller<br/>[Controller.as]"]
  node_listener["Listener Callbacks<br/>[Listener.as]"]
  node_events["Leap Events<br/>[LeapEvent.as]"]
end

subgraph group_features["Tracking Features"]
  node_frames["Frame Data<br/>[Frame.as]"]
  node_hands["Hands And Fingers<br/>[Hand.as]"]
  node_pointables["Pointables And Tools<br/>[Pointable.as]"]
  node_gestures["Gesture Types<br/>[Gesture.as]"]
  node_screens["Screen Queries<br/>[Screen.as]"]
  node_devices["Device Queries<br/>[Device.as]"]
  node_config["Configuration<br/>[Config.as]"]
end

subgraph group_native["AIR Native Extension"]
  node_native_as["Native Bridge<br/>[LeapNative.as]"]
  node_extension["FRE Dispatcher<br/>[LNExtension.cpp]"]
  node_native_device["Native Device<br/>[LNLeapDevice.cpp]"]
  node_native_listener["Native Listener<br/>[LNLeapListener.cpp]"]
  node_fre_util["FRE Conversion<br/>[LNFREUtilities.h]"]
  node_fre_api["FRE API"]
end

subgraph group_support["Transport And Math"]
  node_socket["Socket Transport<br/>[LeapSocket.as]"]
  node_socket_frame["Socket Frame Decode<br/>[LeapSocketFrame.as]"]
  node_math["Vector And Math<br/>[Vector3.as]"]
end

node_app(("Application"))
node_leap_service(("Leap Motion Runtime"))
node_air_runtime(("AIR Runtime"))

node_app -->|"creates"| node_controller
node_app -->|"handles"| node_events
node_controller -->|"dispatches"| node_events
node_events -->|"carries"| node_frames
node_frames -->|"exposes"| node_hands
node_frames -->|"exposes"| node_pointables
node_frames -->|"exposes"| node_gestures
node_controller -->|"supports callbacks"| node_listener
node_controller -.->|"may use"| node_native_as
node_controller -.->|"falls back to"| node_socket
node_native_as -.->|"calls"| node_extension
node_extension -->|"delegates to"| node_native_device
node_native_device -->|"registers"| node_native_listener
node_native_listener -->|"dispatches status events"| node_air_runtime
node_extension -->|"uses conversions"| node_fre_util
node_native_device -->|"uses FRE calls"| node_fre_api
node_native_device -.->|"reads tracking data"| node_leap_service
node_controller -.->|"provides queries"| node_screens
node_controller -.->|"provides queries"| node_devices
node_controller -.->|"provides access"| node_config
node_frames -.->|"uses vectors"| node_math
node_socket -.->|"decodes"| node_socket_frame

click node_controller "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Controller.as"
click node_listener "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Listener.as"
click node_events "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/events/LeapEvent.as"
click node_frames "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Frame.as"
click node_hands "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Hand.as"
click node_pointables "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Pointable.as"
click node_gestures "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Gesture.as"
click node_screens "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Screen.as"
click node_devices "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Device.as"
click node_config "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Config.as"
click node_native_as "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/native/LeapNative.as"
click node_extension "https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNExtension.cpp"
click node_native_device "https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNLeapDevice.cpp"
click node_native_listener "https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNLeapListener.cpp"
click node_fre_util "https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNFREUtilities.h"
click node_fre_api "https://github.com/sharmaamit/leapmotionas3/blob/master/native/win-visualstudio/LeapNative/FlashRuntimeExtensions.h"
click node_socket "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/socket/LeapSocket.as"
click node_socket_frame "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/socket/LeapSocketFrame.as"
click node_math "https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Vector3.as"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_listener,node_events toneBlue
class node_frames,node_hands,node_pointables,node_gestures,node_screens,node_devices,node_config toneAmber
class node_native_as,node_extension,node_native_device,node_native_listener,node_fre_util,node_fre_api toneMint
class node_socket,node_socket_frame,node_math toneRose
class node_app,node_leap_service,node_air_runtime toneIndigo
```

## Components

### ActionScript API

- [Controller](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Controller.as): `src/com/leapmotion/leap/Controller.as`
- [Listener Callbacks](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Listener.as): `src/com/leapmotion/leap/Listener.as`
- [Leap Events](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/events/LeapEvent.as): `src/com/leapmotion/leap/events/LeapEvent.as`

### Tracking Features

- [Frame Data](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Frame.as): `src/com/leapmotion/leap/Frame.as`
- [Hands And Fingers](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Hand.as): `src/com/leapmotion/leap/Hand.as`
- [Pointables And Tools](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Pointable.as): `src/com/leapmotion/leap/Pointable.as`
- [Gesture Types](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Gesture.as): `src/com/leapmotion/leap/Gesture.as`
- [Screen Queries](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Screen.as): `src/com/leapmotion/leap/Screen.as`
- [Device Queries](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Device.as): `src/com/leapmotion/leap/Device.as`
- [Configuration](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Config.as): `src/com/leapmotion/leap/Config.as`

### AIR Native Extension

- [Native Bridge](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/native/LeapNative.as): `src/com/leapmotion/leap/native/LeapNative.as`
- [FRE Dispatcher](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNExtension.cpp): `native/src/LNExtension.cpp`
- [Native Device](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNLeapDevice.cpp): `native/src/LNLeapDevice.cpp`
- [Native Listener](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNLeapListener.cpp): `native/src/LNLeapListener.cpp`
- [FRE Conversion](https://github.com/sharmaamit/leapmotionas3/blob/master/native/src/LNFREUtilities.h): `native/src/LNFREUtilities.h`
- [FRE API](https://github.com/sharmaamit/leapmotionas3/blob/master/native/win-visualstudio/LeapNative/FlashRuntimeExtensions.h): `native/win-visualstudio/LeapNative/FlashRuntimeExtensions.h`

### Transport And Math

- [Socket Transport](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/socket/LeapSocket.as): `src/com/leapmotion/leap/socket/LeapSocket.as`
- [Socket Frame Decode](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/socket/LeapSocketFrame.as): `src/com/leapmotion/leap/socket/LeapSocketFrame.as`
- [Vector And Math](https://github.com/sharmaamit/leapmotionas3/blob/master/src/com/leapmotion/leap/Vector3.as): `src/com/leapmotion/leap/Vector3.as`

### Other components

- **Application**
- **Leap Motion Runtime**
- **AIR Runtime**

## Connections

- Application → Controller: creates (evidence: `README.md`)
- Application → Leap Events: handles (evidence: `README.md`)
- Controller → Leap Events: dispatches (evidence: `README.md`)
- Leap Events → Frame Data: carries (evidence: `README.md`)
- Frame Data → Hands And Fingers: exposes (evidence: `README.md`)
- Frame Data → Pointables And Tools: exposes (evidence: `README.md`)
- Frame Data → Gesture Types: exposes (evidence: `README.md`)
- Controller → Listener Callbacks: supports callbacks (evidence: `README.md`)
- Controller → Native Bridge: may use (evidence: `README.md`)
- Controller → Socket Transport: falls back to (evidence: `README.md`)
- Native Bridge → FRE Dispatcher: calls
- FRE Dispatcher → Native Device: delegates to (evidence: `native/src/LNExtension.cpp`)
- Native Device → Native Listener: registers (evidence: `native/src/LNLeapDevice.cpp`)
- Native Listener → AIR Runtime: dispatches status events (evidence: `native/src/LNLeapListener.cpp`)
- FRE Dispatcher → FRE Conversion: uses conversions (evidence: `native/src/LNExtension.cpp`)
- Native Device → FRE API: uses FRE calls
- Native Device → Leap Motion Runtime: reads tracking data
- Controller → Screen Queries: provides queries (evidence: `README.md`)
- Controller → Device Queries: provides queries
- Controller → Configuration: provides access
- Frame Data → Vector And Math: uses vectors (evidence: `README.md`)
- Socket Transport → Socket Frame Decode: decodes
