FlxTilemap has a built-in autotile system, which allows you to easily create tilemaps with repeating tiles.

There are 3 ‘flavors’ of autotiling available:

FlxTilemapAutoTiling.AUTO is best for ‘thin’ walls and maps with lots of open space.

Autotiles
This image contains 16 8x8 pixel tiles in the layout used for FlxTilemapAutoTiling.AUTO.

FlxTilemapAutoTiling.ALT is best for ‘thick’ walls and maps with lots of walls with smaller, internal spaces.

Autotiles Alt
This image contains 16 8x8 pixel tiles in the layout used for FlxTilemapAutoTiling.ALT.

FlxTilemapAutoTiling.FULL is best for is the ‘best of both worlds’ and should handle both types of maps.

Autotiles Full
This image contains 48 8x8 pixel tiles in the layout used for FlxTilemapAutoTiling.FULL.

Why not just always use FlxTilemapAutoTiling.FULL? Your individual project may not need to do all 48 tile configurations, so sticking with just FlxTilemapAutoTiling.AUTO or FlxTilemapAutoTiling.ALT may cut down on the number of tiles you need to draw.

Note: You can use customTileRemap to build your own auto-tiling map logic. This is especially useful if you want to use something like FileTilemapExt to do slopes, as an example.
map.loadMapFromCSV(mapData, tilesImage, tileWidth, tileHeight, FlxTilemapAutoTiling.AUTO);

Demonstration

package;

import flixel.FlxState;
import flixel.text.FlxText;
import flixel.tile.FlxBaseTilemap.FlxTilemapAutoTiling;
import flixel.tile.FlxTilemap;

class PlayState extends FlxState
{
	var map_auto:FlxTilemap;
	var map_alt:FlxTilemap;
	var map_full:FlxTilemap;

	override public function create()
	{
		bgColor = 0;

		map_auto = new FlxTilemap();
		map_auto.loadMapFromCSV("assets/room-map.csv", "assets/autotiles.png", 8, 8,
			FlxTilemapAutoTiling.AUTO);
		add(map_auto);

		map_alt = new FlxTilemap();
		map_alt.loadMapFromCSV("assets/room-map-alt.csv", "assets/autotiles_alt.png", 8, 8,
			FlxTilemapAutoTiling.ALT);
		map_alt.x = map_auto.width;
		add(map_alt);

		map_full = new FlxTilemap();
		map_full.loadMapFromCSV("assets/room-map-full.csv", "assets/autotiles_full.png", 8, 8,
			FlxTilemapAutoTiling.FULL);
		map_full.y = map_auto.height;
		add(map_full);

		var text:FlxText = new FlxText(0, 0, 0, "AUTO");
		text.size = 16;
		text.color = 0xFF28288e;
		text.alignment = FlxTextAlign.CENTER;
		text.setBorderStyle(FlxTextBorderStyle.SHADOW, 0xffc9c9e6);
		text.x = map_auto.x + (map_auto.width / 2) - (text.width / 2);
		text.y = map_auto.y + (map_auto.height / 2) - (text.height / 2);
		add(text);

		text = new FlxText(0, 0, 0, "ALT");
		text.size = 16;
		text.color = 0xFFa3e6b4;
		text.alignment = FlxTextAlign.CENTER;
		text.setBorderStyle(FlxTextBorderStyle.SHADOW, 0xff1a4324);
		text.x = map_alt.x + (map_alt.width / 2) - (text.width / 2);
		text.y = map_alt.y + (map_alt.height / 2) - (text.height / 2);
		add(text);

		text = new FlxText(0, 0, 0, "FULL");
		text.size = 16;
		text.color = 0xFF3c341a;
		text.alignment = FlxTextAlign.CENTER;
		text.setBorderStyle(FlxTextBorderStyle.SHADOW, 0xffe6cd84);
		text.x = map_full.x + (map_full.width / 2) - (text.width / 2);
		text.y = map_full.y + (map_full.height / 2) - (text.height / 2);
		add(text);

		super.create();
	}
}