flash actionscript:
I am using a dragable MovieClip. When dragging it around in the movie it remains where I put it when the movie comes to the end and loops. BUT, when the same movieclip is assigned new x and y coordinates (by a button), and then dragged around, the movieclip jumps back to the starting position when the movie loops. Why is it like this? What can I do to avoid this "jump" ? tm
Thank you for the answer, but I am not quite sure how. How I can change it so it is the the instances current x and y value at the time of the startDrag? My code: small_legend_circle_mc.onRollOver= function() { shadow_mc._x = small_legend_circle_mc._x; shadow_mc._y = small_legend_circle_mc._y; shadow_mc._height =small_legend_circle_mc._height+1; shadow_mc._width =small_legend_circle_mc._width+1; shadow_mc.swapDepths(this.getDepth() +1); } shadow_mc.onPress = function() { this.startDrag(); } shadow_mc.onRelease = function() { stopDrag(); When I click on the shadow_mc directly it remains at the same place during a loop, and when I use the rollover function first, it jumps back to the initial position when the movie loops. How can I correct my code?
I am a little confuse with what you have posted ..... i might help you if you post it more clearly........ first of all you have not defined any area restriction on your drag command ....so there should not be any restriction ....... I tried to copy your code and even after assigning different value to your shadow mc it still works as previously...... Please check whether do you have any more code somewhere else.....
Yes, it is just a part of the code (that I believed to be essential for this problem. Here is some more: shadow_mc._alpha = 65; small_legend_circle_mc.onRollOver= function() { shadow_mc._x = small_legend_circle_mc._x; shadow_mc._y = small_legend_circle_mc._y; shadow_mc._height =small_legend_circle_mc._height+1; shadow_mc._width =small_legend_circle_mc._width+1; shadow_mc.swapDepths(this.getDepth() +1); } medium_legend_circle_mc.onRollOver= function() { shadow_mc._x = medium_legend_circle_mc._x; shadow_mc._y = medium_legend_circle_mc._y; shadow_mc._height =medium_legend_circle_mc._height+1; shadow_mc._width =medium_legend_circle_mc._width+1; shadow_mc.swapDepths(this.getDepth() +1); } large_legend_circle_mc.onRollOver= function() { shadow_mc._x = large_legend_circle_mc._x; shadow_mc._y = large_legend_circle_mc._y; shadow_mc._height =large_legend_circle_mc._height+1; shadow_mc._width =large_legend_circle_mc._width+1; shadow_mc.swapDepths(this.getDepth() +1); } shadow_mc.onPress = function() { this.startDrag(); } shadow_mc.onRelease = function() { stopDrag(); if ((shadow_mc._x > 300) && (shadow_mc._y > 300)) { shadow_mc._x = 460; shadow_mc._y = 478; shadow_mc.swapDepths(medium_legend_circle_mc.getDepth() -1); } if (shadow_mc.hitTest(circle_map_mc)) { hit = true; } else { hit = false; } }; Tidsstolpe_mc.onEnterFrame = function() { if ((shadow_mc._height < circle_map_mc._height)/* && (hit)*/) { etc. etc.
Hmmm... i am sorry to say that though you have posted more codes i can not help you because i dont know the workflow of these codes which is triggering when and what......... you have posted a if condition which is setting the shadow clip to some destination...... but i cant see when it will be triggred......and there is a onEnterFrame statement whose body is missing...... any way try to check all that related codes that are being triggered when the onRelease event is triggered or any loops or continuesly running codes that might help....
Don't see what you're looking for? Try a search.
|