complete working Flex and code generator