changing a property from two different locations causes erratic behavior..
GoogleCodeExporter opened this issue · comments
0. using the latest version of tweener..
1. create an MC with registration point in the center.
2. add to stage with _x=Stage.width/2 and _y=-_height so that it doesnt appear.
3. add a tween on _y:Stage.height/2 so it animates down to the center of stage.
this works just fine.. but..
4. add an onResize() handler to stage..
5. set _x=Stage.width/2 and _y=Stage.height/2 to keep the MC in the center of
stage..
6. resize browser window while the previous tween is running..
7. MC goes haywire.. in some cases disappears from stage altogether..
i know the problem arises when the a property is changed while tweener is
messing with it.. but there has to be a workaround for it.. something like..
1. this is assuming that tweener calculates property values after each update
instead of calculating the entire sequence of values before tweening..
2. save the final value of the property in a known location and use the current
value vs final value to calculate the new value.. also flag the MC as tweening..
3. in stage.onResize(), we could check if the MC is tweening.. if not, we
directly change the _x and _y.. if yes, then we change the final value of the
property where tweener has saved it..
4. tweener uses the changed final value to calculate the new property value..
i hope i was clear in explaining that.. if there already exists a workaround..
do tell..
awesim..
Original issue reported on code.google.com by awe...@gmail.com
on 17 Dec 2011 at 5:32
ok.. ive worked around it.. but its a very dirty hack.. there has to be a
better way..
1. create an empty clip using createEmptyMovieClip()..
2. attach the movie we want inside this clip..
3. center the parent clip to the stage..
4. tween the child clip as needed..
5. in onResize(), change position of parent clip to stage center..
Original comment by awe...@gmail.com
on 17 Dec 2011 at 6:55