If the creature loses flying before Shadow Puppeteers's last ability resolves, the creature will still become a red Dragon with base power and toughness 4/4 in addition to its other colors and types until end of turn. It won't gain flying.