Flash game on ActionScript 3.0. There is a rotating drum, which stops when clicked, and you need to find out which sector has fallen out. I do not want to reinvent the curve bike. How is this usually done?
The object of the drum is drawn, the sectors are all different in size and not in order. There is an idea to tie the control points to the intersection of the sectors, but there is a problem. For each point, you need to specify the value of the sector for which it, roughly speaking, is responsible. These points can probably be added from the library after the drum is drawn - in the right places. Is there any possibility for an object added from a library to specify a property?
It only comes to mind to give the instance name with the desired parameter at the end (for example, item_1, item_5). Is this a very rude approach? Plus, two points can have the same value, because the sectors are repeated.
How I see it:
- Drum drawn
- In the right places come across control points (objects of the same class, taken from the library). Each point is given a name in which the parameter is specified.
- When you add the drum itself to the scene, somehow all the control points are collected in the array. Now they have coordinates, which can now be used to calculate the position of the drum and determine the fallen sector.
- Get the value of this sector (from the name of the object). How to get access to it from the code?
I'm already confused myself) The main problem is how to get the value of the sector, if the drum is drawn and all sectors are different?
P.S. The position of the drum can also be calculated by rotation, probably, but it can spin for a long time and the meaning is wild there.
P.P.S. Found hitTestPoint () method. If he really calculates the intersection of the form, and not on the frame, then find out which sector fell even easier. But the question of how to convey the value of the drawn sector remains in force. If you put it in a text field inside a sector, can it be considered?
Please any tips)



