Alert.show()
Flash has a neat Alert-component (professional version) which easily lets you display messages to the user, with the common (optional) No, Yes and Cancel buttons. However, the component can only attach itself to a UIComponent, and the default component is the main window (_root). One cannot therefore, attach the Alert-box to a MovieClip, because it is not a UIComponent. Since one cannot specify the depth in which the Alert-box pops up, a problem arises when dynamically creating movieclips, loading content into them, and subsequently displaying the Alert-box. First impression is that the call fails silently (common Macromedia exception handling), however, by coincidence I realised that it pops up underneath the dynamically created movieclips. I find this behaviour a bit strange for an Alert-popup, I would expect it to top everything currently on stage, whether created dynamically or not. Anyway, one solution is as follows:import mx.controls.Alert;
var alertInstance:Alert = Alert.show("message here");
alertInstance.swapDepths(_root.getNextHighestDepth());
This will at least put it on top of everything. Another drawback however, is that the modality does not seem to affect dynamically created content.
1 Comments:
You're welcome! :)
Post a Comment
<< Home