I think I've figured it out. I set up the layer data source incorrectly and used the wrong name for a property.
Here's my revised code:
var rightTableSource = new LayerDataSource();
rightTableSource.dataSource = new TableDataSource({
workspaceId: "[workspaceid]",
dataSourceName: "[tablename]"
});
var leftTableSource = new LayerMapSource({
mapLayerId: 0
});
var joinDataSource = new JoinDataSource({
joinType: "left-outer-join",
leftTableKey: "Name",
rightTableKey: "Name",
leftTableSource: leftTableSource,
rightTableSource: rightTableSource
});
var layerDataSource = new LayerDataSource();
layerDataSource.dataSource = joinDataSource;
I tried to set the feature layer source as a JoinDataSource, when it really needs to be a Layer Data Source. And the Layer Data Source has it's "dataSource" (not "source") as the JoinDataSource. "Source" is the property name in the Flex API. Got a bit crossed up! This should work as the source for a feature layer and query task.