Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17082

Problem with labelTTF getContentSize on android

$
0
0

@marcinwal wrote:

I have the following code which works fine in the browser but I cannot get contentSize while running it on android device.

    var elementNameLevel = new cc.LabelTTF("", "Helvetica",this.winSize.height / 15);
    elementNameLevel.setColor(cc.color(255,102,0));
    elementNameLevel.setString(this.elementName);
    elementNameLevel.setPosition(cc.p(this.winSize.width / 2 , startY));
    elementNameLevel.enableStroke(cc.color(0,0,0),2,true);
    this.congsLayer.addChild(elementNameLevel,3);
    var widthLetter = elementNameLevel.getContentSize().width;

widthLetter returns 0 most likely due to delayed callback results if I am correct. How should I read that value?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17082

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>