Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-17-2012, 04:20 AM   #1
EagerFlash
Registered User
 
Join Date: Apr 2012
Posts: 16
Default problem with addCallback in FF and GC

Hi,

I am trying to get ExternalInterface.addCallback to work, and it works fine in IE but not in FF and Chrome.

Any idea why?

THanks.
EagerFlash is offline   Reply With Quote
Old 04-17-2012, 06:12 PM   #2
jsprclimber123
Breaking things...
 
Join Date: Jan 2010
Posts: 635
Default

Without seeing your code, it's hard to know why.
jsprclimber123 is offline   Reply With Quote
Old 04-17-2012, 09:06 PM   #3
EagerFlash
Registered User
 
Join Date: Apr 2012
Posts: 16
Default

import fl.controls.TextArea;
import flash.external.ExternalInterface;
import flash.system.Security;

Security.allowDomain("*");

var nonce:Number = 0;

function attestation(x:Number):Boolean {
trace("attestation");
if ((x!=0) && (x==nonce)) {
nonce=0;
return true;
}
return false;
}

ExternalInterface.addCallback("attest_callback", attestation);
ExternalInterface.call("registerAScallback", ExternalInterface.objectID);

nonce = 1234;
ExternalInterface.call("attestAS", ExternalInterface.objectID, nonce);
EagerFlash is offline   Reply With Quote
Old 04-17-2012, 09:08 PM   #4
EagerFlash
Registered User
 
Join Date: Apr 2012
Posts: 16
Default

<html>
<head>
<title>file upload</title>
</head>

<body>
<button onclick="CallFlashFun();">Call AS Function!</button><br/>
<br/>
<div style="width: 290px; height: 100px; overflow: hidden;">
<embed id="flashObject" width="290" height="100" classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000"
type="application/x-shockwave-flash">
<param name="movie" value="./hamlen.swf" />
<param name="quality" value="high" />
<param name="allowScriptAccess" value="always" />
<embed name="flashObject" width="100%" height="100%" wmode="transparent" allowScriptAccess="always" width="290" height="100" type="application/x-shockwave-flash" src="./hamlen.swf"/>
</embed>
</div>

<script type="text/javascript">
(function(){
var AScallbacks = [];

registerAScallback = function(id){
alert("id is "+id);
var e = document.getElementById(id);
alert("e is "+e);
if (!e) { alert('failed to find '+id); return; }
//if (!('attest_callback' in e)) { alert(id+' has no attest_callback'); return; }
AScallbacks[id] = e.attest_callback;
alert("AScallbacks[id]"+AScallbacks[id]);
e.attest_callback = null;
}
}
})();

</script>
</body>
</html>
EagerFlash is offline   Reply With Quote
Old 04-17-2012, 09:29 PM   #5
EagerFlash
Registered User
 
Join Date: Apr 2012
Posts: 16
Default

so the line in registerAScallback "e.attest_callback" is undefined in Firefox and Chrome, but is ok in IE.
EagerFlash is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:22 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.