Aaah please help with this code?

right ok heres my problem …!!
im using this code
[AS]onClipEvent (load) {
this.elasticScale = function(tar, accel, convert) {
xScale = xScale * accel + (tar - this._xscale) * convert;
yScale = yScale * accel + (tar - this._yscale) * convert;
this._xscale += xScale;
this._yscale += yScale;
}else if (!this.hitTest(_root._xmouse,_root._ymouse,true)){
it is a nice simple bit of code that when dropped onto any movie clip makes it elastic (i believe the original code i made it from was BillyTs tute on elasticity!!)
I have a main movie which ------ loads in a movie called bands which holds the buttons (exists on level1)
Anyway that code works fine however i have a problem when i put the button clips with this code on them into my movie it doesnt work.
At first i thought it may be a problem with path names as when loaded in they exist on _level1 but i tried that and it made no difference !! and even weirder than that i made a small test movie which had just one button in it, then attached the exact same code to it and loaded it into my main movie and it works ???
how come i do not understand at all…
It is very bad problem some one help me please…!!!

Well the code is made for a MovieClip not for a button, so if you are going to use it on a button you should make a containermc for it and attach the code to that. In mx mc’s can be given the exact same behaviour as buttons so you might want to consider skipping the buttons and just make them mc’s. If I didn’t understand you question correctly please attach the fla.

sorry i was a bit misleading there all my buttons ( i simply refer to thir purpose not definition) are already MCs .
as i say i have the code working try it your self drop that code on a movie clip and see. but when i have the code nested in levels it seems to not work in the project im working on.
I will post the files if you like so you can see whats going on.


I tried loading a child swf which had the buttons with the code, and it worked fine.

You should try using loading your movie into target mc’s.

I don’t think levels are really used anymore. I always thought tragets were far more pracitcal.

There cannot be any pathing problems, because you have used this. So it doesn’t car about the path.

I just did a simple test

make your swf to be loaded in with the buttons etc.
export the swf
open your parent swf, add i normal button on the stage and add an empty mc on the stage (registration top left).
Call it holder.

now on the button put this code:

on(press ){
_root.holder.loadMovie (“whateverchild.swf” );

You will see that it works.

Btw, very neat script for the bounce. Really like it.

You should consider putting the function on its own layer, and then just referencing it for the mcs.

That way if you have 30 buttons or something, and want to change the inertia or whatever, you just change the code in one place.

I find on these bigger projects, this is far more time efficient (and less face time saving means more money, less writing)!

Hope you get this problem sorted,


hhm so you reckon loading into levels is bad idea then (how come??) i personaly prefer it.
Also thanks for the trying the code and and offering a solution but as i said it is nothing to do with what level or path nmae i choose !!
i can load a movie containing this code into my movie and it works fine unaltered but when i attach the code to movie clips which already exist in my movie (on level1) it just doesnt respond i can post an example if youd like to see.
BTW i have a more advanced version of that elastic code if youd like to see it
cheers for the help…


I think i misunderstood. i assumed the code was on the mc that was being imported, not on the main stage. That’s right now yeah?

Post the code and i’ll have a look for you.

i prefer loading into targets because it’s far more versatile, especially if you want to move things around quickly. Also you can now load things into target clips dynamically (which i don’t think you can do with levels - not sure)unsing “creatEmptyMovieClip”

I would really like to get hold of the advanced elasticity code, been looking for something good for ages.

Post the fla and i will have a good look and see if i can figure it out for you.



here the _level loaded version of my elasticity thing
(note this is NOT the actual file im working with but a smaller test version i made)

here the target clip loaded version of my elasticity thing
(note this is NOT the actual file im working with but a smaller test version i made)

finally heres a more advanced elasticity thing you can play aound with !!!

hey ave,

Now i’m really not getting what the problem is!!?

are you just trying to load a child movie with the script already on that movie?

the first example, i made the appropriate child swf and it loaded fine and worked fine.

the target one, you didn’t name the holding movieclip instance.
Also you should get into proper dot syntaxt:

i.e. _root.holder.loadMovie(“elastic_prototype” ).

I reall want to help a fellow londoner, but i have no idea what you want to do, and what the problem is!!

Love the elasticity code, wicked! gonna play with it when i get the time.

So let me know exactly what you want to do, and what the problem is.


right well basically the site im building has a movie which loads onto level 1 of the main stage and within that movie is my buttons with my code on them.
so it looks like this:
MainStage–(level1)movie1–buttons in that order.
The strange bit is that in the example i posted of the level loaded elastic buttons, they work fine in any level with no code change but this doent work in my main movie, to be honest mate its hard to explain mainly cause its completely odd.
I have done tests on it tried different function names changed path names…etc… all sorts but none of it works so to save us both a lot of hassle im not gonna bother with it , i will simply use a different piece of button animation.
Cheers anyway man sorry it took so long!! hey your from london huh , got any jobs going :wink: he he he

ok mate,

well sorry i couldn’t help you sort it. from what you said, it is really wierd that it don’t work!

i am always on the look out for good designers to collaborate with on projects. there could be some work in the coming months.

Send me a couple of links and some details about yourself and i’ll keep you in mind for future projects.

I got quite a lot on right now, so i could very possible need some help.



ok man i will send you an e-mail with my details and stuff, cheers !!