I have a prb in spring!

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!

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.

Sorry man :-\

Well in 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.

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.

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

It’s there

pom :asian:

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

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

I need help with math!!!:frowning: 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?

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:

Guys i’m using flash5:-\ and it didnt work with me :frowning: … 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

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:

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 = xwinertia+xk;yw = ywinertia+yk;_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 = xpinertia+xk;yp = ypinertia+yk;_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;
}

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

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

It should do the trick.

pom :asian:

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

Well, I know this because I had the exact same problem when I wrote the tutorial :stuck_out_tongue: 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:

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…

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

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

To be a beginner is such a disaster…
I tired to add the slide menu in 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

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 [email protected]