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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:12:58+00:00 2026-06-05T18:12:58+00:00

I have a canvas element positioned absolutely over a Flash object of the same

  • 0

I have a canvas element positioned absolutely over a Flash object of the same dimensions. I want to be able to click on the canvas element and dispatch that event – or, more correctly, an imitation of that event – to the Flash object underneath.

I added an event listener to the Flash object so I know that the event is being successfully dispatched to the Flash object. The problem is that the Flash object simply doesn’t react to it (e.g. clicking in the region of the giant ‘play’ button doesn’t play the video).

Can Flash objects react to events in this fashion? Is there something special about Flash in the DOM that requires something other than JavaScript event delegation to activate responses from it?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8"/>
        <title>Delegating click events from a DOM element to an underlying Flash object</title>
    </head>
    <body>
        <object type="application/x-shockwave-flash" name="StrobeMediaPlayback" data="assets/StrobeMediaPlayback.swf" width="640" height="480" id="StrobeMediaPlayback" style="visibility: visible; position: absolute; top: 0; left: 0;">
            <param name="allowFullScreen" value="true">
            <param name="wmode" value="transparent">
            <param name="flashvars" value="src=http://mediapm.edgesuite.net/strobe/content/test/AFaerysTale_sylviaApostol_640_500_short.flv&autoPlay=false&verbose=true&controlBarAutoHide=false&controlBarPosition=bottom&poster=assets/images/StrobeMediaPlayback.png">
        </object>
        <script type="text/javascript">
            var smp = document.getElementById('StrobeMediaPlayback');
            smp.addEventListener('click', function (e) { console.log('CLICK'); }, false);
            addCanvas();
            
            function addCanvas() {
                canvas = document.createElement('canvas');
                canvas.width = 640;
                canvas.height = 480;
                canvas.style.position = 'absolute';
                canvas.style.top = '0px';
                canvas.style.left = '0px';
                canvas.addEventListener('click', function (e) { evt(smp, e); }, false);
                ctx = canvas.getContext('2d');
                document.body.appendChild(canvas);
            }
            
            function evt(el, e) {
                var event = document.createEvent('HTMLEvents');
                event.initEvent(e.type, true, true);
                for (var key in e) {
                    event[key] = e[key];
                }
                el.dispatchEvent(event);
            }
        </script>
    </body>
</html>
  • 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-05T18:13:01+00:00Added an answer on June 5, 2026 at 6:13 pm

    Use ExternalInterface to communicate between your SWF and the DOM.

    You can create a function inside your SWF and then call that ActionScript function from JS using:

    ExternalInterface.call( functionInsideYourSWF )
    

    In your case you would call your ActionScript function when someone clicks on your canvas element, then have Flash handle that click event internally with whatever you define inside your ActionScript function, e.g. play your video.

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

Sidebar

Related Questions

I've setup my app/website such that I have an absolute-positioned canvas element on top
My absolutely positioned canvas elements are blocking all the mouse events so that nothing
I have an element positioned on Canvas using attached properties Canvas.Top and Canvas.Left .
I have to create a canvas that contains object with position in binding with
I have a Canvas element, contained within a ScrollViewer, which I'm zooming using ScaleTransform.
I havent had much exposure to the Canvas element in HTML5. I have done
I have a web page with a single element: a canvas of 3000x3000 and
I Have a canvas and would like to place silverlight elements within that canvas
I have a canvas that I am using a javascript function to display text
I want to allow drag-and-drop re-ordering of photoshop-like layers. Assuming I have 3 canvas

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.