# I have a prb in spring!

**URL:** <https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589>\
**Category:** flash\
**Created:** [September 17, 2002, 12:05am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589 "2002-09-17T00:05:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![hellkiller](https://avatars.discourse-cdn.com/v4/letter/h/bc79bd/32.png) [@hellkiller](https://forum.kirupa.com/u/hellkiller)\
**Post date:** [September 17, 2002, 12:05am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/1 "2002-09-17T00:05:31Z")

</div>

Hello…  
My problem is i used the sping code to make a button as it was mentioned before. buttttttt when i added more 3! 3mc which acts like buttons itt just didnt work!!!.. only one button is acting like elasticity and the others just stay without moving!  
Can someone plz tell me what to do??  
I would be so thankful!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:11am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/2 "2002-09-18T06:11:27Z")

</div>

you’re going to have to be a little more clear.

> My problem is i used the sping code to make a button as it was mentioned before.

Mentioned where? Please provide a link to that thread, if you were having a conversation on this matter in the past. Not all of us read every thread that comes along.

> buttttttt when i added more 3! 3mc which acts like buttons itt just didnt work!!!.. only one button is acting like elasticity and the others just stay without moving  
> I think that this makes no sense as it stands. A reference to any other conversations you have had on the subject may clear it up… but as it stands it’s all over the place. 3 more what? what is 3mc, the name of a movie clip?

when you’re using things like 3mc as instance names, it’s really really really important that you do not do things like ‘itt’ or ‘butttttttt’. When you’re loose with the typing it’s impossible to tell if you’re acurately discribing something or if you’re simply making a typo.

Let me know… I’ll try to answer as best as I can.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 5:51pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/3 "2002-09-18T17:51:00Z")

</div>

Sorry man :-\

Well in [http://www.kirupa.com/developer/actionscript/spring.asp](http://www.kirupa.com/developer/actionscript/spring.asp) he made a elasticity ball as a spring. and that ball is a movie clip

What i want to know us what if i add instead of 1 ball i add more 3 balls which makes them 4 balls and all act elasticity. which means drag the ball -----\> release it -------\> roll over ----\> goes back to it is place.

When i made the 4balls and made each one a movie clip then added the same code to each one. i thought that they will act just the same. but what happened is only the last ball i made moved perfect but the other 3 i cant even drag them and which means they dont move as a spring.

Hope this time i made it clear.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 6:15pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/4 "2002-09-18T18:15:59Z")

</div>

If you are talking about something like Kirupa shows in the first example you might have missed the note. If so it says…

> [The following works only with Flash 5. I’ll have to find out a way with Flash MX]

If you put 3 movie clips on the stage, you can very easily give them different elastic effects by changing the parameters inertia and k. Here’s an example:

The tutorial for multiple circles only works for Flash 5. It only works for 1 circle on MX.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 9:31pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/5 "2002-09-18T21:31:37Z")

</div>

Hey, I wrote an extension to that tutorial to make it work 🙂

It’s [there](http://www.kirupa.com/developer/actionscript/spring2.asp)

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 9:38pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/6 "2002-09-18T21:38:40Z")

</div>

Excellent Ilyas. I am jealous of your skills…haha:)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 9:41pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/7 "2002-09-18T21:41:13Z")

</div>

🙂 Don’t be, you’re catching up pretty fast…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 9:46pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/8 "2002-09-18T21:46:48Z")

</div>

I need help with math!!!☹ I don’t have enough money to buy a book right now, but this math stuff just isn’t clicking with me. Do you know any good online tutorials to learn about how the trig functions work?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:02pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/9 "2002-09-18T22:02:17Z")

</div>

How they work? Is it more important to know how they work or what they do? (unless you want to build that 3D engine… :P)

Check that Math Plotter in the Open Source section, and you’ll see what the functions look like. Then we can talk about what they do.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:03pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/10 "2002-09-18T22:03:57Z")

</div>

Guys i’m using flash5:-\ and it didnt work with me ☹ … as i said i did the same to all the balls _Math and creating form_ every thing  
But i dont know why one ball only has the action! and it was the last ball i made

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:07pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/11 "2002-09-18T22:07:12Z")

</div>

OK, I know what’s wrong. It’s the startDrag that doesn’t work. You’ll have to make your own function to replace it. Can you do that?

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:14pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/12 "2002-09-18T22:14:59Z")

</div>

wow ure fast!  
Scene 1  
actions for frame 1  
MovieClip.prototype.move = function (centerx, centery, inertia, k) { x = -this.\_x+centerx;y = -this.\_y+centery;xw = xw_inertia+x_k;yw = yw_inertia+y_k;\_x += xw;\_y += yw;};

Intro Mc, (intro)  
actions for Intro Mc

onClipEvent (load) {  
// We define the reference point  
centerx = 339.8;  
centery = 130.1;  
// temporary variables used to calculate  
// the speed of the mass  
x1 = this.\_x;  
y1 = this.\_y;  
}  
onClipEvent (enterFrame) {  
if (pressing) {  
startDrag (this, true);  
xw = this.\_x-x1;  
yw = this.\_y-y1;  
x1 = this.\_x;  
y1 = this.\_y;  
} else {  
stopDrag ();  
this.move(centerx, centery, 0.9, 0.1);  
}  
}

actions for frame 1

## MovieClip.prototype.move = function (centerx, centery, inertia, k) { x = -this.\_x+centerx;y = -this.\_y+centery;xp = xp_inertia+x_k;yp = yp_inertia+y_k;\_x += xp;\_y += yp;}; links Mc, (about) actions for links Mc onClipEvent (load) { // We define the reference point centerx = 269.5; centery = 201.5; // temporary variables used to calculate // the speed of the mass x0 = this.\_x; y0 = this.\_y; } onClipEvent (enterFrame) { if (pressing) { startDrag (this, true); xp = this.\_x-x0; yp = this.\_y-y0; x0 = this.\_x; y0 = this.\_y; } else { stopDrag (); this.move(centerx, centery, 0.9, 0.1); } }

And the buttons:-  
IntroButton  
actions for IntroButton  
on (press) {  
pressing = 1;  
}  
on (release) {  
pressing = 0;  
}

Links Mc  
Links button  
actions for Links button  
on (press) {  
pressing = 1;  
}  
on (release) {  
pressing = 0;  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:21pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/13 "2002-09-18T22:21:32Z")

</div>

Just replace startDrag(this,true) by these lines:

```auto
this._x=_root._xmouse;
this._y=_root._ymouse;

```

It should do the trick.

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:28pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/14 "2002-09-18T22:28:55Z")

</div>

wow ure the man!!  
Thanks alot dude! it is working 🙂  
You have no idea how many people i asked and none knew!  
You rock!  
Thanks again:)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2002, 10:34pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/15 "2002-09-18T22:34:29Z")

</div>

Well, I know this because I had the exact same problem when I wrote the tutorial 😛 It is some kind of a bug of the startDrag method: when you assign it to n clips, the first clip will not startDrag. Kinda weird…

pom :asian:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 12:32am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/16 "2002-09-19T00:32:14Z")

</div>

yo, I had another prob with the \_xmouse. Oddly, when I tried using the \_root.\_xmouse thingy in another movi i made (no springs here) I just wanted something to follow the mouse without startdrag. Anyway, when using \_xmouse and \_ymouse, the xmouse changed from high x value to low x value every frame played! :-\

So when placing the mouse cursor in the right side of my movie, the xmouse would ie go from 350 to 24 and back to 350 every frame… weird… i traced it just to be sure… but the cursor itself stayed where it should…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 7:36am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/17 "2002-09-19T07:36:43Z")

</div>

It depends on where you put that code and what version of Flash you’re using. Did you try \_root.\_xmouse?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 10:54am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/18 "2002-09-19T10:54:42Z")

</div>

thanks for the clarification sir… that made a lot more sense. Thanks too to Pom for providing the answer. 🙂 (support teams are great.)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2002, 6:03pm UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/19 "2002-09-19T18:03:17Z")

</div>

To be a beginner is such a disaster…  
I tired to add the slide menu in [http://www.kirupa.com/developer/flash5/slidingmenu.asp](http://www.kirupa.com/developer/flash5/slidingmenu.asp)  
to the elasticiy buttons that i mentioned before… Guess what! it made a huge mess!!!.. the buttons started to move as they please and when i click them they go off the stage and i cant see them any more… i think it is cos of the on (press) {  
pressing = 1;  
}  
on (release) {  
pressing = 0;  
}  
in the elasticity… i dont know what to do… i really hate to be a beginner:-\ . anyway if you guys know what to do plz tell me…  
Once again i’m thankful for you guys

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 20, 2002, 6:21am UTC](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589/20 "2002-09-20T06:21:21Z")

</div>

Probebly you should send the FLA to one of us. I’ll bet it is a simple syntax or addressing problem.

If you like, my addy is [upuaut@centerspin.com](mailto:upuaut@centerspin.com)

[Next page](https://forum.kirupa.com/t/i-have-a-prb-in-spring/5589.md?page=2)
