Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8589969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:11:07+00:00 2026-06-11T23:11:07+00:00

import flash.external.ExternalInterface; var pageURL:String = ExternalInterface.call(‘window.location.href.toString’); The above code seems to work on Firefox,

  • 0
import flash.external.ExternalInterface;
var pageURL:String = ExternalInterface.call('window.location.href.toString');

The above code seems to work on Firefox, but when I try it with Chrome or IE it doesn’t work (it causes an Error and stops the swf’s execution).

Any hint?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:11:08+00:00Added an answer on June 11, 2026 at 11:11 pm

    ExternalInterface works in recent versions of all major browsers. The first thing you should do is wrap that call in a check to see if it is currently available:

    if(ExternalInterface.available)
    {
      ExternalInterface.call('window.location.href.toString');
    }
    

    The problem with Chrome and IE may be the call to window.location.href. Your best bet is to put this into a JS function, and then call that function from AS, like so:

    //JS:
    
    function reportHref(){
        return window.location.href.toString(); 
        // I'm not sure this is good cross-browser JS. 
        // If it isn't, you can at least test it directly in the browser
        // and get a javascript error that you can work on.
    }
    
    //AS:
    var result:String = "";
    if(ExternalInterface.available)
    {
        result = ExternalInterface.call("reportHref");
    }
    else
    {
        result = "External Interface unavailable";
    }
    trace(result);
    

    Also, make sure the function you are trying to call is already present in the DOM before you try to call it – if you add your SWF before you add the script, and make the call to ExternalInterface immediately, then it will fail because reportHref doesn’t exist yet.

    And, finally, it’s possible that a call from within the SWF to the window.location object might fail due to sandboxing, which won’t be the case if you make the call from a JS funciton in the page.

    The docs on ExternalInterface are pretty comprehensive, with good examples:

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to have JavaScript call a function from my ActionScript. ActionScript: import flash.external.ExternalInterface;
stop(); import flash.external.ExternalInterface; ExternalInterface.addCallback(quarter1call, quarter1call); function quarter1call():void { gotoAndPlay(2); } Would the above script
Actionscript: System.security.allowDomain(http:// + _root.tdomain + /); import flash.net.FileReferenceList; import flash.net.FileReference; import flash.external.ExternalInterface; import flash.external.*;
This is the AS3 part: import flash.net.FileReference; import flash.events.Event; import flash.external.ExternalInterface; import flash.system.Security; Security.allowDomain(
I have a timer script: import flash.utils.Timer; import flash.events.TimerEvent; var secs:Number = 30;//second var
I need to call some jQuery .load() function from flash. i Use this: import
import flash.filesystem.*; /// Change the line below to point to your mp3 online var
package { import flash.display.MovieClip; import flash.events.Event; public class Bullet extends MovieClip { private var
I'm using: import flash.utils.ByteArray; import mx.utils.Base64Encoder; import mx.utils.Base64Decoder; . . . public static function
package { import mx.controls.LinkButton; import flash.text.TextLineMetrics; public class multiLineLinkButton extends LinkButton { override protected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.