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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:05:30+00:00 2026-06-13T20:05:30+00:00

In JavaScript we have document.elementfrompoint to get an element based on coordinates. Is there

  • 0

In JavaScript we have document.elementfrompoint to get an element based on coordinates.
Is there any thing like that in Openlaszlo to get a view based on coordinate?

  • 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-13T20:05:33+00:00Added an answer on June 13, 2026 at 8:05 pm

    There is no direct support for that functionality in OpenLaszlo, but for ActionScript 3 based runtimes you can utilize the flash.display.DisplayObjectContainer#getObjectsUnderPoint() method. In the DHTML runtime, you can use the document.elementFromPoint(x, y), and based on Quirksmode that should be supported by all modern browsers.

    Here is an example program implementing an canvas.elementFromPoint() method:

    <canvas debug="true">
    
        <passthrough when="$as3">
            import flash.geom.Point;
        </passthrough>
    
        <view id="background" width="100%" height="100%" bgcolor="#eeeeee" clickable="true"/>
    
        <view id="red" x="200" y="100" width="200" height="200" bgcolor="#ff0000" opacity="0.3" clickable="true" />
        <view id="green" x="150" y="200" width="200" height="200" bgcolor="#00ff00" opacity="0.3" clickable="true"/>
        <view id="blue" x="250" y="200" width="200" height="200" bgcolor="#0000ff" opacity="0.3" clickable="true"/>
    
        <handler name="onclick" reference="lz.GlobalMouse">
            canvas.elementFromPoint();
        </handler>
    
        <method name="elementFromPoint"><![CDATA[
            var mouseX = canvas.getMouse('x'),
                mouseY = canvas.getMouse('y'),
                objects = null,     // array of objects at mouse pointer in SWF runtime
                element = null;     // The element we are looking for
            Debug.info( 'mouse position: x=' + mouseX + ' / mouseY=' + mouseY );
            if ($as3) {
                // in SWF runtime, use the DisplayObjectContainer.getObjectsUnderPoint() method
                objects = canvas.getDisplayObject().getObjectsUnderPoint(new Point(mouseX, mouseY));
                element = objects[objects.length-1].owner;
            } else {
                // in DHTML, we can use elementFromPoint, and need to retrieve the owner view of the div
                element = document.elementFromPoint(mouseX, mouseY).owner.owner;
            }
            Debug.info('View under mousecursor:', element);
            return element;
        ]]></method>
    
    </canvas>
    

    There are 4 views, one background view scaled to 100% x 100%. And three color views: red, green and blue – with the blue one being the top one. When clicking on the view, the correct view object is returned.

    enter image description here

    The code has been tested in the DHTML runtime with Chrome 22.0, Firefox 16.0.1, and Opera 12.02. Flash should work in every browser, I haven’t tested with IE.

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

Sidebar

Related Questions

I have a javascript that displays a generated text into a div: document.getElementById('phrase').innerHTML =
So I have a xml document loaded in JavaScript variable. Xml looks like this:
I have a javascript function generateGraph() { ... jQuery.get('chart.php?month='+month+'&year='+year); document.getElementById('graph').src = 'charts/'+month+'_'+year+'.png'; ... }
I have the following Javascript code that works perfectly: $(document).ready(function() { $(#Select1).setDefault(); $(#Select2).setDefault(); $(#Select3).setDefault();
Javascript: I have the DOM representation of a node (element or document) and I'm
I have Javascript code that does this: var oObjchbox = document.getElementById(CheckBox_ + countyId); The
I have JavaScript code that hides a tag when it is clicked: document.getElementById(div).style.visibility=hidden; Although
I have javascript function that automatically adds input fields together, but adding numbers like
In Javascript I have code like: document.addEventListener("mousedown", mouseDownHandler); and occasionally I might fat finger
I'd like to make an XML document in JavaScript then have a save dialog

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.