Custom right click menu works but

When I click simulate download my custom right click menu only appears once the movie has loaded. I have a layer called “actions” that contains this code:

var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
this.contextMenu = myMenu;

How can I make it so that my custom menu works while it’s preloading?