User Tools

Site Tools


Sidebar

en:objects:mouse:work_with_flash:get_mouse_pos_to_flash_player

get_mouse_pos_to_flash_player

get_mouse_pos_to_flash_player($flash_num,$x="",$y=""); - this function is used to get coordinates relative to the flash player window based on browser coordinates.The coordinates relative to the player are always constant, while the coordinates relative to the browser change as the browser size changes. This function helps you get coordinates for sending the event of a mouse click or mouse cursor movement to the flash player window.

the input Function accepts parameters:

  • $flash_num – number of the flash element on the current page. (int)
  • $x – x coordinate in the browser. If the parameter ="" , the current cursor position in the browser is taken.
  • $y – y coordinate in the browser. If the parameter ="" , the current cursor position in the browser is taken.

    After testing,the function returns the result of its work to the script :
  • x, y – mouse coordinates separated by a comma (string)
  • false – operation failed (boolean)

    PHP example:

    <?php $xhe_host = "127.0.0.1:7010";
     
    //connect the object to control the emulator, if not already connected
    if(!isset($path))
      $path = "../../../Templates/xweb_human_emulator.php";
    require($path);
     
    //Start
    echo "<hr> <font color = blue> mouse->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Go to the polygon:";
    echo $browser->navigate('http://humanemulator.net/poligon/embed.html')." n"; sleep(3);
     
    //move the mouse to the flash player
    $mouse->move(300,160,1,5);
     
    //2
    echo "2.Send click to flash at browser coordinate(play video):";
    echo $mouse->send_click_to_flash_player(300,160,0, false)." n"; sleep(10);
     
    //3
    echo "3.Get coordinates relative to the flash player:";
    echo $mouse->get_mouse_pos_to_flash_player(0,300,160)." n";
     
    //4
    echo "4.Send a left mouse button click event on the player coordinates:";
    echo $mouse->send_click_to_flash_player(290,150,0, true)." n";
     
    //five
    echo "5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):";
    echo $mouse->get_mouse_pos_to_flash_player(0)." n  n";
     
    //end
    echo "<hr> <br>";
     
    //Quit
    $app->quit();
    ?>

    Python example:

    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
     
    xhe_host = "127.0.0.1:7011"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> mouse.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Go to polygon:")
    echo(browser.navigate('http://humanemulator.net/poligon/embed.html'), "
    ")
    sleep(3)
     
    # move the mouse pho flash player
    mouse.move(300,160,1,5)
     
    # 2
    echo("2.Send click to flash at browser coordinate(play video):")
    echo(mouse.send_click_to_flash_player(300,160,0, false), "
    ")
    sleep(10)
     
    # 3
    echo("3.Get coordinates relative to flash player:")
    echo(mouse.get_mouse_pos_to_flash_player(0,300,160), "
    ")
     
    # 4
    echo("4.Send a left mouse button click event on the player coordinates:")
    echo(mouse.send_click_to_flash_player(290,150,0, true), "
    ")
     
    # five
    echo("5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):")
    echo(mouse.get_mouse_pos_to_flash_player(0), "
     
    ")
     
    # end
    echo("<hr> <br>")
     
    # Quit
    app.quit()

    C# example:

    #region using
     
    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;
    using System.Text;
    using System.Threading;
     
    using XHE;
    using XHE.XHE_DOM;
    using XHE.XHE_System;
    using XHE.XHE_Window;
    using XHE.XHE_Web;
     
    #endregion
     
     class Program: XHEScript
     {
    static void Main(string [] args)
    {
    //init XHE
    server = "127.0.0.1:7010";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> mouse.get_mouse_pos_to_flash_player </font> <hr>");
     
    browser.enable_video(true);
    browser.enable_activex(true);
     
    //go to polygon
    echo(browser.navigate("http://humanemulator.net/poligon/embed.html") + "<br>");
     
    //get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area)
    echo(mouse.get_mouse_pos_to_flash_player(1));
     
    //end
    echo("<hr> <br>");
     
    app.quit();
    }
    }

    Java Script example:

    //connect the object to control the emulator, if not already connected
    xhe_host = "127.0.0.1:7010";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> mouse.get_mouse_pos_to_flash_player </font> <hr>");
     
    //1 step
    echo("1.Go to the polygon:");
    echo(browser.navigate('http://humanemulator.net/poligon/embed.html') + " n"); browser.sleep(3);
     
    //move the mouse to the flash player
    mouse.move(300,160,1,5);
     
    //step 2
    echo("2.Send click to flash at browser coordinate(play video):");
    echo(mouse.send_click_to_flash_player(300,160,0, false) + " n");
    browser.sleep(10);
     
    //step 3
    echo("3.Get coordinates relative to the flash player:");
    echo(mouse.get_mouse_pos_to_flash_player(0,300,160) + " n");
     
    //step 4
    echo("4.Send a left mouse button click event on the player coordinates:");
    echo(mouse.send_click_to_flash_player(290,150,0, true) + " n");
     
    //step 5
    echo("5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):");
    echo(mouse.get_mouse_pos_to_flash_player(0) + " n");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/mouse/work_with_flash/get_mouse_pos_to_flash_player.txt · Last modified: 2020/10/14 12:51 (external edit)