문제

I'm developing an app in FlashDevelop, using Haxe and OpenFl

When I test my app in flash target, it works fine. But when I compile for android, it comes up with this error during the compilation:

./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).

...Which is obviously something to do with cpp, which I'm not really an expert.

Does any body know what the error means?

Here's the setZooom function: (the whole file is quite large)

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);
}
도움이 되었습니까?

해결책

So apparently using the toString() funcion gives problems for a cpp target.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top