Skip to main content
Inspiring
June 29, 2022
Answered

showing Object Position in dynamic text html5

  • June 29, 2022
  • 2 replies
  • 229 views

Hi, I got stuck, I want to show my moving object (called "bulat") position in the dynamic text (called "posisix" for the x-axis and "posisiy" for the y-axis ).  as all I know in action script adobe flash, we can use as simple as

posisix.text = bulat._x

 

so I'm trying this  for adobe animate HTML5

 

var ini = this

this.addEventListener("tick", jalanbulat.bind(this));
function jalanbulat() {
ini.bulat.x += 10;
ini.bulat.y += 10;
$("#posisix").val(bulat.x);
$("#posisiy").val(bulat.y)
}

Of course it didn't work, I know it couldn't be as simple as that, but I have no idea, could anyone please help me on this? thank you.

    This topic has been closed for replies.
    Correct answer Nurhamida25024381d3rg

    it's solved. I changed the script to:

    var ini = this

     

    this.addEventListener("tick", jalanbola.bind(this));
    function jalanbola() {
    ini.bulat.x += 10;
    ini.bulat.y += 10;
    ini.posisix.text = ini.bulat.x;
    ini.posisiy.text = ini.bulat.y;

    }

     

    and it's work just like what I want.

    2 replies

    Known Participant
    July 1, 2022

    Halo,

    Dari Indonesia kah ?

    Inspiring
    July 2, 2022

    iya, saya dari indonesia.

    Nurhamida25024381d3rgAuthorCorrect answer
    Inspiring
    June 30, 2022

    it's solved. I changed the script to:

    var ini = this

     

    this.addEventListener("tick", jalanbola.bind(this));
    function jalanbola() {
    ini.bulat.x += 10;
    ini.bulat.y += 10;
    ini.posisix.text = ini.bulat.x;
    ini.posisiy.text = ini.bulat.y;

    }

     

    and it's work just like what I want.