Announcement

Collapse
No announcement yet.

Creating a Mouse Cursor in the HUD

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #61
    The class from f00n.com is gone. Does anybody have it? I'm having a heck of a time getting my cursor to show up above the dropdown menus.

    Comment


      #62
      Jump on IRC tonight #UDKC on irc.enterthegame.com ill help you out.

      Comment


        #63
        Hey what about the rest of us! J/K, seriously though I assume this is a popup manager issue. Is there a fairly simple fix?

        Comment


          #64
          Just wanted to say sorry for my website being down when people have been trying to access the flash cursor class. One of the drawbacks of being a bedroom coder is lack of money and my hosting costs me more than I can afford some months.

          I will endeavour to keep the site up as much as possible and again my apologies.

          Comment


            #65
            I got the mouse to toggle with the shift key. Now I also want to manipulate the menu that I created in the same Flash file. You can see the menu here. Can you please tell me how to make the mouse interact with the menu? Are there any tutorials that can help me do just that? DO I need to learn CLIK?

            Comment


              #66
              Hi guys,

              i follow this tutorial, and i can see the mouse cursor but, cursors position is not update....:S

              any idea???

              my udk version is "UDK-2013-07"

              thanks in advanced.....

              Comment


                #67
                **** I never got to respond to this. Hope you got it by now. If not here's the answer in case you didn't.

                I believe you're missing the "onClipEvent" for the mouse pointer. Drop the pointer on the stage at 0,0. Basically it moves the mouse to the current system mouse position on every frame.

                Select it and put this in the AS code window:

                Code:
                onClipEvent(mouseMove)
                {
                	_x = _root._xmouse;
                	_y = _root._ymouse;
                }

                Comment


                  #68
                  This tutorial seems completely broken even at the time when it was written. How the hell is "MouseCursor = MouseContainer.GetObject("my_cursor");" supposed to works since following the tutorial we never assign "my_cursor" anywhere, nor in Unreal Script or Flash ?

                  Does anyone has a working tutorial for mouse cursor in hud please ? I tried to put Skalamondre's AS code in MouseContainer but it haven't changed anything ! Mouse cursor won't move and the code to find the SWF size is broken too ! Everything is broken !

                  Comment


                    #69
                    I can't really confirm whether or not the tutorial works but I can tell you that in script I don't really worry too much about where the mouse is at any given moments. I'm only worried about the mouse click call back events that happen when a button is pressed. So what I'm saying is that the onClipEvent(mouseMove) I mentioned earlier just makes sure that flash keeps the mouse icon updated so that it shows where it should as the player moves it.

                    When you use .GetObject it actually will get the object in the movie by name. So if you have an object on the _root of the movie (not just in the library but on the stage) you name it and can then access it like this:

                    (In this example I have an object on the _root of a movie called "MovieObject" and it has a child object called "MovieObjectChild." I use GetVariableObject instead of GetObject.)

                    Code:
                    //Sets up a var to reference the objects with from script
                    var GfxObject MyObject;
                    var GfxObject MyObjectChild;
                    
                    MyObject = getVariableObject("_root.MovieObject"); // Literally assigning the object in the movie to the var we setup.
                    MyObjectChild = MyObject.getVariableObject("MovieObjectChild"); //Since we now assigned MyObjectChild we can use getObject on it directly to reference another object.
                    
                    //We could also have done:
                    MyObjectChild = MyObject.getVariableObject("_root.MovieObject.MovieObjectChild");
                    By the way - the objects don't have to be CLIK objects in flash or anything special for this to work. In fact if they were CLIK objects you wouldn't need to do this because those objects call back to an initialization routine. I use the method above for my HUD because those objects are lightweight objects. I use the CLIK objects for my menus and selection screens.


                    Here's a real working routine that I used in a complete project:

                    Code:
                    class GFxHud extends GFxMoviePlayer;
                    
                    var GFxObject     ScreenMessageMC
                    var GFxObject     ScreenMessageTF;
                    
                    ScreenMessageMC = GetVariableObject("_root.screenMessageMC");
                    ScreenMessageTF = GetVariableObject("_root.screenMessageMC.centerText.textField");
                    
                    function SetMessageText(string message)
                    {
                    	ScreenMessageMC.SetText(message);
                    	ScreenMessageTF.GotoAndPlay("on");
                    }

                    Comment


                      #70
                      Originally posted by Hex0n View Post
                      This tutorial seems completely broken even at the time when it was written. How the hell is "MouseCursor = MouseContainer.GetObject("my_cursor");" supposed to works since following the tutorial we never assign "my_cursor" anywhere, nor in Unreal Script or Flash ?

                      Does anyone has a working tutorial for mouse cursor in hud please ? I tried to put Skalamondre's AS code in MouseContainer but it haven't changed anything ! Mouse cursor won't move and the code to find the SWF size is broken too ! Everything is broken !
                      Change the line to this:


                      Code:
                      MouseCursor = MouseContainer.GetObject("mouseCursor_mc");

                      Comment


                        #71
                        @Matt Doyle

                        I do believe this tutorial is broken in the 2013-07 UDK build. I've scoured the tutorial and triple checked all of the elements. No compile errors, and when I run the game, no errors in the Log. When I press Left Shift, the Mouse cursor appears in the top left corner of the screen and if I release Left Shift, it disappears (no log errors). However, the mouse cursor does not move at all. It would appear that in AS2, where I add the mouseListener, the code doesn't actually fire off any message when the onMouseMove event happens. I've included an ExternalInterface.call() from within that AS2 frame just to check if the code gets touched and it does in fact run and add the mouseListener, it's just that the onMouseMove does not ever get triggered. One interesting thing though is that when I use the Scaleform GFxPlayer Launcher from inside of Flash, that the UpdateMousePosition does receive a callback and appears to be working properly (showing updated mouse coordinates).

                        My Flash document is AS2.0 running Flash Player 11.2.

                        I've also tried a different method using onClipEvent (as suggested earlier in this thread), but that does not work either. I've had success using onClipEvent(mouseMove) in other flash files for my main menu, but for some reason when I extend Scaleform's default HUDWrapper class and try to do anything with the mouse, it doesn't seem to work.

                        Lastly, I also searched my source code for any instances of bIgnoreMouseInput, but I did not find any that were relevant (I found 1 other instance but I tried flipping the boolean on it and it made no difference).

                        Any help you could shine on this would be greatly appreciated.

                        Thanks,
                        Justin

                        UPDATE1:
                        I followed disReGard's instructions on how they implemented their mouse into the HUD and I was able to get it working, however, his method imports the mouse as a separate GFxMoviePlayer movie file. This creates it's own problems because of course I cannot click on buttons in 1 swf if the mouse is in the other swf. However, what is confusing to me is that if I copy/paste only a few changes so that the mouse is not loaded as a seperate GFxMovie, and I just place the mouse cursor directly into my HUD .swf file, it does not work. So basically I can get it working if I load the mouse as a new GFxMoviePlayer, however, if I just want the mouse to work directly inside my HUD it doesn't move. Really strange! PS - I've been a software developer for over 5 years now and before that I was a Ux developer so I am very familiar with Flash and have been working in UDK for about 6 months. I'm by far a novice still with UDK but why Flash won't provide a callback in 1 flash file, but it does from another is just mind boggling!

                        Link to the tutorial on how to load mouse from a different swf
                        http://forums.epicgames.com/threads/...1#post28319144

                        UPDATE2 SOLVED:
                        The reason why my Hud wrapper wasn't picking up the mouse input is because I was extending the GFxMinimapHud, and that by default has bAllowInput and bAllowFocus set to false. If you set those to true it works.

                        Comment

                        Working...
                        X