New to construct and frustraited... sorry.

0 favourites
  • 3 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I'm building a fantasy football app, which I will gladly share :)

    I'm new to construct. I've dabbled in programming, and I can usually pick it up really fast, however I do best with either books (which I can't seem to find for construct), and analyzing code from other projects - which I haven't been able to figure out how to do that here either...

    Anyway, I am trying to use button clicks with JS. I can get the "alert" box to work, but I am not having much luck with getting anything to display in the text box.

    Button>onclick> JS: alert("Hello, World!"); - This makes the alert box.

    Button>onclick> JS:

    var textObject = runtime.objects.PW;

    textObject.text = "Hello, World!";

    Does not work...

    Thank you in advance... More questions coming as I learn this :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • var textObject = runtime.objects.PW;

    textObject.text = "Hello, World!";

    This is a common mistake that confuses object types with object instances. You are trying to set the text of the object type, but only actual instances have a text property. You need to call getFirstInstance() to get an instance which you can then change the text of.

    I strongly recommend taking the Learn JavaScript in Construct tutorial course which covers all of this kind of thing, in particular part 11 which covers Construct's APIs.

  • You can write your discord nickname, I will contact you and I can answer your questions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)