Callbacks add powerful functionality to the FlxG.overlap() function. You can define two callbacks: NotifyCallback and ProcessCallback.

In the ProcessCallback function, you can do your own, custom checks to determine if your objects actually should trigger an overlap.

In the NotifyCallback function, you can specify what you want to happen when an overlap is detected.

// if objectA overlaps objectB, doOverlapCheck will be called. If that returns true, then doOverlap will be called
FlxG.overlap(objectA, objectB, doOverlap, doOverlapCheck);

// doOverlapCheck will return true only if objectA is moving to the right when an overlap is detected
private function doOverlapCheck(objectA:FlxObject, objectB:FlxObject):Bool
{
	return objectA.velocity.x > 0;
}

Demonstration

package;

import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;

class PlayState extends FlxState
{
	var sprite:FlxSprite;
	var box:FlxSprite;
	var overlaps:Bool;
	
	override function create()
	{
		super.create();
		
		box = new FlxSprite("assets/bigbox.png");
		box.screenCenter();
		add(box);
		
		sprite = new FlxSprite("assets/sprite.png");
		sprite.y = FlxG.height / 2 - sprite.height / 2;
		sprite.velocity.x = 100;
		add(sprite);
	}
	
	override function update(elapsed:Float)
	{
		super.update(elapsed);
		
		// if touching the right side of the screen
		if (sprite.velocity.x > 0 && sprite.x >= FlxG.width - sprite.width)
		{
			sprite.velocity.x *= -1;
		}
		// if touching the left side of the screen
		else if (sprite.velocity.x < 0 && sprite.x <= 0)
		{
			sprite.velocity.x *= -1;
		}
		
		overlaps = false;
		FlxG.overlap(sprite, box, doOverlap, doOverlapCheck);
		box.alpha = overlaps ? 0.5 : 1;
	}
	
	function doOverlap(objectA:FlxSprite, objectB:FlxSprite)
	{
		overlaps = true;
	}
	
	function doOverlapCheck(objectA:FlxSprite, objectB:FlxSprite):Bool
	{
		return objectA.velocity.x > 0;
	}
}