Announcement

Collapse
No announcement yet.

Scaleform and mouse cursor

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

    #31
    Originally posted by dpsygnet View Post
    tryed to replace my flash code with yours and it didn't works

    Do you have anything related to your mouse in your playercontroller, pawn, main classes ?

    I did a quick kismet to play my swf cursor just in case it was a stupid error of it being invisible and i can see it, but it's not moving..
    Are you still struggling? If so, do you still have this line in your HUD class?
    Code:
    HudMovie.SetViewScaleMode( SM_NoScale );
    I also had issues with my mouse cursor until I removed that line.

    Comment


      #32
      Hello everybody D:

      I got my utterly well-drawn cursor to show up in the play window, but I can't move it?I compiled with no errors, but no matter if I move the mouse like crazy, the cursor just stays there.

      Any idea why this is happening? D:

      Comment


        #33
        Had the same problem like nemirc, but then I figured that I should edit the Actions of my scene (unselect everything and press F9) instead of editing the actions of my movieclip.

        Comment


          #34
          So, I've been trying for about 4 days to get this to work. I've tried various ways and am currently stuck with the error:

          "Warning, ObjectProperty GFxUI.GFxMoviePlayer:MovieInfo unresolved reference to 'SwfMovie'MyIsometricGame.MyHud"

          as well as "Invalid property value in defauls: MovieInfo=SwfMovie'MyIsometricGame.MyHud'

          I made this account just to ask for help because I'm absolutely LOST!

          I was just going through the X9Productions tutorial for making an Isometric Game and (obviously) got to the mouse part, which is no longer valid.

          I made my cursor (as a .PNG), imported it in to Flash and use's Srv's actionscript and Instance Name (bottom of page 3) and the mouse functions in flash perfectly. I placed the .Fla and .Swf in UDKGame > Flash > MyIsometricGame (I also tried just adding it in the UDKHud folder) and even added the .PNG to a subfolder with the same name as the .Fla/.Swf.

          As for my HUD and GFxMoviePlayer script, I also tried using the code provided by Srv.

          Do I need to add anything else in other scripts? I have "HUDType=class'Iso_Hud'" in my GameInfo script, but do I need anything else added? (keep in mind, all the scripting before what Srv provided is what's on the X9 website.)

          Is there any chance someone could make a full tutorial that's functional with the latest UDK? That would be amazing and probably get rid of my massive headache, lol.

          Thanks in advance.

          Comment


            #35
            Originally posted by Kitese View Post
            This is how my Scaleform mouse works.

            In Flash:

            1. A new movieclip symbol with imported bitmaps as the cursor images.
            2. An instance of this movieclip on the main stage in it's own layer.
            3. Following AS in the first frame of the mouse layer:

            Code:
            import flash.external.ExternalInterface;
            
            // Hide normal "Windows" pointer.
            Mouse.hide();
            
            var mouseListener:Object = new Object();
            
            mouseListener.onMouseMove = function ()
            {
                    // Set the cursor instance position to the mouse position.
            	MouseCursorInstance._x = _root._xmouse;
            	MouseCursorInstance._y = _root._ymouse;
            	
                    // Tell our UnrealScript about the new mouse coords.
            	ExternalInterface.call( "ReceiveMouseCoords", _root._xmouse, _root._ymouse );
            	
            	updateAfterEvent();
            };
            
            Mouse.addListener(mouseListener);
            In Unrealscript:

            A GFxMoviePlayer class for the HUD movie:

            Code:
            class Tds_GFxHud extends GFxMoviePlayer;
            
            var int MouseX;
            var int MouseY;
            
            function Init( PlayerController PC )
            {
            	Start();
            	Advance(0.0f);
             
            	SetFocus( false, true );
            }
            
            // This is called from Flash.
            function ReceiveMouseCoords( float x, float y )
            {
            	MouseX = x;
            	MouseY = y;
            }
            
            DefaultProperties
            {
            	bDisplayWithHudOff = false
            	bGammaCorrection = false
            	
                    // Path to your package/flash file here.
            	MovieInfo = SwfMovie'TrGfx.TrHudMain'
            }
            The HUD class the uses the movie:

            Code:
            class Tds_Hud extends UDKHUD;
            
            var Tds_GFxHud           HudMovie;
            var class<Tds_GFxHud> HudMovieClass;
            
            simulated function PostBeginPlay()
            {
            	super.PostBeginPlay();
            
            	HudMovie = new HudMovieClass;
            
            	HudMovie.PlayerOwner = Tds_PlayerController(PlayerOwner);
            	HudMovie.SetTimingMode( TM_Real );
            	HudMovie.SetViewScaleMode( SM_NoScale );
            	HudMovie.SetAlignment( Align_BottomCenter );
            
            	HudMovie.Init( HudMovie.PlayerOwner );
            
                    // When using scaleform these seem to be set to 0?
            	SizeX = 1280.0f;
            	SizeY = 720.0f;
            }
            
            singular event Destroyed()
            {
            	if( HudMovie != none )
            	{
            		HudMovie.Close( true );
            		HudMovie = none;
            	}
            
            	super.Destroy();
            }
            
            function Vector2d GetMouseCoords()
            {
            	local Vector2d mousePos;
            
            	mousePos.X = HudMovie.MouseX;
            	mousePos.Y = HudMovie.MouseY;
            
            	return mousePos;
            }
            
            event PostRender()
            {
            	local Vector2D playerMouse;
            	local Tds_PlayerController tdsPlayer;
            
            	tdsPlayer= Tds_PlayerController(PlayerOwner);
            	playerMouse = GetMouseCoords();
            
            	Canvas.SetDrawColor( 255, 255, 255, 255 );
            
            	Canvas.SetPos( 10.0, 10.0 );
            	Canvas.DrawText( "Mouse: X:" $ playerMouse.X $ ", Y:" $ playerMouse.Y );
            
                     // ** Can do the deproject etc. as shown in tutorials here on the values from GetMouseCoords().
            }
            
            DefaultProperties
            {
            	HudMovieClass = class'Tds_GFxHud'
            }
            A screenshot of the result.
            in which file i want to place all this code, guide me i am new but not much new and I also want this in my game to make cursor so please if some one clear me would be greatly appreciated.

            Comment


              #36
              @yaziii -

              From what I can tell...

              The first code block should go in a FLA/SWF file called: TrHudMain.SWF and this file should be saved in the package: TrGfx

              The second code block should go in an UnrealScript class called: Tds_GFxHud.uc

              The third code block should go in an UnrealScript class called: Tds_Hud.uc

              Comment


                #37
                @Syndrome9001 -

                It is hard to say for sure what is wrong, without more details, particularly I'd need to see your code. But, it looks like your code is referencing a SWF file that does not exist in the package you say it does.

                Comment


                  #38
                  Originally posted by Matt Doyle View Post
                  @yaziii -

                  From what I can tell...

                  The first code block should go in a FLA/SWF file called: TrHudMain.SWF and this file should be saved in the package: TrGfx

                  The second code block should go in an UnrealScript class called: Tds_GFxHud.uc

                  The third code block should go in an UnrealScript class called: Tds_Hud.uc
                  let us suppose i made SWF file nd save it name TrHudMain.SWF but where is TrGfx package??? i think i want to create new file in UDK and name it TrGfx am i right??? And where is this Tds_GfxHud.uc and Tds_Hud.uc??? and one more think please visit this link also please because you are expert in scaleform HUD etc etc link is here:

                  http://forums.epicgames.com/showthread.php?t=758521

                  Comment


                    #39
                    You need to read this to learn how to import a new package & SWF into UDK:

                    http://udn.epicgames.com/Three/Scale...s%20into%20UE3

                    Essentially - save your SWF file in a folder called TrGfx in the Flash directory of your UDK game directory. The Flash directory already exists. So create the folder TrGfx in there, then save your SWF inside that.

                    Then, inside UDK Editor, press Import button in Content Browser and import the SWF file.

                    \UDKGame\Flash\TrGfx

                    The UnrealScript files should be saved in this folder inside your UDK install:

                    \Development\Src\UTGame\Classes

                    Comment


                      #40
                      what should I name the movieclip of mouse and also instance name???

                      Comment


                        #41
                        Originally posted by Matt Doyle View Post
                        You need to read this to learn how to import a new package & SWF into UDK:

                        http://udn.epicgames.com/Three/Scale...s%20into%20UE3

                        Essentially - save your SWF file in a folder called TrGfx in the Flash directory of your UDK game directory. The Flash directory already exists. So create the folder TrGfx in there, then save your SWF inside that.

                        Then, inside UDK Editor, press Import button in Content Browser and import the SWF file.

                        \UDKGame\Flash\TrGfx

                        The UnrealScript files should be saved in this folder inside your UDK install:

                        \Development\Src\UTGame\Classes
                        for this can you make tutorial for me please???

                        Comment


                          #42
                          Originally posted by collix View Post
                          Had the same problem like nemirc, but then I figured that I should edit the Actions of my scene (unselect everything and press F9) instead of editing the actions of my movieclip.
                          I did exactly that, but the mouse does not move. Unless it doesn't work in PIE but in PoPC only?

                          Comment


                            #43
                            Well, it works all the time for me, maybe you need to set the Gametype for PIE to your game in Worldproperties of your level?

                            Comment


                              #44
                              I cant seem to make this thing work either. Currently my code looks like this. When i run my game i cant see the cursor from flash, also the coordinates from Canvas.DrawText doesnt update either and is stuck on 0.0000, 0.0000.

                              Code:
                              class TDSGFx_Crosshair extends GFxMoviePlayer;
                              
                              var int MouseX;
                              var int MouseY;
                              
                              function Initialize()
                              {
                              	Start();
                              	Advance(0.0f);
                              }
                              
                              function RecieveMouseCoordinates(float x, float y)
                              {
                              	MouseX = x;
                              	MouseY = y;
                              }
                              
                              
                              DefaultProperties
                              {
                              	bDisplayWithHudOff = false;
                              	bEnableGammaCorrection = false;
                              
                              	MovieInfo = SwfMovie'TopDownShooter.TDSHud';
                              }
                              Code:
                              class TDSHud extends UDKHUD;
                              
                              var TDSGFx_Crosshair CrosshairMovie;
                              
                              simulated function PostBeginPlay()
                              {
                              	super.PostBeginPlay();
                              	
                              	if(CrosshairMovie == none)
                              	{
                              		CrosshairMovie = new class'TDSGFx_Crosshair';
                              		CrosshairMovie.Initialize();
                              	}
                              	SizeX = 1024;
                              	SizeY = 720;
                              }
                              singular event Destroyed()
                              {
                              	if(CrosshairMovie != none)
                              	{
                              		CrosshairMovie.Close(true);
                              		CrosshairMovie = none;
                              	}
                              	Destroy();
                              }
                              function Vector2d GetMouseCoords()
                              {
                              	local Vector2D MouseCoords;
                              
                              	MouseCoords.X = CrosshairMovie.MouseX;
                              	MouseCoords.Y = CrosshairMovie.MouseY;
                              
                              	return MouseCoords;
                              }
                              event PostRender()
                              {
                              	local Vector2D PlayerMouse;
                              	local TDSPlayerController TDSPlayer;
                              	
                              	PlayerMouse = GetMouseCoords();
                              
                              	Canvas.SetDrawColor(255,255,255,255);
                              	
                              	Canvas.SetPos(10.0,10.0);
                              	Canvas.DrawText("Mouse: X:" $ playerMouse.X $ ", Y:" $ playerMouse.Y);
                              }
                              
                              DefaultProperties
                              {
                              }
                              I got 2 layers in my .fla file, one "actions" and one "scene" and the AS code is posted in the first frame of "actions".

                              any suggestions?

                              Edit: Ive also tried to change the actionscript to what "srv" suggested but when i do the "startDrag("Crosshair", true);" i get the message "Error: StartDrag of invalid target 'Crosshair'".
                              i tried to convert the object i had placed on the scene to a "symbol" movieclip and give it the name "Crosshair" but that didnt change anything.

                              Comment


                                #45
                                Figured it out. I didnt import my .swf right so the script didnt access it. works now.

                                Comment

                                Working...
                                X