| Welcome to Brackenwood. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Attraction; Revised Edition | |
|---|---|
| Tweet Topic Started: Mar 22 2006, 12:01 PM (197 Views) | |
| Vector | Mar 22 2006, 12:01 PM Post #1 |
|
Resident Actionscript Guru ♂
![]()
|
Mucking around with an older project (rewritten from scratch) gave me this... http://photobucket.com/albums/v661/Vector8...=Attraction.swf The bonds of attraction between each node and all of the others pulls it in different directions, based on how close they are. The red line coming from each node represents the speed and direction that the current node is travelling in. The only trig used in this is pythag, no sin or cos folks! If you want to make your own one of this, feel free to nab the source code. What you'll need to do is create a movieclip called "mcTick". Then, go into your library (F11) and right-click on your movieclip. Select "linkage". Tick the first box and click ok. Delete the node that you have off the stage so the only copy exists in the library. Then, paste this code into the actionscript panel (F9) ON THE FRAME:
There's a few variables up the top that you can play with. Go NUTS!
|
![]() |
|
| Mr. Jiggmin | Mar 22 2006, 02:03 PM Post #2 |
|
made of tulips
|
Neato Vec! I have a question. (of course) You're manually deleting some of the variables when you're through with them... I thought that when you declared a variable with "var" it automatically got deleted when the function finished? Is there any benefit to doing it the "delete suchAndSuch" way?*goes to watch the little dots move around some more* -edit Ahh Jeez, you know you've been using flash too much when you try to hit ctrl+enter rather than clicking on the link.
|
![]() |
|
| Vector | Mar 22 2006, 04:19 PM Post #3 |
|
Resident Actionscript Guru ♂
![]()
|
Normally I don't even bother, but with some recent experience with flash I found out that flash doesn't seem to manually delete local variables when they finish (go figure). I'm not sure if this is for everything or just functions or just events or what, but it happens. The app I was working on was meant for long-term running and it crashed overnight, so I deleted the variables after use and it worked fine. So there you go ![]() <edit> Attached the fla of a version that you can play with live, and a link to it right here! |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Actionscript · Next Topic » |







You're manually deleting some of the variables when you're through with them... I thought that when you declared a variable with "var" it automatically got deleted when the function finished? Is there any benefit to doing it the "delete suchAndSuch" way?
5:11 AM Jul 12