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

  • Home
  • SEARCH
  • 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 9033997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:22:17+00:00 2026-06-16T08:22:17+00:00

I am calling my Main.swf from localhost Xampp which contains a prompt button upon

  • 0

I am calling my Main.swf from localhost Xampp which contains a prompt button upon click of that button promptclick function is called

AS3 code

function promptClick(event:MouseEvent):void
{
var desiredURL:URLRequest = new URLRequest("javascript:NewWindow=window.open('save.html','newWin','width=600,height=400,left =0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");

navigateToURL(desiredURL, "_self");

}

this window (newwin) has a button “Accept” defined in “save.html” , upon click of Accept button the data should be send to calling Main.swf.
I am not able to make a call from javascript window to my Main.swf function
through externalInterface callback in AS3

I have found that when i embed Main.swf on the same window which contains my editor it works(externalInterface call to Actionscript), but i don’t want to embed swf on editor page
Is there any way i can make call to from javascript window to swf directly without embedding?

  • 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-16T08:22:18+00:00Added an answer on June 16, 2026 at 8:22 am

    Your code should be calling a javascript function which is defined outside. Example:

    Javascript file:

    var formWin,
    
    formWinParams = {
        btnSelector: '.btn-on-form-win',
        name: 'windowNameHere',
        src: 'save.html',
    
        // Advanced string join (param could just be one long string instead)
        params: [
        'width=600',
        'height=400',
        'left=0',
        'top=0',
        'toolbar=No',
        'location=No',
        'scrollbars=No',
        'status=No',
        'resizable=No',
        'fullscreen=No'
        ].join(',')
    },
    
    swfFile;
    
    /**
     * Gets a javascript object reference to a swf file
     * @return object
     * @note You should swfobject or jquery to get your swf file but 
     * you might also need to setup a mechanism to make sure swf file 
     * is ready for interaction (or swf load is complete)
     * @see example of load check http://abi.edu/js/new-video-gallery.js
     */
    function getSwf (movieName) {
        if ( navigator.appName.indexOf( "Microsoft" ) != -1 ){
            return window[ movieName ];
        }
        else {
            return document[ movieName ];
        }
    }
    
    function onBtnClick (e) {
        swfFile.functionFromSwfFileHere();
    }
    
    /**
     * Gets form window lazily (if not there create it)
     * @return window object
     * @note Javascript function params are optional so we use the || operator to check if 
     * params are set otherwise we use our own values.
     */
    function getFormWindow (src, name, params) {
        src = src || formWinParams.src;
        name = name || formWinParams.name;
        params = params || formWinParams.params;
    
        // Create window if not already created
        if (formWin === null) {
            formWin = window.open(src, name, params);
            // Setup handling of the form window button click
            $(formWinParams.btnSelector, formWin).click(onBtnClick);
        }
    
        // Bring window to front
        formWin.focus();
    
        return formWin;
    }
    
    // Wrap initialization of script for ease of use
    function init () {    
        // Get reference to swf file
        swfFile = getSwf('swfFileIdHere');
    
        // Or use a library like jquery
        swfFile = $('#swf-file-id-here');
    }
    
    // Initialize javascript on window load (using jquery)
    $(function () {
        init();
    });
    

    Now change UrlRequest source to something like

    "javascript: getFormWindow();"

    or

    "javascript: getFormWindow('save.html', 'saveWin');"

    and it is all handled from there simplifying your actionscript and javascript code and making it more dynamic.

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

Sidebar

Related Questions

I have a little test swf to test calling an ActionScript(3.0) function from JavaScript.
I have my main application ,from my main application I will be calling another
I have a number of iframes calling a function in my main page. Is
what is the difference between calling a mapreduce job from main() and from ToolRunner.run()
I saw a Java example that had a main method labeled as synchronized, calling
What are the 'costs' involved in calling an empty PHP function? The main purpose
We have a Flex 3 application of which the main .swf is running in
i noticed that mingw adds alot of code before calling main(), i assumed its
I'm using the CodeIgniter framework. I load a main view, which contains several tabs,
I have an AS2 Flash SWF that is calling another AS2 Flash File using

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.