ExternalInterface.call("saveglobalscore",score)

This does not work what is the wrong in this code.

If I trace (urlPath) showing - null.

var urlPath = ExternalInterface.call("window.location.href.toString");

if(urlPath != "http://www.domainname.com/demo/test/welcome.swf")
{
          trace("Yes");
          pageMsg.text = "this is html"
  
}
else
{
          trace("no");
          pageMsg.text = "This is swf"
}

I tested this code html of the page and it works fine.  I created a test document if you want to check.  Click on the green rectangle so that the url displayed...

http://www.nedwebs.com/Flash/welcome.html

The swf file contains an mc button named "btn" and a textfield named "url".  The code in the swf file is as follows...

btn.addEventListener (MouseEvent.CLICK, traceURL);

function traceURL(evt:MouseEvent):void {}
var urlPath = ExternalInterface.call("saveglobalscore",score) ("windowhref");
URL. Text = urlPath;
}

You should test it on a server by using the html page, if you don't already have it.

Tags: Adobe Animate

Similar Questions

  • Flex 3: need help with ExternalInterface.call("saveglobalscore",score)

    Hello

    I have my setting up a Flex project in my Flex Builder.

    I am going through my step by step to understand.

    In our project, we got this call:

    public function callDataOfJSMethod (): void
    {
    ExternalInterface.call("saveglobalscore",score) ("getData");
    }

    But I was not this getData anywhere, couldn't you please let me know what it could be and where I can find that?

    Thanks in advance.

    It should be a javascript method in the html wrapper.

  • ExternalInterface.call("saveglobalscore",score) () throws ScriptTimeoutError, which may not be intercepted

    Hello

    In my flex code, I invoke ExternalInterface.call("saveglobalscore",score) () to call a function in c ++. In this feature of c ++, a modal dialog box will appear. If this modal dialog box is open for a long time, a warning dialog box saying that a function has executed more than 15 seconds. I wanted to capture this error (which should be ScriptTimeoutError) to suppress this warning dialog box. But I failed.


    In the following code, flex timeout warning dialog will show, do not show my words:

    Try
    {
    ExternalInterface.call("saveglobalscore",score) ("popUpModalDialog");
    } catch(e:Error)
    {
    Alert.Show ("Please don't show dialogue timeout");
    }


    But if I change the code a bit more, flex timeout warning dialog will not appear, my words will show:

    Try
    {
    While (true) {}
    } catch(e:Error)
    {
    Alert.Show ("Please don't show dialogue timeout");
    }


    The examples show that ExternalInterface. () Call throws an error that cannot be intercepted.
    Is there a way I can suppress this warning dialog?

    Thank you!

    Hello

    In my flex code, I invoke ExternalInterface.call("saveglobalscore",score) () to call a function in c ++. In this feature of c ++, a modal dialog box will appear. If this modal dialog box is open for a long time, a warning dialog box saying that a function has executed more than 15 seconds. I wanted to capture this error (which should be ScriptTimeoutError) to suppress this warning dialog box. But I failed.

    In the following code, flex timeout warning dialog will show, do not show my words:

    Try
    {
    ExternalInterface.call("saveglobalscore",score) ("popUpModalDialog");
    } catch(e:Error)
    {
    Alert.Show ("Please don't show dialogue timeout");
    }

    But if I change the code a bit more, flex timeout warning dialog will not appear, my words will show:

    Try
    {
    While (true) {}
    } catch(e:Error)
    {
    Alert.Show ("Please don't show dialogue timeout");
    }

    The examples show that ExternalInterface. () Call throws an error that cannot be intercepted.
    Is there a way I can suppress this warning dialog?

    Thank you!

  • Problem with AS3 & quot; ExternalInterface.call("saveglobalscore",score) & quot; in Internet Explorer

    Hello

    Explain how the page is set up:

    I have a HTML page with 2 different movies Flash AS3.

    The first flash movie is the main entertainment and is located in the middle of the screen with a large background image defined in the body of the HTML.

    The second flash movie spans 100% width/height of the size of the screen and acts as a black fade > invisible.

    What I'm doing:

    Once the second Flash animation has gone from black to invisible it calls a JavaScript function on the HTML page to hide the div element, the second flash movie is integrate in (it's like the first flash movie displays a set of input boxes, which the user must be able to type-which will not be able to click on if there is another flash animation that just overlap the first film).

    My initial solution:

    In the second Flash movie is the following code:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Stop();

    This will load the API needed to communicate with external entities
    to import flash.external.ExternalInterface;

    call the JavaScript function
    ExternalInterface.call("saveglobalscore",score) ('myJavaScriptFunction');
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    .. .and it works fine in Mozilla Firefox/Safari. The actionscript code successfully the JavaScript function in the HTML page and this JavaScript function simply calls (to this poster from the scene an alert() message to show that it has been called successfully).

    Problem with IE:

    But, at the time when I try this in Internet Explorer, I get an alert() message but a JavaScript error message that says:

    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
    Code: Select all
    Line: 1
    Char: 106
    Error: 'null' is null or not an object
    Code: 0
    ////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////

    As you would expect I am totally confused as to what could be the problem.

    It's really urgent because it is a living project which must be completed immediately, any help you might have would be greatly appreciated!

    Kind regards

    Select this option.

    GWD salvation,

    Who did it! :)

    I applied the attribute id = "fTrans" to the tag and IE worked well.

    I disparage me my brain one, thank you very much!

    Kind regards
    Mark

  • The parameter ExternalInterface.call("saveglobalscore",score) String length limit?

    Is there a limit on the length of string to the amount of characters from a string can contain when it is passed as a parameter to ExternalInterface.call("saveglobalscore",score) ()?

    Also, there are characters that ExternalInterface.call("saveglobalscore",score) () cannot serialize to a string? As \n, \t... etc.

    The livedocs don't answer these questions.

    Thanks for your reply, but I just thought of it.

    ExternalInterface.call("saveglobalscore",score) ("jsFunc", longString);

    There seems to be no limit tank that I fell on the cause I could push 2K in there.

    The problem is the line breaks in the string, they must be stripped during serialization. Just make sure that you clean the string of new line as follows:

    longString = longString.split ("\r") .split ("\n").join("").join("");
    ExternalInterface.call("saveglobalscore",score) ("jsFunc", longString);

    works very well...

  • ExternalInterface.call("saveglobalscore",score) on several areas?

    I use ExternalInterface.call("saveglobalscore",score) in a SWF to call a JavaScript in the html container. The swf file is located in one field other than the html container. Everything works very well if all the files are in the same root directory, but as soon as I make reference to the swf file that is located in the other domain, the call is not working! What Miss me?

    SWF file has this frame 1:
    to import flash.external.ExternalInterface;
    function clickListener(eventObj:Object):Void {}
    ExternalInterface.call("saveglobalscore",score) ("sendToResponseForm");
    }

    SWF file has this on mc as a button instance:
    {We (Press)}
    clickListener();
    }

    HTML/container file that is in the < head > tag:
    < script type = "text/javascript" >
    function sendToResponseForm() {}
    Window.Location = "my.other.html.file";
    }
    < /script >

    HTML file has this integrated:
    < object classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase =" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6, 0,29,0 ' width ="700"height ="550">" "
    "" < param name = "movie" value = " http://www.otherdomain.com/vid/my.SWFFile.swf" / >
    < param name = "quality" value = "high" / >
    "" "" < embed src = " http://www.otherdomain.com/vid/my.SWFFile.swf" quality = "high" pluginspage = " http://www.macromedia.com/go/getflashplayer ' type =" application/x-shockwave-flash"width ="700"height ="550"> < / embed >
    < / object >

    If all goes well, that's enough for you to chew. As I was saying that if swf and html are in the same domain, it works. As soon as I point to the second area of source of swf file it stops working.

    Thank you
    Demont

    Here is my error: the swf file has been very good and actually worked in IE6/IE7 but doesn't work in Firefox. The process to include the swf file in the HTML code has been vitiated. I originally published the HTML using Dreamweaver to write the in the code. Which fixes the problem, it's that I published the swf using the Flash file in a folder of the office that produced a javascript (AC_RunActiveContent.js), the swf file and HTML file. Javascript code dynamically determined Explorer who was used and which plugin player was necessary. The script loads/writes in the end the appropriate environmental content and any embed or object of the swf file is successfully. He had nothing to with Lacrosse communication area at all.

    The main challenge was last updated the HTML/Javascript Flash to use the appropriate resource, swf, which was located on a different server and move the js file in the appropriate directory, update the link in the HTML accordingly. My only concern was the more general source external javascript. But, at least I'm not concerned with the question of whether it works or not.

    Hope this helps someone.

    Demont

  • ExternalInterface.call("saveglobalscore",score) () error with Flash Player 10

    I don't know what that means. The function runs successfully in javascript, and I evaluate ExternalInterface.available...

    TypeError: Error #1009: cannot access a property or method of a null object reference.
    at flash.external::ExternalInterface$/_callIn()
    < anonymous >)
    at flash.external::ExternalInterface$/_evalJS()
    at flash.external::ExternalInterface$/call()
    at views.audio::myObject/myFunction()

    UPDATE: it was JS calling a reminder the null value.

  • New path before calling ExternalInterface.call("saveglobalscore",score))

    When click on a component button (called btn_Connect here),
    I want to display a message in a label (lbl_Status here)
    before calling a long-term fscommand() function.

    But there is no action until the fscommand() is completed.

    How can I do?

    Thank you
    Joseph

    Part of my ActionScript code is below.
    My flash application has only a single image.

    To redraw the flash and deal with other possible user interface events,.
    I changed my c# code so that the long task can run in a separate thread.

    Now, everything works fine as I had hoped.

    Joseph

  • ExternalInterface call the Javascript to AS2 array throwing error undefined

    I need to pass various (follow-up) IDs to a .swf.  the IDS are in a table like this =

    < script type = "text/javascript" >

    function getImpID() {}

    var medID = {impID: pvID '12345': ' 677890', exID: '654332'};

    return medID;

    };

    function thisMovie (banner) {}

    If (navigator.appName.indexOf ("Microsoft")! = - 1) {}

    Returns the window [banner]

    }

    else {}

    return the document [banner]

    }

    }

    Window.OnLoad = getImpID;

    < /script >

    For now, the AS2 I is:

    flash.external import. *;

    System.security.allowDomain (sourceDomain)

    var allID:String = ExternalInterface.call.apply ("getImpID");

    function getIDs() {}

    var impID:Number;

    var pvID:Number;

    var exID:Number;

    var id_arr:Array = allID.split(",");

    _root.id_test. Text = impID;

    }

    getIDs();

    Basically, what I need is to divide the three identifiers from the javascript so that I can add with different URL clickTags in the will.  I primarily the "undefined" error, so I'm going out on a limb here I have the AS2 does nothing now value.  More big scratcher head for me is, if I have the ID in an array in javascript (medID) how do I get them not only correctly in Flash, but separate them in their separate identity papers.

    Any suggestions would be greatly appreciated.

    Thank you!

    I forgot to answer, your tips have helped solve the puzzle =

    ActionScript:

    function idTag() {}

    getID = Object (ExternalInterface.call("saveglobalscore",score) ("getImpID"));

    getID.toString ();

    _root.id_test. Text = getID;

    }

    idTag();

    JavaScript

    has worked like a charm!

  • ExternalInterface call in Javascript popup

    I am incorporating a swf in a pop up window using the javascript window.open function. I am currently passing through static values for the height and the width corresponds to the height and width of the embedded swf file of the popup.  A user can click a button in the swf file, and it changes the size of the SWF to 400 x 300, at 800 x 600.  In flex, I use ExternalInterface.call("saveglobalscore",score) ("resize"); but nothing happens.  I'm a complete noob with javascript, is not how to use the ExternalInterface API?  Any ideas why it does not work?  Is there an easier way to get the same functionality to work with something else?  The JavaScript code is below, tons of thanks in advance to tide me over.

    < SCRIPT TYPE = "text/javascript" >

    <!--

    popup function (mylink, windowname)

    {

    If (! window.focus) return true;

    var href;

    If (typeof (mylink) is 'chain')

    href = mylink;

    on the other

    href = myLink.href;

    Popup = window.open (href, windowname, 'width = 400, height = 300, scrollbars = no, resizable = 1');

    Returns false;

    }

    function resize()
    {
    popup.resizeTo (800, 600);
    }


    ->

    < /script >

    < body >

    " < a HREF =" http://localhost/main.swf "onClick ="return popup (this, 'notes')"> "

    App

    < /A >

    Here is the sample,

    Sample.MXML

    
    http://www.adobe.com/2006/mxml"
         layout="absolute"
         width="100%" height="100%">
         
              
         
         
    
    

    Parent html

    
         
              Resize Demo
              
         
         
              
         
    
    

    Child html (Popup.html)

    
         
              Resize - Popup
              
         
         
              
                   
                   
              
         
    
    
  • Cannot call a function javascript to actionscript with ExternalInterface

    Hey all

    I'm trying to scroll a html page up in response to a call from actionscript

    I have no knowledge of html or js, but I did

    Flash pro, in my document class I have this:

    ExternalInterface.call("saveglobalscore",score) ("JumpScroll");

    in the page html wrapper automatic made by flash pro (publish the model of 'Flash with FSCommand') I added these lines inside the script block:

    function JumpScroll() {}

    Window.Scroll (0,0);

    }

    compilation gives no error but when I test this locally (with google chrome), nothing happens and the swf file stops to react

    any ideas?

    thanx

    Ok

    got, it works

    I knew it was a thing of local/restrictions

    went here:

    http://www.Macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.htm l

    added my swf, now works fine

    Bravo to tobi3 in http://forums.adobe.com/thread/671861

  • Cannot call the functions from Javascript using ExternalInterface

    Hi all, I use external Interface to call Javascript in an HTML document with an embedded flash object, but I can't call functions in the flash JavaScript object.

    JavaScript:
    function call_actionscript {}
    If (document.getElementById ('flashObj')) {}
    Alert ('object flash found.');
    document.getElementById('flash2').test_from_javascript ();
    }
    }


    ActionScript:

    package {}
    import flash.display.MovieClip;
    to import flash.external.ExternalInterface;
    import flash.events.Event;

    SerializableAttribute public class extends MovieClip {} FlashObj
    public void FlashObj() {}
    ExternalInterface.addCallback("IsStatic",IsStatic) ('test_from_javascript', test_from_javascript)
    }

    public void test_from_javascript(e:Event):void {}
    ExternalInterface.call("saveglobalscore",score) ("alert", "javascript test received in actionscript!")
    }
    }
    }

    Call the "call_actionscript()" javascript function produces no result. Call Test_from_javascript() manually to code Actionscript product alert "javascript test has received in actionscript!" without problem. So the ExternalInterface.call("saveglobalscore",score) method works fine, but the the ExternalInterface.addCallback("IsStatic",IsStatic) doesn't seem to work at all. What I'm missing here?

    Try to change/add the JS in your HTML code to the following.

    TS

  • Flash cannot call the javascript function in the local html file

    Hello!

    Us is to develop our first application on Playbook. It is an html file including a flash file and javascript code. Everything is packed in. in the file bar, a config.xml file and has been correctly loaded into the Playbook. Everything works locally (no web access)

    Everything works well except when we use an ExternalInterface.call("saveglobalscore",score) in flash that calls a javascript function in the .html file.

    In the actionscript3, we selected the "authorized local file access" and put the 'Security.allowDomain("*) '.

    Any ideas? Thank you!

    External interface tries to access the files packaged locally is currently a known issue.  I have not really of a calendar when or if this can be resolved.  It may be in the code base of flash.

  • Call from JavaScript to AS3 bar reading

    Platform: Captivate 7

    Source: AS3 (obvious, I hope!)

    Output: Flash v10

    I make a unique version of one of the default player bars.  I'm doing the Exit button call a JavaScript function using the following code:

    var btnTipsId = 8;

    function onClicked()

    {

    to import flash.external.ExternalInterface; //Register ExternalInterface

    ExternalInterface.call("saveglobalscore",score) ("closeModule ()"); //Call JS to close Div

    / / parent.onPBCBtnClick ("exit");

    }

    As you can probably see, I don't want to Exit button to close the module with the way she normally does.  My 'closeModule()' function removes a Div layer that hosts the Captivate.  I know it works as we use it in other places.  The problem I encounter is strictly in obtaining the PlayBar to call this JavaScript instead of its function by default 'parent.onPBCBtnClick ("exit");".

    Any ideas?

    Try calling closeModule without the parentheses:

    ExternalInterface.call("saveglobalscore",score) ("closeModule");

  • ExternalInterface sometimes... other local running

    So I develop training on the web that will come eventually in a learning management system. When it is in the LMS, we use ExternalInterface and Javascript to communicate with Flash.

    But sometimes the same course must run locally or publish possibly to a projector.

    I use ExternalInterface.available to check if it is available. If it isn't then there is no ExternalInterface available then clearly there is no LMS communication (light version).

    But the other bits is complicated. When you test locally in the Flash IDE ExternalInterface.available returns the value true, but there is nothing really to interface with.

    Any suggestions on how to know if it actually is javascript to help me to get out and communicate with the LMS?

    Thank you.

    Create a js function that returns something.  If your ExternalInterface.call("saveglobalscore",score) does not return the expected, the swf file is not embedded by a html file.

Maybe you are looking for