No announcement yet.

Scaleform 4 and AS3 and mouse cursor code

  • Filter
  • Time
  • Show
Clear All
new posts

    Scaleform 4 and AS3 and mouse cursor code

    Originally posted by ZeJudge View Post
    So how would mouse cursor code be done in ActionScript 3.0 as you can't place ActionScript inside objects ?
    I saw this question on a previous thread and Matt D. asked for a new thread for this so here it goes

    I tried in my AS3 case to use

    stage.addEventListener(MouseEvent.MOUSE_MOVE,follo wCursor);
    function followCursor(event:MouseEvent):void {
    mcCursor.x = mouseX;
    mcCursor.y = mouseY;

    my naive explanation: what I don't like about the result is that it keeps refreshing and it messes with the Movie CLips under the cursor MC
    I have mouse cursor
    I have a button that changes the background image if the MOUSE is UP or OUT, and OVER
    When I put the mouse OVER the MC, the image appears, and then dissapears, randomly, with a behavior like it refreshes every cycle, and it just looks bad
    I didn't have this issue in AS2, and I don't know how to work around it

    Also, this is for Matt Doyle, related to GFxAction_SetTextField.uc. Can you please confirm this works as is for AS3? Or if something needs to be changed, what would that be? I tried it in my tests and for some reason it didn't work


    Try using something like this for AS3 - Do NOT put this inside the mouse cursor MC; put it on the _root timeline:

    import scaleform.gfx.Extensions;
    Extensions.enabled = true;
    var mCursor:MovieClip;
    mCursor.mouseEnabled = false;
    mCursor.tabEnabled = false;
    function handleMouseMove( e:MouseEvent ):void 
    	mCursor.x = e.stageX;
    	mCursor.y = e.stageY;
    stage.addEventListener( MouseEvent.MOUSE_MOVE, handleMouseMove, false, 0, true );


      yes! thank you! that worked!

      but how about GFxAction_SetTextField.uc in Nov 11 release?

      I get the same error in the log as mentioned here
      but also, this is the most important to me, as the SetText is pivotal in my dialog interface, it seems that the GFxAction_SetTextField.uc is never used in Nov 11 as I can't see any reference to it in the log. When I run my tests, I have a 'log command in GFxAction_SetTextField.uc that never shows in the log in Nov 11 version, even though it shows OK in previous releases



        I don't know if it (GFxAction_SetTextField.uc) works in the NOv 2011 release. That script is not an official Scaleform or Epic release. It was just something I wrote in my freetime. As that is the case, I'll look into it when I have available time, but can't promise anything.


          Thanks Matt! I guess one of the reasons this doesn't work yet is this. If/when you have time, please confirm it works with AS3 before the next UDK release. I'll also try the workaround you suggested in the sticky. Thanks again!


            I got the mouse to work, but whenever I click a button that goes to a new frame the custom mouse disappears. So I added a new instance of the mouse cursor with the same name (mCursor) on that frame, but now whenever I click the button the mouse always starts where I originally placed the graphic on the stage. In AS2 the flash cursor always followed the windows cursor no matter the frame. I'd like to get that same behavior in AS3. Anyone know how to do that?

            Edit: Solved. I just needed to put the cursor on its own layer.




                So and now how do you get the flash cursor not to lag behind the hardware cursor? I enabled the hardware cursor and this flash cursor graphics and it clearly lags behind which makes it very clumsy to use.