Sure! it works best if the heart also starts out solid (not just a colored outline). Then make two sprites, one with the heart costume, and the other with the flag. place them above each other and scale them as you wish, then let the flag sprite paste itself onto the heart sprite. That's it! Now you can hide the flag sprite and what's left is a heart showing the flag!
Does that make sense?