关于CCLabelTTF.setString时屏幕总是蓝一下的bug

给各位请安了。
先说下我的情况,我用的是cocos2d-x for xna,我做的游戏是3D游戏,我把cocos当一个工具类库来用的。我会在3D内容描绘完之后手动调用CCApplication.Draw()
我遇到的问题是,每当我给一个CCLabelTTF重新设置文字的时候屏幕就蓝一下,我查源码一直跟踪到CCTexture2D.cs里的
public bool initWithString(string text, CCSize dimensions, CCTextAlignment alignment, string fontName, float fontSize)
{
if (dimensions.width < 0 || dimensions.height < 0)
{
return false;
}

        if (string.IsNullOrEmpty(text))
        {
            return false;
        }

        SpriteFont font = CCApplication.sharedApplication().content.Load<SpriteFont>(@"fonts/" + fontName);
        if (CCSize.CCSizeEqualToSize(dimensions, new CCSize()))
        {
            Vector2 temp = font.MeasureString(text);
            dimensions.width = temp.X;
            dimensions.height = temp.Y;
        }

        Vector2 origin;
        if (CCTextAlignment.CCTextAlignmentRight == alignment)
        {
            origin = new Vector2(-(dimensions.width - font.MeasureString(text).X), 0);
        }
        else if (CCTextAlignment.CCTextAlignmentCenter == alignment)
        {
            origin = new Vector2(-(dimensions.width - font.MeasureString(text).X) / 2.0f, 0);
        }
        else
        {
            origin = new Vector2(0, 0);
        }

        float scale = 1.0f;//need refer fontSize;
        CCApplication app = CCApplication.sharedApplication();

        //*  for render to texture
        RenderTarget2D renderTarget = new RenderTarget2D(app.graphics.GraphicsDevice, (int)dimensions.width, (int)dimensions.height);
        app.graphics.GraphicsDevice.SetRenderTarget(renderTarget);
        app.graphics.GraphicsDevice.Clear(new Color(0, 0, 0, 0));

        app.spriteBatch.Begin();
        app.spriteBatch.DrawString(font, text, new Vector2(0, 0), Color.YellowGreen, 0.0f, origin, scale, SpriteEffects.None, 0.0f);
        app.spriteBatch.End();

        app.graphics.GraphicsDevice.SetRenderTarget(null);

        // to copy the rendered target data to a plain texture(to the memory)
        Color] colors1D = new Color;
        renderTarget.GetData(colors1D);
        texture2D = new Texture2D(app.GraphicsDevice, renderTarget.Width, renderTarget.Height);
        texture2D.SetData(colors1D);

        return initWithTexture(texture2D);

}
我觉得问题应该在这里,但我并不知道怎么回事。请各位大婶们帮帮忙,小弟跪拜了

搜了全论坛只有我发了一个wp7平台的问题,真是悲剧
还求老大们解决啊

— Begin quote from ____

263354299 发表于 2012-6-21 13:00 url

重新设置怎么会调用 initWithString ? init?

要么是空指针 要么是野指针, 是在不行重新创建一个label不就 …

— End quote

其他版本我不知道,xna版我看的源代码,是会调用的

— Begin quote from ____

263354299 发表于 2012-6-21 13:40 url

xna 用CS应该更好使的吧~ 不行就重新创建一个~

— End quote

重新创建性质是一样的,都会调用那个函数,只要一调用就会闪一下。