Flash 在隐藏时丢失变量

发布于 2024-11-30 08:58:29 字数 2109 浏览 1 评论 0原文

我在 div 中有一个 flash 文件。该 div 设置为可见 (display:block;)。该 div 有两个姐妹 div。所有三个 div 均由自定义构建的 jQuery 选项卡控制,因此当单击另一个选项卡时,当前可见的 div 将变为 display:none;。当重新单击该选项卡以将 flashes div 设置为 display:block 时,Flash 文件会丢失其存储的所有值(例如,在文本区域中,所有文本都会重置,并且元素存储的位置)图像的路径,该路径被重置)。

我尝试过其他方法,例如 width:0; height:0;,这种方法可行,但由于 flash 文件比其他两个 div 大,因此它在下面仍然可见。所以然后我尝试了 overflow:hidden; 但仍然出现与上面相同的问题(丢失值)。

visibility:hidden 不适用,因为 Flash 文件应有的位置有很大的空白区域。

位置:绝对;顶部:-800px; left:-600px; 丢失变量。

边框:0;剪辑:矩形(0 0 0 0);高度:1px;边距:-1px;溢出:隐藏;填充:0;位置:绝对; width: 1px; 也会丢失变量。

我还可以使用其他方法吗?我也有 wmode=transparent

下面是我的 flash 嵌入的代码:

<object wmode="transparent" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="690" height="2047" id="gdh_v3_1" align="middle">
            <param  name="allowScriptAccess" value="sameDomain" />
            <param name="movie" value="gdh_v4.swf?rnd=6389" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#ffffff" />
            <param name="wmode" value="transparent"> 
            <param name="FlashVars" value="forcecrop=False&submitted=False&headerfile=&footerfile=&xmlfile=<?php echo $_GET['adfolder'];?>.xml&adfolder=<?php echo $_GET['adfolder'];?>&pics=gld101cc%2Ejpg%2C" />
            <embed wmode="transparent" src="gdh_v4.swf?rnd=6389" FlashVars=forcecrop=False&submitted=False&headerfile=&footerfile=&xmlfile=<?php echo $_GET['adfolder'];?>.xml&adfolder=<?php echo $_GET['adfolder'];?>&pics=gld101cc%2Ejpg%2C" quality="high" bgcolor="#ffffff" width="690" height="2047" name="gdh_v4" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </object>

I have a flash file in a div. This div is set to visible (display:block;). The div has two sister divs. All three divs are controlled by custom built jQuery tabs, so when another tab is clicked, the currently visible div turns display:none;. When the tab is reclicked to set the flashes div to display:block, the flash file loses all its values that are stored (for example in a textarea, all the text gets reset, and where a element stores a path to the image, that gets reset).

I have tried other methods like width:0; height:0;, which sort of works, but as the flash file is larger than the other two divs, it is still visible underneath. So then I tried overflow:hidden; but the same issue still occurs as above (losing values).

visibility:hidden isn't applicable as there is a large white space where the flash file should be.

position:absolute; top:-800px; left:-600px; loses variables.

border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; also loses variables.

Is there any other method I can use? I have wmode=transparent aswell.

Below is the code of my flash embed:

<object wmode="transparent" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="690" height="2047" id="gdh_v3_1" align="middle">
            <param  name="allowScriptAccess" value="sameDomain" />
            <param name="movie" value="gdh_v4.swf?rnd=6389" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#ffffff" />
            <param name="wmode" value="transparent"> 
            <param name="FlashVars" value="forcecrop=False&submitted=False&headerfile=&footerfile=&xmlfile=<?php echo $_GET['adfolder'];?>.xml&adfolder=<?php echo $_GET['adfolder'];?>&pics=gld101cc%2Ejpg%2C" />
            <embed wmode="transparent" src="gdh_v4.swf?rnd=6389" FlashVars=forcecrop=False&submitted=False&headerfile=&footerfile=&xmlfile=<?php echo $_GET['adfolder'];?>.xml&adfolder=<?php echo $_GET['adfolder'];?>&pics=gld101cc%2Ejpg%2C" quality="high" bgcolor="#ffffff" width="690" height="2047" name="gdh_v4" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
        </object>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

合约呢 2024-12-07 08:58:29

几年前我也遇到过同样的问题,我认为你需要使用这两种方法; 高度:0可见性:隐藏。即使您隐藏 Flash 对象,Internet Explorer 也会保留它,以避免 Internet Explorer 7 在高度设置为 0 时出现错误渲染,您可以添加例外。

下面是一个示例代码,

假设 oldTab 是一个全局变量,默认设置为 1,newT 由点击事件设置。

if(newT != oldTab){
  if($.browser.msie){
    window.document.getElementById("t"+ oldTab).style.display = "none";
    window.document.getElementById("t"+ newT).style.display = "block";
  }
  else{
    window.document.getElementById("t"+ oldTab).style.height = "0px";
    window.document.getElementById("t"+ oldTab).style.visibility = "hidden";

    window.document.getElementById("t"+ newT).style.height = "auto";
    window.document.getElementById("t"+ newT).style.visibility = "visible";
  }
  oldTab = newT;
}

I had the same issue years ago, I think you need to use both approchs; height:0 and visibility:hidden. Internet explorer will maintain the flash object even if you hide it to avoid Internet explorer 7 bad render when the height is set to 0 you can add an exception.

Here is a sample code

assume oldTab a global var that is set by default to 1, newT is set by the click event.

if(newT != oldTab){
  if($.browser.msie){
    window.document.getElementById("t"+ oldTab).style.display = "none";
    window.document.getElementById("t"+ newT).style.display = "block";
  }
  else{
    window.document.getElementById("t"+ oldTab).style.height = "0px";
    window.document.getElementById("t"+ oldTab).style.visibility = "hidden";

    window.document.getElementById("t"+ newT).style.height = "auto";
    window.document.getElementById("t"+ newT).style.visibility = "visible";
  }
  oldTab = newT;
}
﹏雨一样淡蓝的深情 2024-12-07 08:58:29

使用 SharedObjects (AS3) 适合您吗?可以只将变量存储在那里。

var sh:SharedObject = SharedObject.getLocal("something");

// set values
sh.data.someVar = "Some value";

这里唯一的问题是,如果他们将来任何时候访问您的网站,这些值将保留(这对您来说可能不是一件好事,但同样它可能是一件很棒的事情)。

Is using SharedObjects (AS3) an option for you? Could just store the variables in there.

var sh:SharedObject = SharedObject.getLocal("something");

// set values
sh.data.someVar = "Some value";

Only issue here is that the values will remain if they view your site any time in the future (which may not be a good thing in your case, then again it might be an awesome one).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文