0

I am using flash CS5.5. I want create alert popup window in flash. When I publish LMS Meanwhile Google Chrome or Interenet Expoler used so i need to popup message.

This My code:

import flash.external.ExternalInterface; //for invoking JavaScript in 

alert_btn.addEventListener(MouseEvent.CLICK, btnExitHandler);

function btnExitHandler(e:Event):void 
{
    ExternalInterface.call("closeCourseWindow");
}

This is my code.. What am I doing wrong?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Sathis Jo
  • 21
  • 3

1 Answers1

1

It's hard to guess what's going on without any error message, but I'll give some tips, that may be causing the problem:

First make sure you allow ActionScript to access the javascript by setting allowscriptaccess with value always

<param name="allowscriptaccess" value="always"/>

If that's not the case make sure method exists closeCourseWindow and it does not behave strange.

Always use flash debugger to help you catch and solve the problems easily

To allow ActionScript access the JavaScript interface on file system, goto: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html select Always allow option, and reload the page where your alert box should work.

George G
  • 7,443
  • 12
  • 45
  • 59
  • Attempting to launch and connect to Player using URL C:\Users\Initech\Desktop\AlertBox.swf [SWF] C:\Users\Initech\Desktop\AlertBox.swf - 2908 bytes after decompression Error: Error #2067: The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime. at Error$/throwError() at flash.external::ExternalInterface$/call() at AlertBox_fla::MainTimeline/btnExitHandler()[AlertBox_fla.MainTimeline::frame1:15] Cannot display source code at this location. – Sathis Jo Aug 29 '14 at 08:22
  • Thanks George Garchagudashvili... just i need one popup message that what i gave in browser. so please help that ya..thats all – Sathis Jo Aug 29 '14 at 08:25
  • have you tried running the script on remote, localhost or with `file://` protocol? that matters, see this question: http://stackoverflow.com/questions/2307335/security-error-when-trying-to-call-actionscript-function-from-js – George G Aug 29 '14 at 08:27
  • Thanks george..but i cant understand that fourm..:( – Sathis Jo Aug 29 '14 at 08:59
  • I have to alert my popup message in LMS – Sathis Jo Aug 29 '14 at 09:00
  • i need online popup message – Sathis Jo Aug 29 '14 at 09:02
  • OK when you run your script in browser look at url does it starts with file://some/path/to/script.html ? or http://localhost... I mean it's better to upload your files on server and test it there, it should work. – George G Aug 29 '14 at 09:02
  • The problem is that ActionScript can't access the javascript interface, and I think this in case security sandbox is causing problem. – George G Aug 29 '14 at 09:03
  • i had to run my swf in interent expoler.but its not work..this is that loaction.C:\Users\Initech\Desktop.alert.html – Sathis Jo Aug 29 '14 at 09:05
  • Welcome anytime, glad to help you – George G Aug 29 '14 at 11:22