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 8328667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:31:04+00:00 2026-06-09T01:31:04+00:00

Is that possible to fire Flash-button click-event via javascript ? it`s my code ,

  • 0

Is that possible to fire Flash-button click-event via javascript ?

it`s my code , and i call fromJS() from javascript and it fires without any problem , but contain of this function :

myButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));

does not work !

package 
{

import flash.external.*;
import flash.net.FileReferenceList;
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.system.Security;

public class MultiSelectClass extends MovieClip
{
    private var fileRef:FileReferenceList;

    function MultiSelectClass()
    {
        Security.allowDomain( "*" );
        myButton.addEventListener(MouseEvent.CLICK, myButtonClick);
        addCallbacks();
    }

    private function addCallbacks():void
    {
        if (ExternalInterface.available)
        {
            ExternalInterface.addCallback("sendToFlash", fromJS);
        }
        return;
    }

    function myButtonClick(ev:MouseEvent):void
    {
        fileRef = new FileReferenceList();
        fileRef.browse();
    }

    private function fromJS():void
    {
         myButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
    }

    private function sendToJS():void
    {
        if (ExternalInterface.available)
        {
            ExternalInterface.call("alert","Hello as3");
        }
    }
}
}
  • 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-09T01:31:07+00:00Added an answer on June 9, 2026 at 1:31 am

    You can do this using the ExternalInterface class and adding a callback handler to said function.
    The flash side would look like this:

    if (ExternalInterface.available) {
        ExternalInterface.addCallback("fromJS", fromJS);
    }
    

    Then in your javascript, you just call that method from the flashObject.

     mySwfObject.fromJS();
    

    Here is a link to official adobe documentation:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

    -YOUR ISSUES IN THE COMMENTS-

    Flash for security reasons will not let you popup the File browser without an actual mouse click, dispatching the mouse event manually does not fool it and there isn’t (or at least shouldn’t) be a workaround for this. The user will have to actually click your flash button to bring up the file browser (or to full screen a flash app).

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

Sidebar

Related Questions

I want to call a controller function from a view. Is that possible in
It is not possible to fire an event in C# that has no handlers
Is there any event that fire when the value of the textbox change from
Is it possible to fire a specific JavaScript event when a certain DIV comes
Possible Duplicate: How to fire uibarbuttonitem click event programmatically I have created an uibarbuttonitem
Is that possible to know where is a jQuery function launched from ? <div>
I need to fire the jquery datepicker from a link click. Right now if
I would like to know if it is possible to fire an event after
Is it possible to call a method that is an attribute? I mean, I
Is it possible to fire a JavaScript method after a form element is considered

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.