Crosshair to follow mouse and become static on click

  • Hi Guys =

    Im trying to make a crosshair plugin perform an action to make it clear to the user where a hotspot is going to be created.

    I tried this - to no avail - Anyone mave any better ideas? - I already have js detecting the mouse location but I also want a crosshair to make it obvious where the hotspot is going

    <plugin name="crosshair" url="images/crosshair.png" visible="true" autopos="center"/>

    <action name="moveCrosshair">
    set(plugin[crosshair].visible,true);
    set(plugin[crosshair].ath,screentosphere(get(mouse.x)));
    set(plugin[crosshair].atv,screentosphere(get(mouse.x)));
    </action>

    Thanks in Advance

    JB

  • Hi,

    Just a remark, what are plugin[].ath, plugin[].atv : spherical coordinates ???

    From documentation:

    - The mouse.x and mouse.y coordinates are relative to the left top edge of the area and the mouse.stagex and mouse.stagey coordinates to the left top edge of the whole flash stage/window.
    So probably you will use
    -The plungin[].x and plugin[].y which are distance from the align point to the edge point.
    This can be a absolute pixel value or a relative (to the screenwidth or screenheight) percent value.

  • i use this to move pluigins it will have to be adapted for hotspots withthe code Zepher provided.

    <action name="follow_the_mouse">
    if(dragging,
    set(plugin[%1].align, topleft);
    set(plugin[%1].edge, topleft);
    add(plugin[%1].x, mouse.x, 0);
    add(plugin[%1].y, mouse.y, 5);
    delayedcall(0, follow_the_mouse(%1));
    );
    </action>

    and on the plugin i use

    ondown="set(dragging,true); follow_the_mouse(get(name));"
    onup="set(dragging,false);"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!