It doesn't work because you are setting it up the wrong way.
TIdCustomTransparentProxy is an abstract base class, do not instantiate it directly. You need to use a descendant instead (TIdSocksInfo for a SOCKS proxy, TIdConnectThroughHttpProxy for an HTTP proxy, etc).
But more importantly, you are attaching the TransparentProxy to the wrong TCP connection. 'AContext.Connection' is the existing established TCP connection with the client that connected to TIdHTTPProxyServer. To pass that client's traffic with the target server through another proxy, you need to attach the TransparentProxy to 'AContext.OutboundClient' instead.
Try something more like this:
procedure TfrmMain.IdHTTPProxyServerHTTPBeforeCommand(AContext: TIdHTTPProxyServerContext);
var
tProxy: TIdConnectThroughHttpProxy;
begin
AContext.OutboundClient.CreateIOHandler;
tProxy := TIdConnectThroughHttpProxy.Create(AContext.OutboundClient.IOHandler);
tProxy.Host := '127.0.0.1';
tProxy.Port := 8888;
tProxy.Enabled := true;
AContext.OutboundClient.Socket.TransparentProxy := tProxy;
end;