[英]How can I get and set the selected radio button in external HTML content through actionscript?
I am new in flash and as3. 我是Flash和AS3的新手。
I am using an external html file through mx:html in Flash. 我正在通过Flash中的mx:html使用外部html文件。
<fx:Script>
...
myHTML.location = "../assets/myHTML.htm";
...
</fx:Script>
<mx:HTML id="myHTML"/>
There are 3 radio buttons in this myHTML.htm file. 此myHTML.htm文件中有3个单选按钮。
Is there any way to get and set the selected radio button through actionscript? 有什么方法可以通过动作脚本获取和设置选定的单选按钮吗?
I am developing an AIR application. 我正在开发AIR应用程序。 And as far as I come to know that the ExternalAPI will not work. 据我所知,ExternalAPI将无法正常工作。 Actually I want to use multiple HTML files of quiz question with radio buttons. 实际上,我想使用带有单选按钮的测验问题的多个HTML文件。
由于缺乏MXML经验及其应用,有些犹豫,我将研究AS3的ExternalInterface http://help.adobe.com/zh_CN/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html及其在Flex中使用http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_4.html
Nobody tell me this simple code: 没人告诉我这个简单的代码:
In Flex/Actionscript: 在Flex / Actionscript中:
function initial():void
{
html.addEventListener(Event.HTML_DOM_INITIALIZE,loaded);
}
function loaded(e:Event):void
{
html.htmlLoader.window.getOption = getOption;
}
function setvalue():void
{
html.htmlLoader.window.selectradio(radioButtonID);
}
function getOption(value:String):void
{
trace(value);
}
in HTML file 在HTML文件中
<SCRIPT LANGUAGE="JavaScript">
function selectradio(selectvalue)
{
document.getElementById(selectvalue).checked = true;
}
</SCRIPT>
<INPUT ID="a" TYPE="radio" NAME="op" onClick="getOption('a')"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.