Actionscript dilemma

if you guys could please help me out…\r\rI have animated button inside movie clip. On rollover, button zooms in and rotates. It even swaps depths (that took me a while). However, if I have 10 buttons on the screen, one of them, and only one, will not rotate, and will not zoom, but everything else works. The kicker? The button is never the same. To see what I mean… I have the site staged on this URL…sites.html\rclicking on the number will show a picture\r\rvery little code here (as you can imagine)\ron rollOver {\r_root.stopandgoto(frame#);\rx=0\rx=x+2\r_root.instance.swapdepths(x)\r}\rthat’s pretty much all the code… please help!

I would have posted the source… but I don’t know how (I must be missing something simple, probably because Im so fried right now)

i’m not sure what’s going on, but i did notice that the first one i rolled over worked once and only once. the rest would alway work fine.\r\rthis was consistent which ever one i started with.\r\rx = 0;\rx = x + 2;\r\rwon’t this result in x equalling 2 everytime?\r\rif you want to have x increment each time a movie is brought to the front, put it in _root, change those lines to:\r\r_root.x++;\r

#34 seems to be the one that doesn’t work for me.\r\rpom 0]

See? it is random! Sometimes 12, sometimes 10, sometimes 17. I just don’t get it. I suspected it had something to do with original mouse position, but Im truly stumped here.

Thanks, Suprabeener\r\rthe x+2 is meant to simply increase the depth over the last depth set, so x+2 works fine every time. Before using this part of the script, the 10, for example, would rotate and spin while still “under” the 12, therefore killing the illution of zoom. I got that x +2 thing from a tutorial right here in Kirupa…

i’m still getting the behaviour i mentioned before…\r\rmontoya, if x will always equal 2, you needn’t put it in a variable (since it doesn’t vary ; )\r\r_root.instance.swapdepths(2)\r\rwill work just as well.

It’s true that a tutorial here (the one about Swapdepths) tells you to set x to 0 before you do x+2. I asked a question about that a while ago, but never got an answer…\rpom 0] \rAll this to say that I don’t know what’s wrong.

you guys are right about the x+2 part\r\rI’ve tried the following (to see is this helps)\r\rI changed from just swapdepths(2) to a different number.\rI tried making it swapdepths with the object next to it as in swapdepths(instance) \rI tried deleting all other objects except for 3 or 4, works fine.\r\rIf you guys can tell me how to post the .fla, perhaps you will see something I do not.

Put it on your server and give us the link. Something like


with 2 “t” in http.pom 0]

well, here is the file. I think I’ve tried everything possible, but I cannot get one of the numbers to continue rotating and zooming, it will glitch every single time. It does appear to be the first number you use, though…\r\ryour help is greatly appreciated.\r\rsouce can be found at\r

well, i’m still not sure why it wasn’t working… i did notice that it was creating a duplicate object in the namespace, that would explain why the rollovers stopped working but i couldn’t find why it was creating the duplicate.\r\ri think it had something to do with the _root timeline jumping about like it was.\r\ri move the pics into their own movie and targeted that movie with the gotoAndStop() actions and that seemed to clear up the problem.\r\ri also changed the swapDepths command from \r\r_root.targetMovie.swapDepths(2);\r\rto\r\rthis.swapDepths(2);\r\ri’m not sure that that made a difference though.\r

I think Im confused… you moved the pics into their own movie? You mean, the house/lot pics?\r\rone more question…\r\rthis.swapDepths(2)? I dont know that “this” stands for…\r\rHey, thanks a million for the help. I really do appreciate it!

yes, the house lot pictures.\r\r"this" refers to whatever movie the code is in. in this case you could leave it off altogether and just write swapDepths(2) since it will default to the curent movie anyhow.