Haxe,OpenFL android debug 在 cpp 中给出错误

Haxe, OpenFL android debug giving error in for cpp

本文关键字:出错 错误 cpp OpenFL android debug Haxe      更新时间:2023-10-16

我正在使用Haxe和OpenFl在FlashDevelop中开发一个应用程序

当我在闪光目标中测试我的应用程序时,它工作正常。但是当我为 android 编译时,它在编译过程中会出现此错误:

./src/ReaderView2.cpp: In member function 'virtual Void ReaderView2_obj::setZoom()':
./src/ReaderView2.cpp:653: error: base operand of '->' has non-pointer type 'String'
Build halted with errors (haxelib.exe).

。这显然与 cpp 有关,我不是真正的专家。

有没有人知道错误意味着什么?

这是setZooom函数:(整个文件相当大)

public function setZoom()
{
    hideOptions();
    while (numChildren > 0)
    {
        Main.remove(getChildAt(0));
    }
    if (image != null) if (image.parent != null) image.parent.removeChild(image);
    images = new Array();
    field = new TextField();
    var fieldFont = Assets.getFont("fonts/Kreon-Regular.ttf");
    var format:TextFormat = new TextFormat(fieldFont.fontName, currentZoom, 0x4F4F4F);
    format.align = TextFormatAlign.LEFT;
    field.defaultTextFormat = format;
    field.embedFonts = true;
    field.text = fullText;
    field.selectable = false;
    field.wordWrap = true;
    field.border = false;
    field.autoSize = TextFieldAutoSize.LEFT;
    field.width = displayWidth;
    //field.x = 0;
    //split string into words
    var allParas:Array<String> = fullText.split("rn");
    var words:Array<String>;
    var fields:Array<TextField> = new Array();
    var tempField:TextField = null;
    var contentHeight:Float = displayHeight;
    var wordI:Int;
    var paraI:Int = 0;
    var tempArr2:Array<String>;
    while (paraI < allParas.length)
    {
        if (false) //check img tag
        {
        }
        else //if para is words
        {
            wordI = 0;
            words = allParas[paraI].split(" ");
            while (wordI < words.length)
            {
                if (tempField == null || tempField.textHeight > contentHeight)
                {
                    if (tempField != null) {
                        wordI--;
                        tempArr2 = tempField.text.toString().split(" ");

                        for (i in 0... tempArr2.length)
                        {
                            tempArr2.remove("");
                        }
                        tempArr2.pop(); 
                        tempField.text = tempArr2.join(" ");
                    }
                    tempField = new TextField();
                    tempField.defaultTextFormat = field.getTextFormat();
                    tempField.embedFonts = true;
                    tempField.text = "";
                    tempField.border = false;
                    tempField.selectable = false;
                    tempField.wordWrap = true;
                    tempField.autoSize = TextFieldAutoSize.LEFT;
                    tempField.width = displayWidth-2;
                    tempField.x = 0;
                    fields.push(tempField);
                }
                else 
                {
                    tempField.appendText(words[wordI] + (wordI == words.length - 1? "n": " "));
                    wordI++;
                }
            }
        }
        paraI++;
    }
    var bd:BitmapData;
    for (i in 0... fields.length)
    {
        bd = new BitmapData(Std.int(fields[i].width), Std.int(fields[i].height));
        bd.draw(fields[i]);
        images.push(new Bitmap(bd, PixelSnapping.AUTO, true));
    }
    //addChild(fields[0]);
    images[0].x = 10;
    addChild(images[0]);
    currentPageInstance = images[0];
    currentPage = 0;
    drawScrollBar();
    if (optionsBtn!=null)addChild(optionsBtn);
}

所以显然使用 toString() 函数会给 cpp 目标带来问题。

相关文章: