-
Mathematics +preloader
I just don't get it.
I have this preloader where I get % loaded (start: 0 completed: 100%)
Now I need to move a movieclip _x cordinate from _x 65 to 200
How can I move the clip based on percent loaded?
eg.
start: 0% mc._x = 65
end: 100% mc._x = 200
can anyone please help me out
thanks in advance,
best regards T
-
Senior Member
When you want something to go from a to b as a percentage goes from 0 to 100, the basic formula is:
x = a + (percentage/100) * (b-a);
So your example would be:
mc._x = 65 + (percentLoaded/100) * (200-65);
which can be reduced to:
mc._x = 65 + (percentLoaded*(200-65))/100;
mc._x = 65 + percentLoaded*135/100;
mc._x = 65 + percentLoaded*1.35;
-
Thanks
Thanks for helping jbum, I got the same formula from a person at the Macromedia Forums
Thanks again,
best regards T
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|