How to get the X and Y strings of a movieclip in Actionscript 3 or Javascript?

Asked

Viewed 94 times

1

Hello, I’m new around here and I have a question that’s giving me a hell of a job.

I need to capture in a variable the X and Y coordinates of a certain movieclip that is on my stage (canvas on Html5) but I don’t know how to do :(

I’m using Animatecc 2018 with HTML5 output, There’s very little in the way of any kind of article on development in the New Year, if anyone knows I’d be grateful.

1 answer

0


To access an object created on stage, such as your Movieclip for example, you will need to use this (as well as much of the global functions) before:

var movieclip = this.movieClipNoStage;
console.log(movieclip.x);
console.log(movieclip.y);

Or simply:

console.log(this.movieClipNoStage.x);
console.log(this.movieClipNoStage.y);

At this link are the key information you need to know about the difference between Actionscript 3.0 programming and HTML5 Canvas in Animate CC. It teaches you to convert your code.

  • 1

    Thank you @bio problem solved! D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.