I'm trying to create a single general use dialog requestor, but it
isn't working like it should (or at least like I'm expecting it to). 
Everything loads fine, proper configuration of popups on button click,
but the eventHandlers don't do anything.

Also, why does the OK button not resize to fit the text "Archive" ? 
Do I have to resize it manually?  How?

Thanks

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
<mx:Script>
<![CDATA[
        var objCoInfo:Object  = { coname:"Company Name" };
        
        [Embed(source="warning_icon.jpg")] 
   var iconWarning:String;
        [Embed(source="critical_icon.jpg")]
        var iconCritical:String;
        
        function popupDialog(icon:String, text:String, title:String,
button1:String, eventListener:String):Void {
                var titleStyles = new mx.styles.CSSStyleDeclaration();
                titleStyles.setStyle("fontWeight", "bold");
                mx.controls.Alert.titleStyleDeclaration = titleStyles;
                mx.controls.Alert.okLabel = button1;
                mx.controls.Alert.show(text, title, mx.controls.Alert.CANCEL |
mx.controls.Alert.OK, this, eventListener, icon,
mx.controls.Alert.CANCEL);
        }
        
        function deleteHandler(event):Void {
                if (event.detail==mx.controls.Alert.OK) {
                        mx.controls.Alert.show("Delete Record");
                }
        }
        
        function archiveHandler(event):Void {
                if (event.detail==mx.controls.Alert.OK) {
                        mx.controls.Alert.show("Archive");
                }
        }
]]>
</mx:Script>
<mx:Button label="Delete Record" click="popupDialog(iconCritical, 'Are
you sure you want to delete this record?', 'Delete Record', 'Delete',
'deleteHandler');"/>
<mx:Button label="Archive Record" click="popupDialog(iconWarning, 'Are
you sure you want to archive this record?', 'Archive Record',
'Archive', 'archiveHandler');"/>
</mx:Application>




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to