ExternalInterface.addCallback() not working

Ok, I have tried this both ways but can get no communication
between AS and JS.
I have tried it in IE7, FF2 and GC but to no avail.
I'm exporting to FlashPlayer 8.
In FF2 I get "f.setObjType is not a function".
In IE7 I get "Object doesn't support this property or
method".
Any help is greatly appreciated...this is driving me nuts for
a tiny little script.
Thanks,
Paul

quote:
Originally posted by:
kglad
i use AC_RunActiveContent.js in all my projects (unless i'm
using swfobject) and i've never had a problem. you're just not
using the correct code for callback.
What exactly do you mean by "not using the correct code"?
I tried a stripped down version and found there to be a
cross-site policy issue caused by me using www and non-www, so
after fixing that I got the stripped down version working. I then
used the same code in my page and it didn't work.
If you look here:
http://gtra.org/vg_data/fileupload_gtra.html
clicking the button checks to see what type of object the
"supposed" function is, and you will see it returns "function"
Now "practically" the same code here:
http://www.gtra.org/site.php?comp_id=prof&cmd=view_page&user=1&page=3
Clicking on the "upload" link where it says "Resume: view |
upload" and we get an "undefined" value.
The only real difference in these two area is that the first
has the script and swf in the same folder, while the latter has the
swf in the root folder and the script elsewhere, but then the
script is rendered to the browser from a page in the root.
Logically this makes no sense.
ANY help is helpful right now as I am pulling my hair
out.

Similar Messages

  • Geturl or ExternalInterface does not work in Firefox 2.0

    This works in IE7:
    on (release) {
    var callJas:String = 'javascript:abrir_faleconnosco()';
    getURL(callJas);
    But when using the same html with flash in Firefox, the Flash
    never makes the call to the javascript function. I tried also with
    button_1.onRelease =function(){
    ExternalInterface.call("window.open","
    http://www.adobe.com", "win",
    "height=200,width=300,toolbar=no,scrollbars=yes");}
    But again works in IE7 but not in Firefox 2.
    In the publishing i changed the local playback security to
    access network only to see if it made any difference.
    Can any one help me?

    Is there any chance that you have Javascript disabled in
    Firefox?

  • ExternalInterface is not working?

    Hi all,
    I have an issue with ExternalInterface.call, it's working fine in IE but not in Chrome I don't know why? is there any solution? please let me know. Bellow you can find the code. Thanks in advance.
    AS Code:
    import flash.external.ExternalInterface;
    var req:String
    var msg:String
    site_btn.addEventListener(MouseEvent.CLICK, gotowebsite)
    function gotowebsite(event){
            req = "http://www.google.com/"
            if( ExternalInterface.available ) {
                     Security.allowDomain(req);
                     ExternalInterface.call( "downloadFileFromAS", req );
                     msg="good"
            }else{
                    msg="error in ExternalInterface"
          msg_txt.text=req
    JS Code:
    <script type="text/javascript">
         function downloadFileFromAS(_fileURL ) {
               window.open(_fileURL,"_blank");
    </script>
    Thanks and Regards
    Santhosh Kumar M

    Change the value of "allowScriptAccess" param to "always" from "sameDomain" in the generated HTML, if you are testing your html from the local file system. If you host it on a webserver, this would not be required.
    Take a look @ http://helpx.adobe.com/flash-player/kb/changes-allowscriptaccess-default-flash-player.html #main_DIAGNOSIS for more details.
    -Dharmendra.

  • ExternalInterface.call not working

    ***Flash CS4 -published to AS3.0 and Player  10***
    I am having a problem using ExternalInterface.call to a javascript  function. I have used this method many times in many places and at some  point during this project, it was working, but now it stalls my Flash  file when executed.
    I have the function:
    var initialize=function(){
    ExternalInterface.call("SCOInitialize");
    statusTxt.text="initializing";
    On my html page, there is a SCOInitialize function that works perfectly  if I call it via the html page:
    <body onLoad="SCOInitialize()">
    </body>
    When I make the call using flash...
    initialize();
    ...the Flash file just gets hung up and it actually wont execute the  second line of code in the function: statusTxt.text="initializing";
    What is the deal? I can't for the life of me figure out why it won't  work anymore!!!
    Also, I have checked to see if the ExternalInterface is available, and  it returns "true".

    I am testing locally using an HTML file that virtualizes an LMS. I have used is many times in the past. I originally used javascript that I normally create for these circumstances that always worked in the past, then switched to trying to use the Javascript that Flash created. In either case, the call to the Initialization function onLoad from the HTML page itself worked fine, both actually having different Function names, but perform the same function, while the ExternalInterface call to both fails.

  • ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.

    ExternalInterface not working when swf file is embed inside a dynamically cloned DIV element.
    It seems that flash movie is identifed as 'undefined' inside document.
    //a statically placed div
    var staticdiv=document.getElementById('PropDiv');
    //dynamically placed div with object tag
    var dynDiv =staticdiv.cloneNode( true );
    var xD=50;
    var yD=50;
    if(dynDiv)
    dynDiv.style.display  = "block";
    dynDiv.innerHTML="<object classid=" + "\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"" + "codebase=" +
    "\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\"" + "width=" + xD + "height=" + yD +
    "id=" + "\"external\"" + "align=" + "\"middle\"" + ">" +
                    "<param name=" + "\"allowScriptAccess\"" + "value=" + "\"sameDomain\"" + "/>" +
                    "<param name=" + "\"movie\"" + "value=" + "\"external.swf\"" + "/>" +
                    "<param name=" + "\"quality\"" + "value=" + "\"high\"" + "/>" +
                    "<param name=" + "\"wmode\"" + "value=" + "\"transparent\"" + "/>" +
                    "<param name=" + "\"bgcolor\"" + "value=" + "\"#ffffff\"" + "/>" +
                    "<embed src=" + "\"external.swf\"" + "quality=" + "\"high\"" + "wmode=" + "\"transparent\"" +"bgcolor=" + "\"#ffffff\""
    + "width=" + xD + "height=" + yD + "name=" + "\"external\"" + "align=" + "\"middle\"" + "allowScriptAccess=" + "\"sameDomain\"" +
    "type=" + "\"application/x-shockwave-flash\"" + "pluginspage=" + "\"http://www.macromedia.com/go/getflashplayer\"" + "/>" +
                    "</object>";
       dynDiv.style.top=50;
       dynDiv.style.left=100;
    document.body.appendChild(dynDiv);
    In above situation communication is not establised when a  funtion which is retruning boolean is called from flash using
    ExternalInterfcae.call.The return value of this function is getting as false inside flash.But the value is true in javascript.
    if (navigator.appName.indexOf("Microsoft") != -1) {
       return window[movieName];
      } else {
       return document[movieName];
    window["external"] is returning as 'undefined'.
    Please give a  solution to solve this.

    Note that you have different file names for the object (images/banner.swf) and the embed (images/banner1.swf)
    You also placed the embed in the middle of a param tag and nested all param tags.
    Because you didn't include a MIME type and the object doesn't have a classid for an ActiveX control for IE, I'm not sure what Firefox will be using.<br />
    The object doesn't have a data attribute to specify the file.<br />
    A separate embed is only needed when you specify a classid in the object.
    <pre><nowiki><div class="bannercontainer">
    <object width="940" height="445" type="application/x-shockwave-flash" data="images/banner.swf" >
    <param name="wmode" value="transparent" />
    <param name="movie" value="images/banner.swf" />
    </object>
    </div></nowiki></pre>

  • ExternalInterface.addCallback doesn't seem to work.

    Continuing from this forum post here:
    http://forums.adobe.com/thread/885200?tstart=0
    I am having trouble getting the ajax result back into flex... as an event so i don't need to keep checking in flex. from what i understand a callback is needed so I have set up a callback with the relevant flex portions here:
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   xmlns:bridge="bridge.*"
                   minWidth="955" minHeight="600" creationComplete="application1_initializeHandler(event)">
        protected function application1_initializeHandler(event:FlexEvent):void
                    ExternalInterface.addCallback("EICallBack", EICallBack);
    protected function EICallBack(Result:String)
                    output = Result;
    protected function button1_clickHandler(eventLMouseEvent):void)
    ExternalInterface.Call("ExecuteFunction", Value);
    On the javascript side
    I created a delagate function
    function ExecuteFunction(arr)
    testFunction(arr).EICallBack(output) //where output is set output = xmlHttp.responseText instead of the alert with a subsequent return of output
    but the EICallBack is never executed.
    I have looked at other examples and they look quite similar. I do not know what i am doing wrong.  Can anyone help?

    After looking at your suggestions I made some changes to HelloFunction but it still fails to execute the callback.
    <script>
    output = "notset"
    function ExecuteFunction(arr)
        var xmlHttp = new XMLHttpRequest();
    var url;
       url = "Location/to/server";
       var body = '{"input":arr}'; xmlHttp.open("POST", url, true);
        xmlHttp.setRequestHeader("Content-Type", "application/json");
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4) {
                output = xmlHttp.responseText;
    if(navigator.appName.indexOf("Microsoft") != -1)
                return window["testFunctions"];  //testFunctions is the name set in the attributes.id field when defining the flash element so i took a guess
               else{
                return document["testFunctions"];
        xmlHttp.send(body);
    function helloFunction(arr)
    ExecuteFunction(arr).EICallBack(output)
    the callback is still set like this:
    protected function application1_initializeHandler(event:FlexEvent):void
                    ExternalInterface.addCallback("EICallBack", EICallBack);
                    trace("INIT");
    and
    protected function EICallBack(Result:String)
                    output = Result;
                    Alert.show(output);
    the trace is executed before running helloFunction so i am fairly sure that addCallback is executed before helloFunction runs.  And the swf file  and html page are on the same domain.
    Since i am running this on my development machine, could this be blocked by flex/flash if it is all run locally?
    is the name that i chose for the document return statement correct?
    I should mention that the application does give me the result and is stored in output nicely.

  • Facebook actionscript API not working with Flex 4.5 Mobile Project

    Will the following API work in a Flex 4.5 mobile project?
    http://code.google.com/p/facebook-actionscript-api/
    I tried a simple Facebook.int() and I keep getting the following error...
    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$/addCallback()
    at com.facebook.graph::Facebook/init()[C:\Users\MikeHunt\Work\facebookGraphApi\api\com\faceb ook\graph\Facebook.as:599]
    at com.facebook.graph::Facebook$/init()[C:\Users\MikeHunt\Work\facebookGraphApi\api\com\face book\graph\Facebook.as:165]
    at views::LoginView/init()[/Users/edgar/Documents/Adobe Flash Builder 4.5/socialMessenger/src/views/LoginView.mxml:15]
    at views::LoginView/___LoginView_View1_initialize()[/Users/edgar/Documents/Adobe Flash Builder 4.5/socialMessenger/src/views/LoginView.mxml:3]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\co re\UIComponent.as:13128]
    at mx.core::UIComponent/set processedDescriptors()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent .as:1871]
    at mx.core::UIComponent/initializationComplete()[E:\dev\4.5.1\frameworks\projects\framework\ src\mx\core\UIComponent.as:7660]
    at mx.core::UIComponent/initialize()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\ UIComponent.as:7639]
    at spark.components::View/initialize()[E:\dev\4.5.1\frameworks\projects\mobilecomponents\src \spark\components\View.as:990]
    at views::LoginView/initialize()
    at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[E:\dev\4.5.1\frameworks\projects\ framework\src\mx\core\UIComponent.as:7485]
    at mx.core::UIComponent/addChildAt()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\ UIComponent.as:7189]
    at spark.components::Group/addDisplayObjectToDisplayList()[E:\dev\4.5.1\frameworks\projects\ spark\src\spark\components\Group.as:2037]
    at spark.components::Group/http://www.adobe.com/2006/flex/mx/internal::elementAdded()[E:\dev\4.5.1\frameworks\project s\spark\src\spark\components\Group.as:1628]
    at spark.components::Group/addElementAt()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\c omponents\Group.as:1387]
    at spark.components::Group/addElement()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\com ponents\Group.as:1345]
    at spark.components::SkinnableContainer/addElement()[E:\dev\4.5.1\frameworks\projects\spark\ src\spark\components\SkinnableContainer.as:761]
    at spark.components::ViewNavigator/createViewInstance()[E:\dev\4.5.1\frameworks\projects\mob ilecomponents\src\spark\components\ViewNavigator.as:1954]
    at spark.components::ViewNavigator/commitNavigatorAction()[E:\dev\4.5.1\frameworks\projects\ mobilecomponents\src\spark\components\ViewNavigator.as:1867]
    at spark.components::ViewNavigator/commitProperties()[E:\dev\4.5.1\frameworks\projects\mobil ecomponents\src\spark\components\ViewNavigator.as:1236]
    at mx.core::UIComponent/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\ mx\core\UIComponent.as:8209]
    at mx.managers::LayoutManager/validateProperties()[E:\dev\4.5.1\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:597]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.5.1\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:783]
    at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.5.1\frameworks\projec ts\framework\src\mx\managers\LayoutManager.as:1180]

    This is the error because the runtime does not find any way to call Java script that usally is called through External interface. So my guess is you are using a AIR project. U just need to download the latest swc http://code.google.com/p/facebook-actionscript-api/downloads/list for destop in your case and don't forget to but FBJSBridge.js to put in your source that will b used to help AS call Facebook API from AIR runtime
    Hope it make some sense
    Piyush Negi

  • Pause Sound not working correctly

    Hi guys,
    I'm using a version of the pause sound code found on the adobe/help page, but it's not resuming the sound from the pausePoint.  I have the pause/play function tied to the stage so that my external swfs pause as well.  Here's a clip of my code,
    This is the load audio with swf part:
    var fl_Loader_5:Loader;
    var fl_ToLoad_5:Boolean = true;
    var channel:SoundChannel = new SoundChannel();
    var snd:Sound = new Sound();
    var req_1:URLRequest = new URLRequest("audio/Introduction.mp3");
    introductionButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_5);
    function fl_ClickToLoadUnloadSWF_5(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader_5 = new Loader();
      fl_Loader_5.load(new URLRequest("captivate/Introduction.swf"));
      parent.addChild(fl_Loader_5);
      fl_Loader_5.x = 100;
      fl_Loader_5.y = -288;
    snd.load(req_1);
      channel = snd.play();
      fl_Loader_6.unloadAndStop();
      fl_Loader_7.unloadAndStop();
      fl_Loader_8.unloadAndStop();
      fl_Loader_9.unloadAndStop();
      fl_Loader_10.unloadAndStop();
      introductionButton.removeEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_5);
    This is the stage pause and audio pause part:
    flash.system.Security.allowDomain("*");
    ExternalInterface.marshallExceptions = true;
    var originalFrameRate:uint = stage.frameRate;
    var standbyFrameRate:uint = 0;
    function toggleAllClips(doAnim, mainMC) {
    if ( parent is MovieClip){
      if (doAnim) {
    parent.stage.frameRate = originalFrameRate;
    channel = snd.play(pausePosition);
      } else {
    var pausePosition:int = channel.position;
    channel.stop();
    parent.stage.frameRate = standbyFrameRate;
      for (var i = 0; i<mainMC.numChildren; i++) {
       toggleAllClips(doAnim, mainMC.getChildAt(i));
    How do I better target the pausePoint? Do I need an equation or should I reposition the code?
    Also, the first time the stage resumes and the audio restarts from the beggining, it doesn't stop on the next pause and then a second audio track comes in on the following resume, on and on.  What gives?

    FOUND IT!!! A co-worker and I set down with your new code and brainstormed and it came down to adding another instane of the "currentSound = null;"  Here's that section of the code adjusted :
    var originalFrameRate:uint = stage.frameRate;
    var standbyFrameRate:uint = 0;
    var pausePosition:int;
    function toggleSound(b:Boolean):void{
    if(b){
      channel = currentSound.play(pausePosition);
      pausePosition = 0;
    } else {
      pausePosition = channel.position;
      channel.stop();
    function toggleAllClips(doAnim, mainMC) {
    if (parent is MovieClip){
      if (doAnim) {
    parent.stage.frameRate = originalFrameRate;
    channel = currentSound.play(pausePosition);
    pausePosition = 0;
    currentSound = null;
      } else {
    pausePosition = channel.position;
    channel.stop();
    parent.stage.frameRate = standbyFrameRate;
      for (var i = 0; i<MovieClip.(parent.parent.parent.mainMC).numChildren; i++) {
       toggleAllClips(doAnim, parent.getChildAt(i));
    I had assumed that nulling out any of the references to the original snd_1 would kill all the audio, but it didn't, it just stopped the duplicate.  Here's all of my code in case anyone has the same issue:
    Header 1
    import flash.display.Loader;
    import flash.display.MovieClip;
    import flash.utils.setTimeout;
    import com.adobe.captivate.flash.rdSound;
    import com.adobe.captivate.events.*;
    import flash.display.Sprite;
    import flash.media.Sound;
    import flash.media.SoundChannel;
    import flash.net.URLLoader;
    import flash.net.URLRequest;
    stop();
    var fl_Loader:Loader = new Loader();
    var fl_ToLoad:Boolean = true;
    parent.addChild(fl_Loader);
    fl_Loader.x = 100;
    fl_Loader.y = -288;
    var channel:SoundChannel = new SoundChannel();
    var snd_1:Sound = new Sound();
    var snd_2:Sound = new Sound();
    var snd_3:Sound = new Sound();
    var snd_4:Sound = new Sound();
    var snd_5:Sound = new Sound();
    var snd_6:Sound = new Sound();
    var currentSound:Sound;
    //SoundMixer.stopAll();
    /*var req_1:URLRequest = new URLRequest("audio/Introduction.mp3");
    var req_2:URLRequest = new URLRequest("audio/Safety.mp3");
    var req_3:URLRequest = new URLRequest("audio/Compartments.mp3");
    var req_4:URLRequest = new URLRequest("audio/Dual.mp3");
    var req_5:URLRequest = new URLRequest("audio/Switch.mp3");
    var req_6:URLRequest = new URLRequest("audio/Installation.mp3");*/
    //channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
    function soundCompleteF(e:Event):void{
    currentSound = null;
    SoundMixer.stopAll();
    introductionButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_5);
    function fl_ClickToLoadUnloadSWF_5(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Introduction.swf"));
      snd_1.load(new URLRequest("audio/Introduction.mp3"));
      //channel = snd_1.play();
    //currentSound = snd_1;
      //snd_2.close();
      //snd_3.close();
      //snd_4.close();
      //snd_5.close();
      //snd_6.close();
      if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_1.play();
      //snd_1.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_1;
        snd_2.close();
        snd_3.close();
        snd_4.close();
        snd_5.close();
        snd_6.close();
        introductionButton.removeEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_5);
    safetyButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_6);
    function fl_ClickToLoadUnloadSWF_6(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Safety Considerations.swf"));
      snd_2.load(new URLRequest("audio/Safety.mp3"));
        channel = snd_2.play();
        currentSound = snd_2;
       if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_2.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_2;
        snd_1.close();
        snd_3.close();
        snd_4.close();
        snd_5.close();
        snd_6.close();
    compartmentsButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_7);
    function fl_ClickToLoadUnloadSWF_7(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Compartments.swf"));
      snd_3.load(new URLRequest("audio/Compartments.mp3"));
        channel = snd_3.play();
        currentSound = snd_3;
       if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_3.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_3;
        snd_1.close();
        snd_2.close();
        snd_4.close();
        snd_5.close();
        snd_6.close();
    dualButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_8);
    function fl_ClickToLoadUnloadSWF_8(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Dual Control Mechanism.swf"));
      snd_4.load(new URLRequest("audio/Dual.mp3"));
        channel = snd_4.play();
        currentSound = snd_4;
       if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_4.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_4;
        snd_1.close();
        snd_2.close();
        snd_3.close();
        snd_5.close();
        snd_6.close();
    switchButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_9);
    function fl_ClickToLoadUnloadSWF_9(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Switch Machine Operation.swf"));
      snd_5.load(new URLRequest("audio/Switch.mp3"));
        channel = snd_5.play();
        currentSound = snd_5;
       if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_5.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_5;
        snd_1.close();
        snd_2.close();
        snd_3.close();
        snd_4.close();
        snd_6.close();
    installButton.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_10);
    function fl_ClickToLoadUnloadSWF_10(event:MouseEvent):void
      SoundMixer.stopAll();
      fl_Loader.load(new URLRequest("captivate/Installation and Adjustments.swf"));
      snd_6.load(new URLRequest("audio/Installation.mp3"));
        channel = snd_6.play();
        currentSound = snd_6;
       if(channel.hasEventListener(Event.SOUND_COMPLETE)){
      channel.removeEventListener(Event.SOUND_COMPLETE,soundCompleteF);
      channel=null;
      channel = snd_6.play();
      channel.addEventListener(Event.SOUND_COMPLETE,soundCompleteF);
        currentSound = snd_6;
        snd_1.close();
        snd_2.close();
        snd_3.close();
        snd_4.close();
        snd_5.close();
    // This is a more "safe than sorry" setting, since multiple domains
    // have entry into my site. Can be removed or hardcoded if you feel
    // secure or insecure, as you see fit.
    flash.system.Security.allowDomain("*");
    // Throw any errors around to make sure somebody actually gets them.
    ExternalInterface.marshallExceptions = true;
    // This is not the most ideal way to toggle animations on and off, but
    // it's thorough, generic, and simple. Iterate all movieclips within
    // clip, shutting them down each in turn. A better, but much more tedious
    // method would be to target specific clips using dotpath notation, telling
    // each in turn to turn off or on depending on what we need.
    // BUT this is just a demo, and what we're really interested in is the
    // event-handling mechanism that actually calls this routine, and not the
    // routine itself.
    var originalFrameRate:uint = stage.frameRate;
    var standbyFrameRate:uint = 0;
    var pausePosition:int;
    function toggleSound(b:Boolean):void{
    if(b){
      channel = currentSound.play(pausePosition);
      pausePosition = 0;
    } else {
      pausePosition = channel.position;
      channel.stop();
    function toggleAllClips(doAnim, mainMC) {
    if (parent is MovieClip){
      if (doAnim) {
    parent.stage.frameRate = originalFrameRate;
    channel = currentSound.play(pausePosition);
    pausePosition = 0;
    currentSound = null;
      } else {
    pausePosition = channel.position;
    channel.stop();
    //SoundMixer.stopAll();
    //currentSound = null;
    parent.stage.frameRate = standbyFrameRate;
      for (var i = 0; i<MovieClip.(parent.parent.parent.mainMC).numChildren; i++) {
       toggleAllClips(doAnim, parent.getChildAt(i));
       //toggleSound(true);
    /*function toggleSoundPause(currentSound, mainMC) {
    if(currentSound){
    if(pausePosition == 0){
      currentSound.play(pausePosition);
      pausePosition = 0;
    } else {
      pausePosition = channel.position;
      channel.stop();
    function animOn(e:*=null) {
    toggleAllClips(true, parent.getChildByName("mainMC"));
    toggleSound(true);
    function animOff(e:*=null) {
    toggleAllClips(false, parent.getChildByName("mainMC"));
    toggleSound(false);
    function injectPrep(e:*=null) {
    try {
      ExternalInterface.addCallback("jsanimOn", animOn);
      ExternalInterface.addCallback("jsanimOff", animOff);
    } catch (e) {
      trace(e);
    function injectListeners(e:*=null) {
    try {
      // Object/Embed ID of this movie needs to be inserted into the
      // JavaScript before we actually wrap and send it to the browser:
      var jsfix=js.toString().replace(/xxx/g, ExternalInterface.objectID);
      ExternalInterface.call(jsfix);
    } catch (e) {
      trace(e);
    // Using timeouts ensures the movie is actually done loading before
    // these fire, helping compatibility for a few browser versions.
    setTimeout(injectPrep,0);
    setTimeout(injectListeners,100);
    JAVASCRIPTS
    JavaScript needs to be wrapped in a tag, a cdata, and a closure
    function in order to be wrapped up and sent to the browser.
    Note that an ActionScript function will replace all instances
    of "xxx" with the actual ID used for this SWF.
    We're battling some major bugs and crossbrowser idiosyncrasies
    here:
    1) In Internet Explorer the 'onblur' event is implemented
        incorrectly (as opposed to Firefox/Mozilla browsers). It is
        wrongly fired when focus is switched between HTML elements
        *inside* a window. As a result, we have to use onfocusout
        instead of onblur, and keep track of which element is active.
        If we focusout and the active element is not the previous
        active element, then we haven't actually "blurred" and dont
        want to trigger Flash.
    2) Firefox has problems interpreting both getElementById and
        document["swf"] when dealing with "twicebaked" object/embeds.
        Adobe's method of finding the swf fails to address the fact
        that document["swf"] sometimes returns an array in this
        situation rather than an object ref, and getElementById
        sometimes confuses name and id.
    3) When a window is created in Firefox, it doesn't actually have
        "focus" (event though it appears to) and therefore won't "blur"
        unless you actually click in it first, i.e if you open up a
        window, then immediately send it to the background, it never
        gets the command to halt the flash. So we have to explicitly
        focus the blasted thing to get it to work properly.
    4) Because of irregularities caused by Ajax, the way browsers shut
        down, and other factors, there's a good chance our swf won't
        be there when a blur (or focusout) event occurs. Therefore we
        need an explicit check within the event handler itself.
    5) Finally, we want to wrap everything inside a wrapper-closure
        function, to keep everything safe from being stepped on. Lucky
        us, we have to do this anyways to get everything to fit inside
        a single ExternalInterface.call event.
    var js:XML = <script><![CDATA[
    ( function() {
      var active_element; // tracker for ie fix;
      var bIsMSIE = false;
      // Modified version of Adobe's code resolves a bug in FF:
      function getSWF(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
          return window[movieName];
        } else {
          // Resolves a bug in FF where an array is sometimes returned instead of a
          // single object when using a nested Object/Embed.
          if(document[movieName].length != undefined){
            return document[movieName][1];
          return document[movieName];
      // Need to check for swf each time we try this because the swf may actually be gone
      // because of ajax or a window closure event. Prevents error dialog from popping up.
      // Future release should check for this condition and then remove the calling event
      // so it doesn't keep triggering.
      function animOff(){
        if (bIsMSIE && (active_element != document.activeElement)) {
          active_element = document.activeElement;
        } else {
          var logoThang = getSWF("xxx");
          if(logoThang){logoThang.jsanimOff();}
      function animOn(){
        if (bIsMSIE && (active_element != document.activeElement)) {
          active_element = document.activeElement;
        } else {
          var logoThang = getSWF("xxx");
          if(logoThang){logoThang.jsanimOn();}
      // Add the listeners. Hear ye, here ye.
      if (typeof window.addEventListener !== "undefined") {
        // Firefox, Mozilla, et al.
        window.addEventListener("blur", animOff, false);
        window.addEventListener("focus", animOn, false);
      } else if (typeof window.attachEvent !== "undefined") {
        // Internet Explorer
        bIsMSIE = true;
        window.attachEvent("onfocus", animOn);
    // Another bug: window.onblur ALWAYS fires in IE, so
    // we have to keep track of what we're clicking using
    // another method:
    active_element = document.activeElement;
    document.attachEvent("onfocusout", animOff);
      // Necessary to trigger toggling in FF if the page hasn't actually been clicked in and the page
      // is sent to the background. Can be commented out if necessary, e.g. if you don't want the page
      // popping to the top or want focus to remain somewhere else like a form field.
    // window.focus();
    ]]></script>;
    Thanks you SOOO MUCH for your help.  There is no way I could have done this alone and now I have a better understanding about referencing vars.
    Thanks,
    Elena

  • Java script is not working in Chrome

    The code below works fine on IE and FF but not on Google Chrome.
    Please can someone help me to find out the mistake?.    Thanks In Advance.
    Flex Code:
    Public function init():void
    ExternalInterface.addCallback("getCloseConfirmMessage", closeConfirmMessage);
    ExternalInterface.call("setUpBeforeUnload",FlexGlobals.topLevelApplication.id);
    Public function closeConfirmMessage():void
          //Code Here
    Java Script :
      <script language="javascript" type="text/javascript">
                    var fxControl;
                    function confirmClose()
    alert("Please click OK to end the session");
    fxControl.getCloseConfirmMessage();                  
                    function setUpBeforeUnload( appName )
                                    fxControl = document[ appName ] || window[ appName ];                       
                                  window.onbeforeunload = confirmClose;
    </script>

    Is the appostrophe function test(pthis) *'* present in your javascript code...
    If not can you post the same in apex.oracle.com and give the credential so that I can the why its not wroking
    Regards,
    Shijesh

  • JavaScript errors in IE6 during ExternalInterface.addCallback

    I'm having a terrible time getting the Bridge to work in IE6.
    (A working Firefox prototype took all of 20 minutes.)
    I'm using UFO (
    http://www.bobbyvandersluis.com/ufo/)
    to load the .swf file. However, when it gets to the
    ExternalInterface.addCallback in FABridge.as, IE throws some opaque
    JavaScript errors: Line 1, Char 22 Syntax Error. If I comment out
    all of the ExternalInterface.addCallback calls, IE gets past this,
    however, nothing works beyond that (not surprisingly). Am I missing
    something obvious with regard to IE?
    Any help would be much appreciated.

    Looks like my above code was not setting the object/@id
    correctly on the Flash object. Once I added id: 'chart' to
    UFO.create's initialization parameter, everything went
    swimmingly.

  • ExternalInterface.addCallBack

    In most cases, I get the following:
    ExternalInterface.available returns true
    while
    ExternalInterface.addCallBack returns false
    As I must have JavaScript to/from ActionScript to make my
    website work, I instead I used SetVariable and played the Flash
    movie. This techinque works on computers that returned true to both
    of the above ExternalInterface functions, but doesn't work on
    computers where addCallBack fails.
    objFlash.SetVariable("Command", "Initialize");
    objFlash.Play();
    Inside of Flash in ActionScript, Command is undefined.
    This occurs on both IE and Firefox, so appears to be an OS
    setting of some kind.
    Anyone have any ideas on this?

    "angadala" <[email protected]> wrote in
    message
    news:gpa7bf$i31$[email protected]..
    > in flex---
    > i am using ExternalInterface.addCallback("myFunction",
    callMe);
    > public function callMe():void
    > {
    > Alert.show("callMe");
    >
    > }
    > js----
    > function myFunction()
    > {
    > alert('MY FUNCTION called');
    > }
    > its not working . is there any alternative for
    addcallback .thanks in
    > advance
    addCallback is for allowing js to call a function in your
    Flex app under the
    name myFunction. You're actually not calling your myFunction
    from js.
    You'd need something like this on the js side:
    function myFunction() {
    var flash = document.getElementByID('objectTagID');
    flash.myFunction();
    I'm pretty sure all this is covered in more detail than I
    have time to give
    you in the docs, so go back and look and see what's already
    available to
    you.

  • External interface.call is not working

    hi, i am trying to call one java script function in
    actionscript by using External interface.call method. but its not
    working .can u pls tell me why this happend

    "angadala" <[email protected]> wrote in
    message
    news:gmpc58$g9p$[email protected]..
    > skill status.mxml
    >
    >
    > <mx:Script>
    > <![CDATA[
    > if (ExternalInterface.available) {
    > ExternalInterface.call(getDataFromXml);
    > }
    >
    > it is javascript
    > <script type="javascript">
    > var data = new Array();
    > data[0]=[1,2,3];
    > function getData()
    > {
    > return data;
    > }
    > </script>
    > </head>
    > <body>
    > <div id="SkillStatus">
    > <p>Alternative content</p>
    > </div>
    >
    > </body>
    > </HTML>
    >
    1) Your JavaScript function name and the function name you
    are calling
    don't match.
    2) On the Flex side, you are calling a JS function that I
    think you are
    expecting to return a value, but not assigning the result of
    the value to a
    function.

  • IE/ExternalInterface do not return any value if movie added with appendChild

    There is a problem with IE/ExternalInterface if movie is added to DOM f.ex appendChild. JavaScript functions are called but they do not return any value.
    MS first response was that this is 3rd party/Adobe problem.
    Fixing this with innerHTML is not the solution. Using here Any suggestions ?
    Simplified test case has
              var flashMovie = '<OBJECT id="testId" codeBase="http://fpdownload..
              // Works in IE and FF
              document.getElementById("testdiv").innerHTML = flashMovie;
              // ExternalInterface.call calls JS but does not return value in IE. Works in FF
              var tempDiv = document.createElement("div");   
              tempDiv.innerHTML = flashMovie;
              document.body.appendChild(tempDiv);
    Here is complete code
    http://pastebin.com/fbc0aa9a
    Here is AS3 code in for ajax.swf
    http://pastebin.com/d4efd47b
    -H

    You are right about that duplicate id of the movie in this example, but that is not case here.
    I appreciate if you try this and confirm that problem exist or any work-around.
    Here is more explanation to original post:
    In HTML is JavaScipt
    function fromJs()
         return "text from js..";
    that is called from AS3
    var s = ExternalInterface.call("fromJs");
    This "s" value and also ExternalInterface.objectID are null in AS3.
    Here example again only with non-working case without that duplicate id with innerHTML
    http://pastebin.com/f4e33af93
    and also movie with AS3 code is attached.
    Using plain innerHTML this case works
    document.getElementById("testdiv").innerHTML = '<OBJECT..
    and with appendChild does not work
    var tempDiv = document.createElement("div");
    tempDiv.innerHTML = "<OBJECT ..
    document.body.appendChild(tempDiv);

  • Javascript calls via getURL not working anymore

    After upgrading to flash player 9,0,115,0 a simple call like
    getURL("javascript(alert'message')); doesn't work anymore on
    Internet Explorer (it fails without any error in policyfiles.txt,
    but it still work on Firefox). My IE version is 7.
    I can't use ExternalInterface 'cause i need to publish as
    Flash Player 7 AS2.0.
    Any comment or suggestion?

    I have a similar problem. When running a local HTML file,
    using IE7 and FP 9,0,115,0, all the getURL function calls cease to
    work.
    If I downgrade to FP8, still using IE7, everything works.
    If I downgrade to IE6, still using FP9.0.115.0, everything
    works.
    If I load the HTML via HTTP (instead of local), using IE7 and
    FP9.0.115.0, everything works.
    If I use Firefox, with FP9.0.115.0, everything works.
    So, the function calls fail only when the swf is contained on
    a
    local HTML file, using
    IE7, and
    FP9.0.115.0. The problem is, most of our customers have that
    software profile, and all of them need to load the content locally
    (its very heavy for network transmission).
    All the getURLs are like this:
    getURL("javascript:someFunction()");
    We're setting the 'allowScriptAccess' to 'always'.
    Also, if we put the OBJECT tag inside the HTML (instead on an
    external JS file), the function calls still do not work.

  • Why am I getting-"The ExternalInterface is not available in this container" in Flex Mobile Project

    I am using StageWebView to show an HTML page. I want to call a function in my flex mobile project to be called from a JS function. Using ExternalInterface, I have 
       in Flex - 
        ExternalInterface.addCallback("myFunction",myFunc);
       in JS -
            function thisMovie(movieName) {
               if (navigator.appName.indexOf("Microsoft") != -1) {
                 return window[movieName];
               } else {
                 return document[movieName];
           function showAlert()
                  alert("Going to call AS function");
                thisMovie("ShowLocalHTML").myFunction("Hello");
                  return false;
    I am getting "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." when trying to run the application.
    And my project targets Android platform. And  I have Mozilla, Chrome installed on my desktop - although I am not user if that is relevant to the problem.
    Please help in resolving this issue.

    Is there an alternative?
    I want to display a local HTML file and then allow for JS to Flex communication. I am new to Flex and AS. As per my understanding, StageWebView is the only way to
    show a local HTML file in a mobile project. If the script interface is not available - then I cannot achieve JS-to-Flex communication. So is there any other way to do this??
    Please help ...else I will have to abandon my foray into Flex, AS and go back to Android Java.

Maybe you are looking for

  • Can't get purchases off iPod onto new computer?

    My old laptop crashed and I have recently replaced it. I have downloaded the iTunes software and now I'm trying to get the songs from my iPod to upload to iTunes so I can manage all my music. I have authorized my computer and some of the music has tr

  • Dynamically load jar file

    Hi, I've got an applet (used in a website) which must internally load a jar (the jarname and mainclassname are stored in the database). with a lot of jars (more than 10) and slow-internet users of my applet, it is not an option to add all the jars to

  • Patchin portal cluster problem

    I am trying to run, Portal patch 13 on a WAS cluster. t The problem I am getting is that the patch installation asks for a "username and password" for administrator When I enter the details I get an error. My question is that if it is in safe modde,

  • Pasting screen dump into Photoshop

    Pasting a screen dump into Photoshop makes it lighter. Like a milky filter. Anyone had this issue?

  • Relationship between NWDI runtime and SDM

    When we create runtime systems at NWDI, after clicking "save" button, it takes about 20 minutes to finish. It's said that means NWDI is pulling info from SDM. Is that true? Where to show the evidence? Points guaranteed. Thanks!