how use follow_the_mouse to plugin with align=right

  • Hi,

    I didn't see any answer on the forum about this.
    I want to use follow_the_mouse for a plugin img with align=right !

    It's working well with <plugin name="a001plan align=left ...

    Code
    <plugin name="a001plan" zorder="2" url="plan.png" alpha="0" keep="true" align="topleft" x="10" y="10" scale="1" enabled="false" height="prop" handcursor="false" edge="" children="true"/>	<plugin name="a001scene1" url="mappoint.png" keep="true" parent="a001plan" align="center" edge="center" width="20" height="20" x="3%"  y="-19%" zorder="2" onhover="set(plugin[a001info_text].html, data:10011); set(autorotate.enabled,false); set(plugin[a001info_text].visible, true);" onout="action(a001lie_2,a001scene1); set(autorotate.enabled,true); set(plugin[a001info_text].visible, false);" />
    <plugin name="a001info_text" parent="a001plan" zorder="5" onloaded="a001follow_the_mouse(get(name));" url="plugins/textfield.swf" html="" css="p{color:#FFFFFF; font-family:Arial; font-size:14; margin-left:5; margin-right:5; text-align:center; }" keep="true" visible="false" width="250" height="20" backgroundcolor="0x000000" roundedge="6" shadow="1" borderwidth="0" glow="4" align="lefttop" x="0" y="0"/>
    <action name="a001follow_the_mouse">  add(plugin[%1].x, mouse.x, 0);  add(plugin[%1].y, mouse.y, 0);  delayedcall(0.01, a001follow_the_mouse(%1));</action>


    But not with <plugin name="a001plan align=right !?

    Code
    <plugin name="a001plan" zorder="2" url="plan.png" alpha="0" keep="true" align="topright" x="10" y="10" scale="1" enabled="false" height="prop" handcursor="false" edge="" children="true"/>	<plugin name="a001scene1" url="mappoint.png" keep="true" parent="a001plan" align="center" edge="center" width="20" height="20" x="3%"  y="-19%" zorder="2" onhover="set(plugin[a001info_text].html, data:10011); set(autorotate.enabled,false); set(plugin[a001info_text].visible, true);" onout="action(a001lie_2,a001scene1); set(autorotate.enabled,true); set(plugin[a001info_text].visible, false);" />
    <plugin name="a001info_text" parent="a001plan" zorder="5" onloaded="a001follow_the_mouse(get(name));" url="plugins/textfield.swf" html="" css="p{color:#FFFFFF; font-family:Arial; font-size:14; margin-left:5; margin-right:5; text-align:center; }" keep="true" visible="false" width="250" height="20" backgroundcolor="0x000000" roundedge="6" shadow="1" borderwidth="0" glow="4" align="lefttop" x="0" y="0"/>
    <action name="a001follow_the_mouse">  add(plugin[%1].x, mouse.x, 0);  add(plugin[%1].y, mouse.y, 0);  delayedcall(0.01, a001follow_the_mouse(%1));</action>


    I hope it's not a stupide question... *confused*


    Thanks

    Edited once, last by mic22 (June 22, 2011 at 11:31 AM).

  • Sorry for code, it's easy too like this


    It's working <plugin name="a001plan" align="topleft"

    Code
    <plugin name="a001plan"             zorder="2"             url="plan.png"               alpha="0"              keep="true"              align="topleft"              x="10" y="10"               enabled="false"              height="prop"               edge=""               children="true"              />	
      <plugin name="a001scene1"               url="mappoint.png"               keep="true"                parent="a001plan"                align="center"                edge="center"                width="20"                height="20"                x="3%"  y="-19%"                zorder="2"                onhover="set(plugin[a001info_text].html, data:10011); set(autorotate.enabled,false); set(plugin[a001info_text].visible, true);"                onout="action(a001lie_2,a001scene1); set(autorotate.enabled,true); set(plugin[a001info_text].visible, false);"                />
    <plugin name="a001info_text"             parent="a001plan"             zorder="5"             onloaded="a001follow_the_mouse(get(name));"             url="plugins/textfield.swf"             html=""             css="p{color:#FFFFFF; font-family:Arial; font-size:14; margin-left:5; margin-right:5; text-align:center; }"             keep="true"             visible="false"             width="250"             height="20"             backgroundcolor="0x000000"             roundedge="6"             shadow="1"             borderwidth="0"             glow="4"             align="lefttop"             x="0" y="0"/>
    <action name="a001follow_the_mouse">      add(plugin[%1].x, mouse.x, 0);      add(plugin[%1].y, mouse.y, 0);      delayedcall(0.01, a001follow_the_mouse(%1));  </action>

    It's not working <plugin name="a001plan" align="topright"
    if some one know why ? Thanks a lot

    Code
    <plugin name="a001plan"             zorder="2"             url="plan.png"               alpha="0"              keep="true"              align="topright"              x="10" y="10"               enabled="false"              height="prop"               edge=""               children="true"              />	
      <plugin name="a001scene1"               url="mappoint.png"               keep="true"                parent="a001plan"                align="center"                edge="center"                width="20"                height="20"                x="3%"  y="-19%"                zorder="2"                onhover="set(plugin[a001info_text].html, data:10011); set(autorotate.enabled,false); set(plugin[a001info_text].visible, true);"                onout="action(a001lie_2,a001scene1); set(autorotate.enabled,true); set(plugin[a001info_text].visible, false);"                />
    <plugin name="a001info_text"             parent="a001plan"             zorder="5"             onloaded="a001follow_the_mouse(get(name));"             url="plugins/textfield.swf"             html=""             css="p{color:#FFFFFF; font-family:Arial; font-size:14; margin-left:5; margin-right:5; text-align:center; }"             keep="true"             visible="false"             width="250"             height="20"             backgroundcolor="0x000000"             roundedge="6"             shadow="1"             borderwidth="0"             glow="4"             align="lefttop"             x="0" y="0"/>
    <action name="a001follow_the_mouse">      add(plugin[%1].x, mouse.x, 0);      add(plugin[%1].y, mouse.y, 0);      delayedcall(0.01, a001follow_the_mouse(%1));  </action>
  • kinda fascinating ..
    Well if you play with basic plugins you can see then something is aligned right or bottom, positive values move up and left, opposite directions in otherwords.
    So perhaps it just doesn't seem like its working to you.
    So you MUST set the align to topleft, if you want it to follow the mouse naturally, and when you are done with moving whatever ...
    1. stop having it following the mouse.
    2. change the origin ; plugin[%].changeorigin(get(originalalign),get(originaledge));

    and...
    this seems smarter than adding 0 for no reason.. though adding could be a good way to make a good offset.

    set(plugin[%1].x, get(mouse.x));
    set(plugin[%1].y, get(mouse.y));

Participate now!

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