0

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

当我在 Flash 目标中测试我的应用程序时,它工作正常。但是当我为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("\r\n");
    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);
}
4

1 回答 1

0

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

于 2014-02-23T18:12:50.793 回答