---------------------------------------------------
-------------------------------------------------
<?xml version="1.0"?>
<!-- wrapper/WrapperCaller.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import flash.external.*;
public function callWrapper():void {
var s:String;
if (ExternalInterface.available) {
var wrapperFunction:String = "changeDocumentTitle";
s = ExternalInterface.call(wrapperFunction,ti1.text);
} else {
s = "Wrapper not available";
}
trace(s);
}
</mx:Script>
<mx:Form>
<mx:FormItem label="New Title:">
<mx:TextInput id="ti1"/>
</mx:FormItem>
</mx:Form>
<mx:Button label="Change Document Title" click="callWrapper()"/>
</mx:Application>
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
<html><head>
<title>wrapper/WrapperBeingCalled.html</title>
</head>
<body scroll='no'>
<SCRIPT LANGUAGE="JavaScript">
function changeDocumentTitle(a) {
window.document.title=a;
alert(a);
return "successful";
}
</SCRIPT>
<h1>Wrapper Being Called</h1>
<table width='100%' height='100%' cellspacing='0' cellpadding='0'>
<tr>
<td valign='top'>
<object id='mySwf' classid='clsid:D27CDB6E-
AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/
pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' height='200'
width='400'>
<param name='src' value='WrapperCaller.swf'/>
<param name='flashVars' value=''/>
<embed name='mySwf' src='WrapperCaller.swf'
pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?
P1_Prod_Version=ShockwaveFlash' height='100%' width='100%'
flashVars=''/>
</object>
</td>
</tr>
</table>
</body></html>
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
I hope it will work...
On Dec 9, 2:30 pm, "Vinod M. Jacob" <[EMAIL PROTECTED]> wrote:
> I think you are opening the swf file which doesn`t have the javascript
> function.Try opening the html file which has javascript the swf file
> wrapped inside .
>
> On Tue, Dec 9, 2008 at 2:52 PM, koteshwar Rao myneni
>
>
>
> <[EMAIL PROTECTED]> wrote:
>
> > Hi all,
> > i am calling javascript function from action script ,,,, but i am get
> > the #2060 error
> > any help ...
> > =======================================
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> > layout="absolute">
> > <mx:Script>
> > <![CDATA[
> > public function callfun():void{
>
> > ExternalInterface.call("javascriptfunction");
> > }
> > ]]>
> > </mx:Script>
>
> > <mx:Button click="callfun()"/>
> > </mx:Application>
>
> > ====================================
> > <script type="text/javascript">
> > function javascriptfunction()
> > {
> > alert("Hello World! from javascript ");
> > }
>
> > </script>
>
> > ==================================
> > SecurityError: Error #2060: Security sandbox violation:
> > ExternalInterface caller file:///C:/Documents and Settings/myneni/
> > Desktop/testttttt/tt.swf cannot access file:///C:/Documents and
> > Settings/myneni/Desktop/testttttt/tt.html.
> > at flash.external::ExternalInterface$/
> > flash.external:ExternalInterface::_initJS()
> > at flash.external::ExternalInterface$/call()
> > at tt/callfun()
> > at tt/___tt_Button1_click()- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---