Whenever a creature with flying attacks, it loses flying until end of turn.
After attackers are declared and any Gravity Well abilities have resolved, a spell or ability that grants flying to a creature will work normally. This includes other abilities that trigger “whenever [a creature] attacks” (such as the one Order of the Golden Cricket has).
This ability triggers and resolves during the declare attackers step. The creature will no longer have flying by the time blockers are declared.