PLEASE DON'T BE SCARED AWAY BY THE LENGTH OF THIS POST.
An explanation of the problem is followed by some possible solutions I've
developed.
Please feel free to ask for clarification...
-------------------------------------------------
I want the current heading in degrees to be translated to a sort of on screen
compass. The flash program would display the current heading at the top of an
oval path. There will be 8 directions that can be displayed (N, NE, E, SE, S,
SW, W, NW).
if the current compass direction is 45 deg., the flash program would display:
--------------------------------------------------------------------------------
---------------------
--------------------------------------------NE----------------------------------
------------------
--------------------N-----------------------^-------------------------E---------
------------------
--------------------------------------------------------------------------------
---------------------
--------------------------------------------------------------------------------
---------------------
--------NW----------------------------------------------------------------------
SE--------------
If the current reading was 23 degrees,
--------------------------------------------------------------------------------
---------------------
--------------------------------------------------------------------------------
---------------------
-----------------------------N--------------^-------------NE--------------------
-----------------
--------------------------------------------------------------------------------
---------------------
-------------NE---------------------------------------------------------------E-
------------------
--------------------------------------------------------------------------------
---------------------
-Is there a way to do this in actionscript?
-------------------------------------------------
One (utterly undesirable) solution would be to draw 359 separate images in
freehand or flash corresponding to the 359 possible compass headings (360 and 0
degrees are the same). Then enter transfer each to a separate level in a single
swf and program some actionscript so that only the level corresponding to the
current bearing is displayed.
This would obviously be an enourmous PITA, unless there would be some way to
automate the image creation process.
-Is there any way to automate this process?
-------------------------------------------------
Another method would be to use an oval path for the 8 text directions to
follow. This is even worse, as it requires manually setting the position of all
8 objects for the 359 possible headings. The possiblity of coding the position
of 8 objects a total of 3000 times is not a thought I cherish. Also, I would
eventually like to implement tic marks between the 8 directions.
The actionscript code I've read indicates you can rotate objects
programatticaly, but this only rotates them around their own axis.
-Is there a way to use actionscript to set the axis of rotation outside of the
object?
This also doesn't work, because text always needs to be oriented vertically.
-Is there some sort of 'revolve' command that maintains the vertical
orientation, kind of like a ferris wheel?
Even if I can set the axis of rotation and maintain vertical orientation, I'll
still have troubles. In my oval compass the distance of the axis of rotation
would have to vary as the object revolves (the radius isn't constant in an
oval).
-Is there a way to overcome this behavior? Can position on an oblong path be
specified via the projection of degree measurment?
-------------------------------------------------
Another possible method would be to essentially fake an oblong path and
actually just display a smaller portion of a larger circlur path, say from -45
to 45 degrees. Then use some sort of conversion to halve the degree measure for
bearings within 90 degrees of the current heading.
I can see some problems with this, in addition to the issue of vertical
orientation and a different axis of rotation already discussed above.
-Must rotation be specified in relative terms? Can the rotation be specified
in absolute terms?