ExternalInterface.call across domains?

I'm using ExternalInterface.call in a swf file to call a
javascript in the html container. The swf file is located in a
different domain than the html container. Everything works fine if
all files are within the same root directory, but as soon as I
reference the swf file located in the other domain, the call stops
working! What am I missing?
swf file has this in frame 1:
import flash.external.ExternalInterface;
function clickListener(eventObj:Object):Void {
ExternalInterface.call("sendToResponseForm");
swf file has this on mc instance tracked as button:
on(press){
clickListener();
html file/container has this in <head> tag:
<script type="text/javascript">
function sendToResponseForm(){
window.location = "my.other.html.file";
</script>
html file has this embedded:
<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>
Hopefully, that's enough for you to chew on. Like I said if
swf and html are in the same domain, it works. Just as soon as I
point to second domain for swf file source it stops working.
thanks
deke

Here's my mistake -- the swf file was fine and actually
worked in IE6/IE7 but wouldn't work in Firefox. The process of
including the swf file in the HTML was flawed. I originally
published the HTML using Dreamweaver to write the <object> in
the code. What fixed the problem was I published the swf file using
Flash to a desktop folder which produced a javascript file
(AC_RunActiveContent.js), the swf file and the HTML. The javascript
dynamically determines which browser was being used and which
player plugin was required. The script ultimately loads/writes the
embed or object for the swf file appropriately for the content
environment and everything communicates properly. It didn't have
anything to do with cross domain communication at all.
The main challenge was updating the Flash HTML/Javascript to
use the proper swf resource which was located on a different server
and move the js file to the appropriate directory updating the link
in the HTML accordingly. My only concern was the added overhead of
an external javascript source. But, at least I'm not concerned with
whether it works or not anymore.
Hope this helps somebody.
deke

Similar Messages

  • Setting cookies across domains

    Hi there all,
    I'm posting this in desperation to be honest, don't think
    there is a cut'n'dried
    answer to this one.
    I've got a horrible situation, (don't ask why, it's far too
    complex and to
    be quite honest.. boring :) ).
    I'm trying to "mesh" together a classic .asp with an asp.NET
    site on 2
    separate domains.
    Basically I've got a page from the asp.NET site (eg.
    www.something.co.uk)
    displayed within an iframe on the .asp (eg
    www.another.co.uk). So far so
    good.
    I need to set a cookie on www.another.co.uk and be able to
    read it, or
    replicate it on www.something.co.uk. Because they are not
    sub-domains I can't
    set the cookie direct because of security restrictions.
    So, I thought I could pass a URL variable across to
    www.something.co.uk via
    the iframe URL, and then using javascript to read said URL
    variable and set
    a cookie on the www.something.co.uk domain. No go. Suspect
    there is yet
    again security restrictions to setting cookies across domains
    using iframe.
    So I'm kind of stuck. Can anybody suggest anything please,
    bearing in mind I
    have very limited control over the asp.NET
    (www.something.co.uk) site, so
    any solution I come up with needs to be using javascript.
    Major sized thanks in advance.
    @ndyB

    You could also pass the id as a hidden field in a form.
    Have the link call a JavaScript function. The JavaScript funcition could access the cookie and pull out the id. The function would then set a hidden field in a form to the id value and then Post the form to the secure server.
    The form would only have hidden fields so it could be tagged on the end of the HTML page and the user would never know it was there.

  • ExternalInterface.call String parameter length limit???

    Is there a String length limit to the amount of chars a
    String can contain when passed as a parameter to
    ExternalInterface.call()?
    Also, are there any chars that ExternalInterface.call()
    cannot serialize in a string?? Like \n, \t ...etc.
    The livedocs don't answer these questions.

    thanks for your reply but i just figured it out.
    ExternalInterface.call("jsFunc", longString);
    There is seems to be no char limit that i came across cause i
    was able to shove 2K in there.
    The problem is the newlines in the string, they must get
    messed up during serialization. Just make sure you clean the string
    of newlines like so:
    longString = longString.split("\r").join("
    ").split("\n").join(" ");
    ExternalInterface.call("jsFunc", longString);
    works fine......

  • Pulling data across domains

    Hello. I have hit a real deadend with this problem. I would
    appreciate some help.
    I have designed a website in Flash (
    http://www.clarkhulings.com).
    Under "Store" on the navigation bar, it contains a PayPal "View
    Cart" button that is not working. This is because the Flash does
    not allow direct access to data on the PayPal site. For security
    reasons, a Macromedia Flash movie playing in a web browser is not
    allowed to access data that resides outside the exact web domain
    from which the SWF originated. See
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213
    http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_16520
    I have created a crossdomain.xml file and added it to the
    webserver of clarkhuling.com. The file looks like this:
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy SYSTEM "
    http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
    <allow-access-from domain="*.paypal.com"
    secure="false"/>
    </cross-domain-policy>
    Because clarkhulings.com is not using SSL and PayPal is, I
    have used secure="false" in the code above.
    My Actionscript code that is attached to the View Cart
    button, looks like this:
    view_cart_btn.onRelease = function() {
    var paypal_lv:LoadVars = new LoadVars();
    paypal_lv.onLoad = function(p_success:Boolean) {
    if (p_success) {
    for (var i in this) {
    trace("PayPal Responce "+i+": "+this
    } else {
    trace("PayPal Responce: Error connecting to server.");
    paypal_lv.cmd = "_cart";
    paypal_lv.business = "[email protected]";
    paypal_lv.display = "1";
    paypal_lv.page_style = "hulings";
    paypal_lv.sendAndLoad("https://www.paypal.com/cgi-bin/webscr",
    paypal_lv, "POST");
    As you can see, by going to the website (
    http://www.clarkhulings.com),
    clicking "View Cart" under STORE does not work. What am I doing
    wrong? I would appreciate the help of more learned developers out
    there!
    You can download a copy of one of my FLA files at
    http://www.clarkhulings.com/gallery_affiliates.fla.zip

    الحمد لله
    thanks for Allah,
    and thans for Justin "Cartoon Smart" http://www.cartoonsmart.com/
    i fix this problem using the proxy file which he upload with the RSS Reader tutorial,
    http://www.cartoonsmart.com/rss_reader.html
    so, for any people who have the same problem which is called
    Loading data across domains
    here you are the solution,
    i used the proxy.php file
    just Note if you are using Flash Player 10, you must upload it in the root domain
    like :
    www.yourdomain.com/proxy.php
    Note that you don't need to make any modefications to this file at all, just upload it as it is
    then you point to it in the flash file or in the XML fle which you control the flash form it,
    im my case i control the flash form a xml file called controls.xml and i make variable to load rss feeds from a variable in it called LinkRss
    so in this file i must point to the feed using this way
    Code:
    LinkRss="http://www.yourdomain.com/proxy.php?url=http://rss.news.yahoo.com/rss/topstories"
    sure you will change yourdomain to be any domain name you are putting the flash in it,
    for example
    Code:
    LinkRss="http://www.cartoonsmart.com/proxy.php?url=http://rss.news.yahoo.com/rss/topstories"
    that's all,

  • Problem with ExternalInterface.call and Internet Explorer

    Hi, I´m developing a site, (
    www.gen-studio.com/avelart2
    ), and I´m using a swf to display a set of thumbs that when
    clicked show an item and its description on the browser, those
    items might be images or video, everything works fine with the
    images.
    And actually it works fine with the videos too, when using
    Firefox, but when I test the page on Internet explorer it just
    doesn’t work!
    On principle let me describe how it´s supposed to work,
    a thumbnail when clicked sends an id number to javaScript using
    ExternalInterface.call(“myFunction”,myId); -I´m
    using AS3 for the swf´s-
    the javaScript file has already loaded (ever since$(
    document).ready) a XML file which uses to match the id with a file
    and the description, if the item to show it´s a video, then it
    creates a variable which holds a string with the proper html to
    embed a swf (a swf movie player that resides just next to the HTML
    file), when loaded, the swf movie player uses
    ExternalInterface.call() to ask for the source of the video that
    has to play, and that function is as follows:
    setVideo: function(){
    alert("hola");
    return comun.miVideo;
    (The alert(“hola”); is just to test that the
    function is being called), which it is, but it returns null as a
    value instead of the proper string, and this happens only on
    internet Explorer, but works correctly on Firefox.
    I´ve been reading all day about the subject and found a
    few interesting things, which though have made me narrow my
    problem, they haven´t just provided me with a solution, what I
    found so far:
    -I must have in account flash security issues: Checked (my
    actionScript follows:)
    import fl.video.*;
    import flash.external.ExternalInterface;
    flash.system.Security.allowDomain("*");
    var vid:FLVPlayback = this.miPlayer;
    vid.source =
    flash.external.ExternalInterface.call("comun.setVideo");
    -ExternalInterface and Internet explorer don´t work
    properly when tested locally: Checked (I have a server on my PC and
    I´m testing the site as well in the above direction).
    -The object tag holding the swf must have a proper id
    attribute: Checked.
    -It´s super important the way the object tag is formed:
    Checked, and I also tested the tag separately (I put it directly in
    the HTML instead of adding it via javaScript) and it worked as
    expected in both Firefox and Internet Explorer, which leads me to
    believe:
    -I read somewhere that if you add the object tag by using
    innerHTML or appendChild, returning values from javaScript to swf
    won´t work, but I couldn´t find an explanation nor a
    solution.
    Well, as I said now I´ve been looking all day for an
    answer, so I really hope you can help me or give me some advice on
    the subject, thank you so much for your time!

    Hi! it solved itself !! (nahh, I wish), but it indeed had a
    solution, it was something quite simple, and I don´t really
    understand why it was not working in the first place, but here is
    the thing:
    I´m learning jquery and this is the first proyect
    I´m officially using it, so I was using
    $('#myDIV').append("string"); to embed the swf, (and it was working
    perfectly on Firefox), so since I had narrowed my problem to those
    lines, I decided to try some good-old-fashioned-javaScript and
    changed it for: var myDiv =
    document.getElementById('thatParticularDiv'); myDiv.innerHTML =
    ('string'); and it worked both in Firefox and IE !!!!!! :)
    I´m quite happy about it, and if someone knows
    what´s the issue with my jquery approach I would love to hear
    it. THANKS !!

  • 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.call problem with object-orientation

    Hi
    I am using an swf inside a PDF. In a PDF-context the ExternalInterface-class works much the same as it does within a website. So far calling a function in the document-script works.
    The thing now is, that I really try to use an object-oriented approach as often as I can. In this case I have a function I could call using
    var jsCaller:Object = ExternalInterface.call("myFunction",parameters);
    This works as expected.
    However, I have now made that function a method in an object, so I can access it within JS using dot-notation: myCoolObject.myFunction(); This works as well, so the problem is not the function itself. However, the call
    var jsCaller:Object = ExternalInterface.call("myCoolObject.myFunction",parameters);
    does not work.
    This means there's either something I'm missing, or it's a limitation of ExternalInterface, or it's a limitation of externalInterface in a pdf-context.
    Anyone to enlighten me?

    If EI calls eval it should be able to resolve the object-path. However, this doesn't seem to be the case. Also note that my parameter is an array, so this probably wouldn't work, even if the syntax did.
    Anyway, I tested your syntax in my PDF, and it showed the same behaviour as before (i.e. the function in which the EI-call was placed could not be executed, and acrobat claimed there was no such function). It didn't work with my normal function, and not even with a simple console.println-statement that way. So in PDFs it definitely doesn't work like that.
    But thanks for the suggestion!

  • SQL Server 2005 Analysis Services across domains

    Hi,
    With SQL Server 2000, the Enterprise Edition was required to access
    Analysis Services across domains.
    Is this also the case in SQL Server 2005, that the Enterprise Edition
    is needed?
    Thanks, S

    Silver,
    Do you still need help with this?
    Thank you!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • ExternalInterface Call Javascript Array to AS2 throwing undefined error

    I need to pass various (tracking) IDs to a .swf.  the IDs are in an array like this =
    <script type="text/javascript">
    function getImpID() {
    var medID={impID:'12345',pvID:'677890',exID:'654332'};
    return medID;
    function thisMovie(banner) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[banner]
        else {
            return document[banner]
    window.onload=getImpID;
    </script>
    Right now the AS2 I have is:
    import flash.external.*;
    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 split the three ID's from the javascript so that I can append them with various URL clickTags in the AS.  Main issue I have is the 'undefined' error, so I'm going out on a limb here that the AS2 I have doesn't do anything right now of value.  Biggest head scratcher for me is, if I have the IDs in an array in the javascript (medID) how to get them not only properly into Flash but to separate them into their separate IDs. 
    Any suggestions would be greatly appreciated.
    Thanks!

    Forgot to reply, your guidance helped in solving the riddle =
    actionscript:
    function idTag(){
              getID = Object(ExternalInterface.call("getImpID"));
              getID.toString();
      //_root.id_test.text = getID;
    idTag();
    javascript
    <script type="text/javascript">
    function getImpID() {
              var getID=['impID=8910424942498409873&pvID=8910423767061585831'];
              thisMovie("banner").getID;
              return getID;
    function thisMovie(movieName) {
        if (navigator.appName.indexOf("Microsoft") != -1) {
            return window[movieName]
        else {
            return document[movieName]
    </script>
    worked like a charm!

  • Content Repository sharing across domains

    Hello,
    Is it possible to share a bea content repository across domains?
    Thanks,
    -- Anant

    Ok,
    But besides caching, would there be any other issues, like entitlements and delegated admin?
    If the content cache timeout were to be set to say 20 minutes, then at the most the content would be 20 minutes out of date. So then could you set up a repository in multiple domains, with one domain having the entitlements and delegated admin setup for publishing content and the other domains being read only?
    Thanks,
    -- Anant

  • ExternalInterface.call('scroll',0,0) not working in chrome

    My application has a requirement that if the user is in the bottom of the page and clicks on any link which in turn opens a flex popup, it will take the user to the top of the application as popup opens on the top (as per requirement). For this i have used ExternalInterface.call('scroll',0,0); which works perfectly for every browser except google chrome. in chrome when user clicks it takes the user to the top but doesnt opens any popup, once user clicks on browser scrollbar and moves slightly then the pop up opens.
    Need a solution for this.
    Thanks in advance.

    Maybe chrome needs to get focus, if so instead of calling the scroll call
    another JS  function which scrolls and sets the focus on some html element in
    the browser. Not sure if it will work but you can give it a try.
    C

  • JMS Messaging Bridge ( communication across domains)

    Following is the Scenario
    We have 2 Weblogic domains, Domain A ( running on port 2000) and Domain B (running on port 3000)
    In Domain A I want to look up a Queue which is in Domain B and send a message on that that Queue.
    So the requirement is to send message from one domain to other domain ( i.e sending message across domains )
    I have read on forum that this is possible using JMS Messaging Bridge.Can any body please guide me or provide some sample code for this.
    Thanks in advance.
    Regards
    ~Yogesh

    Hi
    You can define the same queue in both domains.
    In domain A ( the source ) create the Origin of bridge
    In domain A too ( the source) create the destination of bridge ( pointing to address and port of domain B)
    In domain A create the bridge ( joining source and destination )
    In domain A , deploy the connector ... a .rar file
    Best Regards
    Jin
    PD: this doesn?t affect the code of your app.

  • Problem with AS3 "ExternalInterface.call" in InternetExplorer

    Hi,
    Explaining how the page is setup:
    I have a HTML page with 2 different AS3 Flash movies.
    The first flash movie is the main animation and sits in the
    middle of the screen with a large background image set into the
    body of the HTML.
    The second flash movie stretches 100% width/height of the
    screen dimensions and acts as a fade from black>to invisible.
    What I'm trying to do:
    Once the second Flash animation has faded from black to
    invisible it calls a JavaScript function in the HTML page to hide
    the div element the second flash movie is embed into (this is
    because the first flash movie will display a set of input boxes
    which the user needs to be able to type into - which they wont be
    able to click on if there is another flash movie overlaying the
    entire first movie).
    My intial solution:
    In the second Flash movie is the following code:
    stop();
    // this will load the API necessary to communicate with
    external entities
    import flash.external.ExternalInterface;
    // call the JavaScript function
    ExternalInterface.call('myJavaScriptFunction');
    ...and this works fine in Mozilla Firefox/Safari. The
    actionscript successfully calls the JavaScript function in the HTML
    page and that JavaScript function simply (at this stage displays an
    alert() message to show that it has been successfully called).
    Problem with IE:
    But, the moment I try this in Internet Explorer I don't get a
    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 can expect I'm totally confused as to what the problem
    could be.
    This is really urgent as it's a live project that needs to
    get completed immediately, so any help you may have would be
    greatly appreciated!
    Kind regards,
    Mark.

    My guess is that its to do with your embedding code. Check a)
    you have an id attribute assigned to the resulting object tag from
    whatever embedding method you use and b) for good measure make sure
    its unique in your html page.
    Javascript needs to have a valid reference to return the
    value from the javascript function back to flash. In my experience
    IE is more sensitive to issues here.
    If you get stuck post a test page somewhere.
    Tools to use to help with javascript debugging and view the
    html embed results (e.g. from swfobject or activecontent.js):
    In firefox : Firebug
    In IE: IE Developer Toolbar , Companion JS, and DebugBar are
    all helpful and , combined, get close to Firebug.

  • ExternalInterface.call() does not work normally since flash player 11.8.800.168

    Problem Description:
    korean character crash when using ExternalInterface.call(funcName, args)
         funcName : alpha-numeric
         args : include korean characters
    Steps to Reproduce:
    <flex source>
    private function handleRequest(val):void {
         ExternalInterface.call("processRequest", "가나다라");
    <javascript source>
    function processRequest(param) {
         alert(param); //does not display korean characters
    Actual Result:
         媛&#128;?섎떎??
    Expected Result:
         가나다라
    Any Workarounds:
    Nothing !!
    OS : Windows7 Pro 64bit(korean)
    Flex Builder : 3.0
    Flash Player : 11.8.800.168 ActiveX
    Browser : IE10
    WAS : WebLogic 8.1, 12g, Tomcat 5,6,7
    Chrome : 29.0.1547.66 m <== Good
    FireFox : 23.0.1 <== Good

    Same problem here! With the exact same version.
    Problems on IE.
    Chrome and FF OK

  • How do I enable "Access data sources across domains" in firefox?

    Couple of links do not work on my firefox however they work fine on IE. This is because the "Access data sources across domains" is enabled in IE and i am not sure on how to make this setting enable on Firefox as well.
    Please provide the steps to enable "Access data sources across domains" setting in Firefox.
    Please help!

    This should add the permanent exception:
    [https://support.mozilla.org/en-US/kb/connection-untrusted-error-message#w_bypassing-the-warning Connection Untrusted Error Message: Bypassing the Warning]
    However if it is not staying until the next time that the user opens up Firefox, is it possible that they are in permanent private browsing? [[Private Browsing - Browse the web without saving information about the sites you visit]] - that should have instructions to get in and out of it.

Maybe you are looking for