A Star Path Finder for Flex AS3
By purchasing and downloading this license, you are entitled, as buyer, to use the product in ONE SINGLE NON-COMMERCIAL PROJECT ( website or other ... [+]
Package includes: Example Flex project + .swc component
Flash Version: Flex
Viewable with: Flash Player 9
Action Script: ActionScript 3.0
This is a non-visual .swc component that you can use in your Flex Projects. It is specially optimized to be very fast since this kind of algorithms need much processing power.
The example project contains a very simple example. The constructor needs a BitmapData structure where white (0xFFFFFFFF) is walkable and black (0xFF000000) is non-walkable.
Once you have created the path finder object you may call the FindPath(startX,startY,endX,endY) method. This takes 4 parameters. The first two are the X,Y values of the start point and the last two are the X,Y values of the end point. If the method returns an array of some length then it has found a path. Each element in the array is itself an array which contains the X and Y coordinates of each step in the path.
* To use the example, just click and drag in the white areas. The mouse-down marks the start position and the mouse-up marks the end position. The path finder will then find the shortest path from start to finish.
A-Star Path Finder Sample:
Just click and drag in the white area. A mouse-down marks the start position and a mouse up marks the end position. Then the path finder will find the shortest path and paint it red.