TextWidth causing error code

0 favourites
  • 6 posts
From the Asset Store
5 levels with simple coding Source-code (.c3p) + HTML5 Exported
  • I have two sliders, one that changes TextWidth and another that changes TextHeight. The sliders are doing the job but I want a sprite to change so it is the same width and height of the text (not text box). I am using an awesome addon from Rex Rainbow called BBcode Text. The Sprite height is changing with the TextHeight but there is an error that appears for the TextWidth.

    I have attached the code that I am using and the error that appears when using the TextWidth.

    Does anyone have a work around or suggestion to help fix this?

  • TextWidth and TextHeight are read-only properties, you can't change them.

    Did you mean "Text: set Width" and "Text: Set Height" actions?

    Also, I don't see any code attached to your post. If you are trying to attach an image, after uploading it you need to insert it into the message using the img tag:

    [img=XXXX]
  • Thanks for the help with posting my image! Could you take a look the code? For some reason the set height works but the width does not.

  • I think you need to use BBCodeText.Width and BBCodeText.Height - the width and height of text object.

    .

    TextWidth and TextHeight properties are for measuring the actual text. (for example you can stretch the text object to be 1000px wide, but if you put only one word in it, TextWidth will return 50px)

    TextWidth and TextHeight become available after a small delay, because the system needs time to render the text. You are trying to access them on every tick, and that's probably why you are getting the error. Or maybe your text is empty. Or there is a bug in BBCode addon.. Who knows :)

  • I added a delay and it fixed the error. Thanks you!!!!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I hope you didn't add "wait" into event #4? Using waits in events that are triggered on every second is a bad idea.

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