Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 闪烁按钮隐藏一个DIV AS3_Actionscript 3_Flash Cs4 - Fatal编程技术网

Actionscript 3 闪烁按钮隐藏一个DIV AS3

Actionscript 3 闪烁按钮隐藏一个DIV AS3,actionscript-3,flash-cs4,Actionscript 3,Flash Cs4,我需要一些关于flash横幅的帮助。我需要在横幅中做一个隐藏div的按钮,我在AS2中找到了一种方法,但我需要使用AS3,我根本不知道ActionScript,所以我需要你的帮助 我发现了这段代码,不幸的是它在AS2中: on (release) { import flash.external.ExternalInterface; ExternalInterface.call("hideDiv", "operator"); } <script type="text/javascript"

我需要一些关于flash横幅的帮助。我需要在横幅中做一个隐藏div的按钮,我在AS2中找到了一种方法,但我需要使用AS3,我根本不知道ActionScript,所以我需要你的帮助

我发现了这段代码,不幸的是它在AS2中:

on (release) {
import flash.external.ExternalInterface;
ExternalInterface.call("hideDiv", "operator");
}

<script type="text/javascript">
function hideDiv(id)
{
   document.getElementById(id).style.display = 'none';
}
</script>
还有我的html正文

<body style="margin:0; padding:0">
<script>
function hideDiv("operator")
{
   document.getElementById("operator").style.display = 'none';
}
</script> 
<div id="operator">
<!--url's used in the movie-->
<!--text used in the movie-->
<!-- saved from url=(0013)about:internet -->
<script language="JavaScript" type="text/javascript">
    AC_FL_RunContent(
        'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
        'width', '100%',
        'height', '100%',
        'src', 'Kopia baner01',
        'quality', 'high',
        'pluginspage', 'http://www.adobe.com/go/getflashplayer',
        'align', 'top',
        'play', 'true',
        'loop', 'true',
        'scale', 'noscale',
        'wmode', 'transparent',
        'devicefont', 'false',
        'id', 'Kopia baner01',
        'bgcolor', '#ffffff',
        'name', 'Kopia baner01',
        'menu', 'true',
        'allowFullScreen', 'false',
        'allowScriptAccess','sameDomain',
        'movie', 'Kopia baner01',
        'salign', 't'
        ); //end AC code
</script>
<noscript>
        <object style="display: none" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="100%" height="100%" id="Kopia baner01" align="top">
        <param name="allowScriptAccess" value="sameDomain" />
        <param name="allowFullScreen" value="false" />
        <param name="movie" value="Kopia baner01.swf" /><param name="quality" value="high" /><param name="scale" value="noscale" /><param name="salign" value="t" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />  <embed src="Kopia baner01.swf" quality="high" scale="noscale" salign="t" wmode="transparent" bgcolor="#ffffff" width="100%" height="100%" name="Kopia baner01" align="top" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" />
        </object>

</noscript>
    </div>
</body>

函数hideDiv(“运算符”)
{
document.getElementById(“operator”).style.display='none';
}
AC_FL_RunContent(
“代码库”http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0',
“宽度”、“100%”,
“高度”、“100%”,
“src”、“Kopia baner01”,
"优质","高",,
'插件页','http://www.adobe.com/go/getflashplayer',
'对齐','顶部',
“玩”、“真的”,
'循环','真',
"规模","无规模",,
'wmode'、'transparent',
“偏差”、“错误”,
“id”,“Kopia baner01”,
‘bgcolor’、‘ffffff’,
'姓名','科皮亚·班纳01',
'菜单','正确',
“allowFullScreen”、“false”,
“allowScriptAccess”、“sameDomain”,
“电影”,“科皮亚·班纳01”,
“salign”,“t”
); //结束AC代码

如时间线所示,我在AS、AS2或AS3上没有任何技能,我想隐藏带有横幅的div,以便btn关闭AS3中的横幅,它将如下所示:

import flash.external.ExternalInterface;
import flash.events.MouseEvent;

closeBt.addEventListener(MouseEvent.CLICK, clickHandler);

function clickHandler(e:MouseEvent):void {
    ExternalInterface.call("hideDiv", "operator");
}

此代码假定您正在将脚本添加到时间线。如果您使用的是文档类,那么您应该在“function”之前添加一个“private”修饰符。您提到您在AS3方面不是很有经验,所以时间线将是目前的方向。但是,如果你对AS3很认真的话,一定要研究一下类。

试试这段AS3代码:

private function init():void
{
   closeBtn.addEventListener(MouseEvent.CLICK,onClick);
}


private function onClick(e:MouseEvent):void
{
    if(ExternalInterface.available)
        ExternalInterface.call("hideDiv","operator");
}
import flash.external.ExternalInterface;
closeBt.addEventListener(MouseEvent.CLICK, clickHandlerButton);
private function clickHandlerButton(e:MouseEvent):void{
    if(ExternalInterface.available) ExternalInterface.call("hideDiv","flashcontainer");
}

i、 我正在尝试在flash bannerTry中设置退出按钮,并在clickHandler中添加跟踪调用,以确认按钮正在被单击。另外,在进行外部接口调用之前添加if(ExternalInterface.available),如@Baris的示例。我更新了我的代码,trace说,按钮被点击了,我做错了什么??为什么在flash横幅上设置退出按钮如此困难?我发现一个错误函数hideDiv(操作员),而不是函数hideDiv(“操作员”),我不知道我在想什么
import flash.external.ExternalInterface;
closeBt.addEventListener(MouseEvent.CLICK, clickHandlerButton);
private function clickHandlerButton(e:MouseEvent):void{
    if(ExternalInterface.available) ExternalInterface.call("hideDiv","flashcontainer");
}