|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
X_AsPercentOfWidth() - How far into the object did a click occurfunction X_AsPercentOfWidth(MyX:Number, MyMovieClip:MovieClip):uint {
/*
Purpose
Used to convert the location of a point to a percentage of the width of the specified MovieClip.
This is useful for determining what percentage of the way across an object the mouse was clicked.
Paramters
MyX (Number) = The location we're working with.
MyMovieClip (MovieClip) = The reference object. We use the width from this object.
Return (uint)
Returns the percentage represented by a point referenced to the width of an object.
For example, if MyX is the middle (horizontally) of the object, we return 50.
The return value is always betwen 0 and 100.
Version History
1.0 2010.01.08 Tested by Russ Tanner on AS3.
If you update this code, please put a copy here:
http://orbisvitae.com/ubbthreads/ubbthreads.php?ubb=showflat&Number=55143#Post55143
*/
// Trap: The specified point is <= 0. Just return 0 to prevent anomalies in the following division.
if (MyX <= 0) return 0;
// Convert the point to a percentage of the MovieClip width and return the result.
// We don't let this exceed 100.
return Math.min(MyX / MyMovieClip.width * 100, 100);
}
|
|
|
|
|