[solved] "Unexpected for" bug?

  • Hello all,

    I'm just getting into haxeflixel after having used flixel way back in the day. So far I have been really enjoying it.

    Does anyone have an idea why "for" loops do not seem to work for me? Wherever in the code I use the word "for," it throws up an "unexpected for" error. Any help would be greatly appreciated!


  • var can go anywhere after the class name such as class PlayState extends... , while most statements need to be inside a function. Its not a bug. you need to move the for code and place it inside the function.

  • Oh, it IS after the class name.

    In any case, after cutting and pasting some code around, and closing and reopening the project, it now magically works. Problem solved, I guess?

    Thanks for the help regardless.

  • administrators

    @blaise_rascal Yes, what he meant is that for loops are not allowed after a class name / directly in the class body. They must be inside a function.

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.