MegaEdit has a number of default scripts avaliable to use (MegaEdit PRO version ONLY). Here we look at the Mask support script and how to apply to a product.
Firstly enable the script against your chosen dynamic product under the dynamic products setup displayed below.
You are now required to set a tag of "mask" against a field under the options tab of a fields pop up which will activate the script and that chosen field will remain the top layer when new text or image fields are added.
Below I have added a single image field and that is automatically placed behind my mask tagged field.
Then below I have added a second image field and that is placed behind my mask field, but, atop of the previous image field.
All subsequent fields are placed behind the mask layer.