Interacting with DOM objects using HTML

Hi,
I want to listen to "text selection" on a webpage in AS (i.e. as soon as a user highlights some text and releases the mouse button, an event gets fired). Events for cut, copy, and paste are available, but none for "text selection". I have read about cross-scripting between AS and JavaScript and understand it, although I do not understand yet how it can solve my problem. Also, is there any simpler way to do it directly in AS, without getting into JavaScript?
Thank you very much
Rehan.

There's a non-standard onselectstart attribute (or "selectstart" event type) that looks to be the only HTML DOM event dispatched for text selection.
You can listen for such DOM events from ActionScript like so:
package {
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.events.Event;
    import flash.html.HTMLLoader;
    public class HTMLLoadderTest extends Sprite
        private var html:HTMLLoader = new HTMLLoader();
        public function HTMLLoadderTest()
            this.stage.scaleMode = StageScaleMode.NO_SCALE;
            this.stage.align = StageAlign.TOP_LEFT;
            html.loadString("<html><body><p>Something to select.</p></body></html>");
            html.width = this.stage.stageWidth;
            html.height = this.stage.stageHeight;
            html.addEventListener(Event.COMPLETE, completeHandler);
            addChild(html);
            stage.nativeWindow.activate();
        private function completeHandler(event:Event):void {
            event.target.window.document.body.addEventListener("selectstart", reportSelection);
//Note that you have to use Object as the parameter type because the JavaScript Event class is not the same as the ActionScript Event class
        private function reportSelection( event:Object ):void
            trace(html.window.getSelection());

Similar Messages

  • Interacting with 3D objects

    Good Night.
    I'm doing a project in which I need to interact with 3D objects, ie a 3D object as a cube, for example, can hit a 3D ball and the ball simulates the actual motion as when a ball really hit, something like ping pong. How I can achieve this?, Thanks

    Also, look at this example if you need to see the equations been solved (this requires you to have LabVIEW Control Design and Simulation Module, which is part of the academic license):
    C:\Program Files (x86)\National Instruments\LabVIEW 2013\examples\Control and Simulation\Case Studies\Physics\Bouncing ball\Bouncing Ball 3D.vi
    And if you to this folder:
    C:\Program Files (x86)\National Instruments\LabVIEW 2013\examples\Graphics and Sound\3D Picture Control
    There are several examples on how to use the 3D picture control for your project like:
    Create and Render Objects.vi
    3D Model of a Solart System.vi
    and several others.
    This will let you freely control the objects.
    Now, if you have access to the LabVIEW Robotics Module, it also has a physics simulator that would help you create the environment based on the Open Dynamic Engine (ODE) module.
    http://www.ni.com/white-paper/11564/en/
    Barp - Control and Simulation Group - LabVIEW R&D - National Instruments

  • Interacting with embeded flash using bot

    I am trying to understand if it would be possible for a web crawler to interact with a flash object embeded in a web site.
    For exemple would it be possible to automaticaly use this website with a bot or some other program? http://www.r2d2translator.com/
    Don't know if I have explained myself properly.

    Hi Bernd,
    This is exactly what I am trying to do and the sample you pointed out is working just fine. The only issue that I now have is it does not work when I try to the PDF forms myself. I am using Adobe LiveCycle Designer version 8.2 to create the forms.
    For some reason this.external and this.hostContainer properties are not available to me in my docReady event. Do you know if this was deprecated in version 8 or so? are there any other alternatives for this?
    Thanks
    Shreedhar

  • Interact with content loaded in html overlay / acces accelerometer?

    Hi,
    is it in any way possible to interact with html content loaded in the Web Content overlay?
    Or is there a way to acces the accelerometer in indesign?
    greetz
    Mario

    Moved to DPS forum

  • Interact with 3d objects in CS6

    Can you import 3D objects from, say Blender/3ds max, and interact with them in Flash CS6. If not, whats the best program or best way to do this?

    you can but you will probably want to implement a 3d framework like away3d or flare3d:  http://www.adobe.com/devnet/flashplayer/stage3d.html

  • Interacting with client system using Applet

    Hi,
    I want to interact with client system and access files on his system using applet,could u suggest the way to do it or any other siurce where I can find this information.
    It's very urgent,pl reply soon
    thanq

    hi,
    These steps will get your applet signed and you could interact with your client system through applets.
    IRENE 10 steps : http://forum.java.sun.com/thread.jsp?forum=63&thread=132769
    best wishes
    Rajesh

  • Interlace problems with moving objects using iDVD

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

    I had an MP4 file (created by a 3rd party) from a Hi-8 analog tape which has some interlace artifacts on moving images (left image of boy) but not too bad. When the MP4 files was imported into iMovie 11 the interlace artifacts smoothed somewhat - that was OK (right image of boy). The camera was still and the boy was moving.  Vertical lines on stationary objects are OK in all images. These are screen captures from the Mac of the mp4 played through quicktime and the same file imported into iMovie 11 and played.  I paused both to take the screen capture.
    The completed project in iMovie 11 looked OK when previewed prior to rendering. These are 20 year old videos so my expections were being met.   I rendered the project with iDVD to the hard drive first and then to a DVD with the same poor imaging result on the moving object.  I am using a new Macbook Pro I bought in early January which came with iMovie 11 and iDVD  Ver 7.1.2 (1158). Running Mac OS X 10.7.3  Macbook Pro  2.3 Ghz Corei7   8GB 1333 Mhz DDR3.
    I couldn't screen capture from the MAC DVD player screen to illustrate the poor result (got a checkerboard screen) so I took a photo of the screen and imported that (below).  The moving boy on the left is from an  iMovie 11 screen capture, the image on the right is the moving boy from the rendered DVD I paused on the Mac (and took a pic of).
    Below a close up of the poorly rendered moving boy viewed on the resultant DVD.  This translates into a horrible rendition of any quick moving object.  It happens with any moving image - i.e. a pan across a room with straight vertical lines like edges of a wall will show as serrated and poorly rendered edge. I used a trial version of the Daniusoft DVD creator with the same result!  I am at a loss on how to resolve this issue.  Any thoughts out there??
    I had previously used Pinnacle Studios on my old XP PC which worked great on other tape's Mpeg files and created great DVD's (never had an interlace problem) ... until my computer died .....  so I figured Apple and associated software should be at least equal if not a superior product.   Now I'm not too sure!

  • IS-U: Migration- Issue with DEVICE object using EMIGALL

    Hello Friends,
    I need a quick help. The issue is here below.
    I am using the object DEVICE to create Device/Equipment. I could able to create an Equipment however I found that in EQUI table the field SERNR is not updated.  Actually this field should have the value of EQUNR.
    I had tried many times wih differenct possible options but this field is empty in all the trials. I am also using the auto structure CONTR and its sub strucutures COMMIT, UPDATE, INDIV, CONV filling with  'X'   but the result is only this field SERNR is not updated in the table EQUI.
    Without this field SERNR being field I cannot perform Device Installation (Full/Technical/Billing).
    Please share your ideas.
    Thanks in Advance,
    Vijay.

    Hi Vijay
    That's possible...
    I assume transaction IQ01 and EMIGALL are using the same function EQUIPMENT_INSERT.
    If NEW_VEQUI-EQUNR contains already a number, the function does not get a new number from the number range object, for example with external numbering. In case there's no EQUNR given, a new number is taken from the number range object, internal numbering.
    If no SERNR is provided when calling EQUIPMENT_INSERT, there won't be a SERNR in EQUI. Just check if IQ01 provides the serial number when calling EQUIPMENT_INSERT.
    This means another possible solution is to get a new number for EQUNR in EMIGALL and populate EQUNR and SERNR before calling the service function module ISU_M_EQUI_INSERT. Call function module NUMBER_GET_NEXT for object EQUIP_NR.
    This can be done on field level by setting the Processing Type to 4 = Rule (check which of the two fields comes first - EQUNR or SERNR - to assign the number from NUMBER_GET_NEXT and copy the value for the second field) or via events see menu item Utilities: Event, when you're in the object maintenance screen.
    Yep
    Jürgen

  • List with multiple objects using Comparator

    Hi,
    I have a comparator to sort the fields of 2 objects. I have a resultlist which contains the CustomerAddressVO which contains the properties of both
    Customer and Address entities List resultList<CustomerAddressVO>.
    This CustomerAddressVO.java in turn have
    private long id
    private Customer customer;
    private Address address;
    Where Customer.java
    will have properties of customer
    Where Address.java
    will have properties of address
    Now i need to use the comparator for customer.getName() asc and address.id() desc, as i have mentioned the resultList doesn't directly contain this object as it contains CustomerAddressVO which in turn have those two object Customer and Address. Hence unless you iterate the list and retrieve the respective objects (customer, address) you cannot do the sorting through comparator. In such case how we can go about it. If you iterate the list also how we can pass the respective object to the compare() ? And more importantly we need to sort the columns of 2 different entites? Please clarify how we can go about it?
    Thanks.

    You can still do the sorting through a Comparator
    The compare method should take
    public int compare(CustomerAddressVO o1, CustomerAddressVO o2) { //..so you can then do
    01.getCustomer().getName();
    //and
    o1.getAddress().getId() together with relevant null checks

  • VM memory usage with DOM objects

    Hi - I have a general question regarding VM memory use (and garbage collection) when using instances of XMLDocument (we're using the Java version of the parser, v2.0.2.6).
    Say we have an existing instance of XMLDocument containing a valid xml document. What happens when:
    a) XMLDocument is set to null? When will all the previous xml Node/Element instances that were referenced in the document structure be garbage collected? My understanding is that objects will only be garbage collected when there are no remaining references to them. How does this apply to the tree structure of references between Node instances in the XML document? I am guessing that by setting XMLDocument to null, this change will eventually cascade through all the other nodes, so eventually they are released?
    b) Secondly, what happens to the existing Node/Element instances referenced in an instance of XMLDocument if I assign it new document contents from getDocument() on an instance of DOMParser? Does this create a new document tree structure from scratch and create new instances of Nodes to represent the new document, or are the previous instances of Node etc from the previous document reused somehow?
    c) Following on from above, if the previous instances of Node from the previous document are not reused, when are these garbage collected?
    Thanks in advance,
    Kevin Hooke

    The XMLdocument object, although representing the entire document, is referenced solely to the root of the DOM tree. To clean up the DOM Tree, one should set all the references to the tree (doc, node, elements, ...) to null.
    Here are the specic answers to your questions:
    a) Setting XMLDocument to null will NOT have the cascading effect on the other Nodes/Elements.
    b) Yes, the previous DOM Tree still exists if there are any Node/Elements pointing to it even if you get a new document. When you get a new document, you get a new DOM Tree representation.
    c) Unfortunately, there is no way to guarantee when the garbage collection takes place in the JVM. Check out the method System.gc() to "suggest" to the JVM the invocation of the gabage collector.
    Oracle XML Team

  • Interactive form callable object using adobe form manager

    Hi,
      I have several interactive forms in an application that is created using Adobe Form Manager. Is there a way to create a callable object from this application and use it in the Guided Procedure?
    Regards,
    Yuvaraj S G

    Hi Andre,
         If I use Adobe Livecycle Designer, I need to create the whole application from the scratch which will take too much time. 
         So, I'm finding out if there is a way to reuse the application that's already available.
    Thanks a lot for the reply,
    Yuvaraj S G

  • Interacting with embedded object

    I'm using a bit of software called 3Dvia composer which is used to create 3D technical documentation.  The software is capable of exporting the 3D content to a PDF.  The content is then viewed in the PDF via an embedded activex player which has it's own API.
    I have one such PDF with embedded 3Dvia content which I would like to add some text boxes to and some JavaScript to extract information from the embedded content and put it in the text boxes.  I have successfully done this before in an HTML page using VBScript.
    Unfortunately I know next to nothing about JavaScript!  Can anybody give me some idea of how I could identify the embedded player in the PDF using JavaScript, so that I can use it's methods?
    Any advice would be much appreciated!

    I can't really help you with learning JavaScript, but once you do, you can take a look at the JavaScript for Acrobat 3D Annotations API Reference located at the URL below.
    http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_3D_Intro.90.1.html
    J-

  • How to put in put fields in abap objects using HTML documents

    Hallo Every body,
    I have got a problem in my program actually I have created 4 splitters. in this two are for Document search and the other two are for material search, The other two splitters are for HTML. I wanted to give the end user five i in put fields in Document search and Four fields in material search. So that the data is retrived from the data base ( DRAW, MARA). all these fields must have search help (F4).  after this it should have the drag and drop behavior.
    I have created the html but the F4 help is not working and when I am trying to get the data from data base it is processing but the result is zero.
    Is there any other way of doing this. If so can you tell me if possible send me one example too.
    Thank you in advance.
    Regards

    check this sample program
    DD_ADD_FORM_INPUT

  • Interaction with Microsoft Word using Java Programming

    writing Text ON TO MICROSOFT WORD USING java Programming Urgently required

    Go throuh jakarta POI(hssf) to do..No! HSSF which stands for Horrible SpreadSheet Format can be used for Excel (spreadsheets as the name suggests). For Word, you would need to lok at HPSF.

  • Using UI Automation Framework to interact with Flex applications

    Hi all,
    I created a small flash app using Flex builder 4.
    I am writing a tool to interact with flash applications using UI Automation Framework which is similar to UI Spy. I've read in so many forums that accessibility can be done using UI Automation or MSAA.
    Using the tool, I am able to get all the fields that are present in the application. (button, text, edit fields etc). Now, I want to use InvokePattern on buttons from my tool so that, if I click "Invoke" in my tool, the associated button will be clicked in the flash app. Here, I find no issues to do anything.
    But, if there is a textinput field on the flash application and I use ValuePattern of UI Automation to set some value in the field using SetValue(), then I am getting
    "System.InvalidOperationException"
    even when I tried simple SetFocus() on to that field, I am getting the same exception Looks like, I cannot interact with flash text fields in the same way I do with other window's fields.
    I used UISpy and other tools to see if they are doing any better with setting values on a text field. But, they too failed with same exception.
    Can someone tell me why this is failing? Does flex/flash support UI Automation to this extent? Are there any examples or links that can help me here?

    @riatest Thanks for the info.
    I downloaded flex sdk to see if there is anything that will help me. But, In flex sdk, I cannot find anything that would ease my path. I want to stick to developing in C# to talk to Flash applications. What is the best way to proceed? Are there any sdks that I can download and use for C# development to interact with the flex controls? What is the way to go? I seem not to find any good hits in the web as well
    Thanks
    Sailesh

Maybe you are looking for