Copy link to clipboard
Copied
I'm using an animated symbol, and because the illustrations on the frames are different sizes, it is throwing off a part of the code that reads the symbol's position. I tried adding placekeeper symbol for the X-position, but flash is not recognizing its actual coordinates. Any ideas on code I should use?
Copy link to clipboard
Copied
Which object(s)' position are you trying to get and which coordinate system are you trying to relate it to? If it is a nested symbol are you trying to get its coordinates relative to the main stage or relative to the object that contains it?
You might look into using localToGlobal, though it is slightly removed from being what I would call 'simple'... not horrendously difficult, just not simple.
Copy link to clipboard
Copied
Relative to the main stage.
For instance , I have a symbol on stage called "happy_face". Happy face is at the 45 x position on the stage. I want to get the x position of one of the eyes on the happy face to place something else on the stage over it.
Copy link to clipboard
Copied
Since you say the objects are different sizes, does that mean they are scaled up/down? If not then a simple way to try getting the position is by adding the values of happy_face.x + happy_face.eye.x
If they are scaled you might miss the target because the value of the eye.x will still be what it is even though the scaling changes it relative to the main stage. Although if you were willing to plant the 'something' object inside the happy_face you can skip wondering and just plant it where the eye is.
I am not sure if the localToGlobal deals with that but you can certainly try it and see in a static test if you are interested. Just Place something small inside a large object and see what values you get with the larger object scaled and unscaled. You should see a difference between the two results if it is accounting for the scaling.
Copy link to clipboard
Copied
No, not scaled. Just different sized because that's how they're drawn. One is a standing position, one is a running position which is slightly wider.
Thanks, there's probably no way to get the coordinates.
Copy link to clipboard
Copied
There is certainly a way. While using localToGlobal will still work, if they are not scaled then you should only need to get the happy_face x and add it to the happy_face.eye.x value to get the x property relative to the main
Copy link to clipboard
Copied
This is somewhat difficult to explain because the actual project is different and more complicated, but...
1) The happy face is an animation. The frames of the animation are all different widths. This is where the problem comes in. There is another object that moves in conjunction with the happy face, but because the size of the happy face changes, the other object's position keeps moving further and further out of place.
Copy link to clipboard
Copied
I guess if you keep drawing the object you want to try to track down at different sizes it will be difficult to try to cover it or whatever you are trying to do, but finding its x and y coordinates relative to the main stage should still be easily doable if you are not scaling things.