views:

675

answers:

1

Hello, I am trying to write a simple dialog that is called by the flash image gallery on the site and appears on this flash animation but it works pretty weird under IE such as:

-sometimes showing several of the same item, how can I prevent opening dialog if there is one already existing? -after opening a dialog and when trying to close it, it simply stays there, if I minimize IE and maximize back, that dialog dissapears. -under firefox, the dialog appears but the loaded content can't be seen unless I move my mouse over the dialog, that time the content inside the dialog appears.

Here is my HTML:

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link type="text/css" href="/media/style.css" rel="stylesheet" />
  <link type="text/css" href="/media/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
  <script type="text/javascript" src="/media/jquery.js"></script>
  <script type="text/javascript" src="/media/jquery-ui-1.7.2.custom.min.js"></script>
  <script language="javascript">AC_FL_RunContent = 0;</script>
  <script type="text/javascript" src="/media/AC_RunActiveContent.js"></script>
  <script type="text/javascript">
</script>
</head>
<body bgcolor="#000000">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<center>
<script language="javascript">
    function showItem(i){
      var url = "/item/?i="+i;
      var dialog = $('<div style="display:hidden"></div>').appendTo('body');
      dialog.load(
       url, 
       {},
       function (responseText, textStatus, XMLHttpRequest) {
        dialog.dialog({show:'blind',hide: 'slide',resizable: false,width: 'auto',height: 'auto',modal:true});
        //kapat: buttons: { "Kapat": function() { $(this).dialog("close"); } }
       }
      );
      return false;
  }


    if (AC_FL_RunContent == 0) {
     alert("This page requires AC_RunActiveContent.js.");
    } else {
     AC_FL_RunContent(
      'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
      'width', '100%',
      'height', '600',
      'src', '/media/preview',
      'quality', 'high',
      'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
      'align', 'middle',
      'play', 'true',
      'loop', 'true',
      'scale', 'noScale',
      'wmode', 'transparent',
      'devicefont', 'false',
      'id', 'preview',
      'bgcolor', '#2e2e2e',
      'name', 'preview',
      'menu', 'true',
      'allowFullScreen', 'false',
      'allowScriptAccess','sameDomain',
      'movie', '/media/preview',
      'salign', ''
      ); //end AC code
    }
</script>
<noscript>
    <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1024" height="850" id="preview" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="allowFullScreen" value="false" />
    <param name="movie" value="/media/preview.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /> <embed src="/media//media/preview.swf" quality="high" bgcolor="#000000" width="100%" height="850" name="preview" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </object>
</noscript>
</center>
</body>
</html>
+1  A: 

You could add an id to your div and call the isOpen method on the dialog to check if it is open like this...

    function showItem(i){
            if($("#dialogId").dialog('isOpen') return false;
            var url = "/item/?i="+i;
            var dialog = $('<div id="dialogId" style="display:hidden"></div>').appendTo('body');

}

Or to check if the div has been made into a dialog like this...

        function showItem(i){
            if($('#dialogId').is(':data(dialog)')) return false;
            var url = "/item/?i="+i;
            var dialog = $('<div id="dialogId" style="display:hidden"></div>').appendTo('body');

}

Jace Rhea