calling Javascript in Flex


hi

have mxml file has button control

<mx:button id="toggle" label="test" click="togglebutton()" />
when click on button want call javascript function. in mxml script have

public function togglebutton(): void
{
var f:string = "jstogglebutton";
var m:string = "this works";
var check:string;
if(externalinterface.available)
{
externalinterface.call(f,m);
check = "true"
}
else
{
check="false";
}
trace(check);
}
]]>


now created text file rightclicking on assets(the folder created) folder in project , new-->file.

i have written javascript in file , named javascripttoggle.html

this file has following code

<script language="javascript">
function jstogglebutton(m)
{
alert(m);
}
</script>

it not seem show alert box trace shows true externalinterface.available.

am missing important?????

i new flex. might simple of them. please bear me.


is javascript file included same html document swf embedded into?

if using flex builder might mean changing index.template.html file javascript function somewhere wihtin file


More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support