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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:46:11+00:00 2026-05-17T01:46:11+00:00

I’ve been reading about using ExternalInterface to have Flash communicate with JavaScript. I need

  • 0

I’ve been reading about using ExternalInterface to have Flash communicate with JavaScript. I need to detect and call some code in JavaScript when the user starts playing the video and when the video ends. The swfobject is nifty for embedding a player on the page, but I can’t figure out how to add these event handlers to it. Here’s my code:

function flashFallback(){
jQuery('#dialog').dialog({
  modal:true,
  autoOpen:false,
  height: 119
});
jQuery("#dialog").dialog("open");

setTimeout(function(){
  var el = "";
  var vidFileName = "";
  var posterPath = "";
  var videoTag = "";
  var boxId = "";
  var so = "";
  var flashId = "";
  var flashVars = "";
  var params = "";
  var attributes = "";
  var anchorId = "";
  var dotPosition = "";
  var count = jQuery("video").length;
  //alert(count);

  jQuery("video").each(function(){
    el = "";
    vidFileName = "";
    posterPath = "";
    videoTag = "";
    flashId = "";
    flashVars = "";
    params = "";
    attributes = "";
    anchorId = "";

    el = jQuery(this);

    boxId = this.id + "_flashBox";
    flashId = this.id + "_flashPlayer";
    anchorId = this.id + "_anchor";

    el.parent().parent().find("div:first").attr("id",boxId);

    el.parent().find("source").each(function(){
      if (jQuery(this).attr("src").indexOf("m4v") != -1 || 
        jQuery(this).attr("src").indexOf("mp4") != -1){
        vidFileName = jQuery(this).attr("src").substring(jQuery(this).attr("src").lastIndexOf("/")+1);
      }
    });

    /*
      IE uses the Flash player, which overlays a 'Play' button
      on the poster image by default; so we use a poster image
      that doesn't have a play button. Otherwise we'd end up 
      with a play button on top of a play button.
    */

    dotPosition = el.parent().find("img").attr("src").lastIndexOf(".");
    posterPath = el.parent().find("img").attr("src").substring(0,dotPosition) + "-ie" + el.parent().find("img").attr("src").substring(dotPosition);

    el = jQuery("[id="+boxId+"]");
    el.empty();
    el.append("<a id='" + anchorId +"'></a>");

    flashvars =
    {
      file:                 vidFileName,
      autostart:            'false',
      image:                  posterPath
    };

    params =
    {
      allowfullscreen:      'true', 
      allowscriptaccess:    'always',
      wmode:                  'opaque'

    };

    attributes =
    {
      id:                   flashId, 
      name:                 flashId
    };

    swfobject.embedSWF('global/vid/player.swf', anchorId, '372', '233', '9.0.124', 'global/js/swfobject/expressInstall.swf', flashvars, params, attributes);
  });
  jQuery('#dialog').dialog("close");
}, 200);

}
  • 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-05-17T01:46:12+00:00Added an answer on May 17, 2026 at 1:46 am

    You don’t have to bother with that. Just detect the events in flash and then call the javascript function you want in your flash event handler:

    import flash.external.ExternalInterface;
    ...
    ExternalInterface.call("your_javascript_function()");
    

    http://codingrecipes.com/calling-a-javascript-function-from-actionscript-3-flash

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

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have thousands of HTML files to process using Groovy/Java and I need to
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.