Hi guys,
I met a problem that whenever I call label1~~>setString this line below, the app go crash.
//Display Time
sprintf;
CCLabelTTF timeLabel = CCLabelTTF::create;
this~~>addChild;
timeLabel~~>setPosition);
//Get Time
void HelloWorld::step
{
_realTime += dt;
sprintf_realTime);
CCLabelBMFontlabel1 = this~~>getChildByTag(15);
//Crash Line
label1->setString(time_str);
}
Are you sure CCLabelBMFont *label1 = (CCLabelBMFont *)this~~>getChildByTag; actually returns the CCLabelBMFont?
Also, when you created it, you used CCLabelTTF timeLabel = CCLabelTTF::create;
When you get it back out you use CCLabelBMFontlabel1 = this~~>getChildByTag(15);
Are CCLabelTTF and CCLabelBMFont compatible?
Adam Reed wrote:
Are you sure CCLabelBMFont *label1 = (CCLabelBMFont *)this~~>getChildByTag; actually returns the CCLabelBMFont?
>
Also, when you created it, you used CCLabelTTF timeLabel = CCLabelTTF::create;
>
When you get it back out you use CCLabelBMFontlabel1 = this~~>getChildByTag(15);
>
Are CCLabelTTF and CCLabelBMFont compatible?
Thanks! I lose my eyes on it.
Adam Reed wrote:
Are you sure CCLabelBMFont *label1 = (CCLabelBMFont *)this~~>getChildByTag; actually returns the CCLabelBMFont?
>
Also, when you created it, you used CCLabelTTF timeLabel = CCLabelTTF::create;
>
When you get it back out you use CCLabelBMFontlabel1 = this~~>getChildByTag(15);
>
Are CCLabelTTF and CCLabelBMFont compatible?
Thanks! I lose my eyes on it.