Skip to main content
Participant
February 23, 2021
Question

X/Y positions match the stage in actionscript, but not in javascript

  • February 23, 2021
  • 2 replies
  • 212 views

Hi there,

I've made the switch from AS3 to javascript. I'm having a problem coding the positions of movieclip symbols. In AS3 I could drag a symbol on the stage, note its positiona and tween it in code. In javascript the x y positions do not correlate to what I'm seeing on my stage.

Here's an example tweening a symbol called economy.  

 

TweenMax.to(that.economy, 4, {y:150, ease:Sine.easeInOut, delay:0.5});

 

The stage is telling me that position I seek is y:393, but to get it to move to that position in code I have to ask it to go to y:150. Is there a  way to get the code position and the stage position to line up?

Many thanks

Adam 

TweenMax.to(that.economy, 4, {y:150, ease:Sine.easeInOut, delay:0.5});

This topic has been closed for replies.

2 replies

Legend
February 23, 2021

First, you're probably noting the registration point instead of the centerpoint.

 

Second, why are you using TweenMax instead of the built-in tween library?

Joseph Labrecque
Community Expert
Community Expert
February 23, 2021

I've seen similar things when testing on a retina display - that the case here? You basically have to test for screen depth and then adjust all measurements: window.devicePixelRatio