Archive
External Interface with javascript confirm “bug”
I am working with External Interface in Flash and I encountered a problem which I am recreating here. Below you should see a Flash based (AS3) button that says "Show Alert". If you click it a javascript confirm dialog will appear. You will also notice that the button stays in it's down state. If you wait more that 15 seconds to confirm, the Flash Player complains that a script has been running too long. This is unexpected since I would assume that clicking a button in Flash and Javascript responding after a confirm dialog should be an asynchronous event. I tried this using the "MouseEvent.MOUSE_UP" event and got the same result. See below for the error response, javascript and actionscript code.
(note: you should see "from javascript" when you agree to the confirmation dialog box if the call succeeds. If the call fails and you have the debug Flash Player version installed you should see an alert window with the error below. If you do not have the debug player and the call fails you will see nothing.)
Error: Error #1502: A script has executed for longer than the default timeout period of 15 seconds.
at
at flash.external::ExternalInterface$/_evalJS()
at flash.external::ExternalInterface$/call()
at showAlert_fla::MainTimeline/handleClick()
Funny though. Flex has no problem:
-
function fromFlash(){
-
if(confirm("Talk to Flash?")) toFlash();
-
}
-
-
function toFlash(){
-
thisMovie("showAlert").toFlash("from javascript");
-
}
-
-
function thisMovie(movieName) {
-
if (navigator.appName.indexOf("Microsoft") != -1) {
-
return window[movieName]
-
}
-
else {
-
return document[movieName]
-
}
-
}
-
alertButton.addEventListener(MouseEvent.CLICK, handleClick);
-
-
ExternalInterface.addCallback("toFlash", responseFromJavascript);
-
-
function handleClick(p_evt:MouseEvent):void{
-
responseTF.text = "";
-
ExternalInterface.call("fromFlash");
-
}
-
-
function responseFromJavascript(p_response:String):void{
-
responseTF.text = p_response;
-
}
Creating Flash content with Sprout
I have been playing around with Sprout and I am blown away. As a flex developer and a visual communication designer I know how hard it is to build a really awesome UI. It takes hard work. Iteration. Tweeking and more tweeking. Sweating over pixels! The Sprout guys have done an AMAZING job with this Flex app. And the kudos don't end there. It is a great idea and a slick implementation. Here is my first sprout. At this time it does not seem to be able to load the news feed ... not sure what is up with that.
UPDATE: I tinkered with the RSS URL and got it to work. Yay!