Gauge vs. gravity mediation in models with anomalous U(1)'s