Announcement

Collapse
No announcement yet.

Right Click in Scaleform?

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

  • replied
    You certainly are right srv. Furthermore a listener is a good resources eater (works as an "enterFrame"...) but it drive me crazy to not have this simple thing working.
    And this reveals a problem in my code : I copy paste the sidstyler's chubk in a new project and it works in GFxmediaPlayer but the very same code doesn't with my FLA file...

    Leave a comment:


  • replied
    I will not understand, what for to you listeners if function is called from u-script directly?

    Leave a comment:


  • replied
    Just copy/paste following code into a new as 2.0 project or into your own and it should work, I even tested it on a new project myself. And if you want to do stuff on mouseUp then just add that to the mouseListener to and let the function parameters be the same.

    Code:
    import flash.external.ExternalInterface;
    _global.gfxExtensions = true;
    
    
    var mouseListener:Object = new Object; 
    
    mouseListener.onMouseDown = function(button, target) 
    {
            // button 1 equals left click
    	if ( button == 1  )
    	{
    		trace( "mb1" ); 
             }
    
            // and then of course button two is right click
            else if ( button == 2  )
    	{
                    trace( "mb2" ); 
            }
    }
    
    Mouse.addListener(mouseListener);
    
    stop();

    EDIT: I checked your code and it looked correct, the only problem was that the variable buttonID that you sent to the function had the wrong name. It must be called "button" and not "buttonID".

    Leave a comment:


  • replied
    And I detect the mousePress in UC, then calls my mousePress function in AS with the parameter buttonID given by UC !
    Ok, I see how I can do this but the sidstyler's code IS in an AS listener and seems to work with Tanoran...

    Leave a comment:


  • replied
    your function must be like this:
    Code:
    function onMouseDown(buttonID):Void {};
    and it's not a listener, function calls from u-script manually
    also, too most and for 'onMouseUp' function - you need call mouseDown and mouseUp functions from u-script and set mouse button id for those functions and you'll get the id in action script

    Leave a comment:


  • replied
    My AS successfully calls UC script and UC can call some AS function in my project. Everything works perfectly.
    I just can't retrieve the ID of my button when I press the mouse... It may be a pure AS problem.

    I'll recheck my AS code immediately.

    Edit : I simplified my AS code and here it is :

    Code:
    _global.gfxExtension = true;
    import flash.external.ExternalInterface;
    
    var mouseListener:Object = new Object(); 
    
    mouseListener.onMouseMove = function () {
        mouseClip._x = _root._xmouse;
        mouseClip._y = _root._ymouse;
        _root.consoleTXT.text = "mouseMove";
    }
    mouseListener.onMouseDown = function (buttonID){
        _root.consoleTXT.text = "mouseDown : " + buttonID;
    }
    
    mouseListener.onMouseUp = function(){
           _root.consoleTXT.text = "mouseUp";
    }
    Mouse.addListener(mouseListener);
    _root.consoleTXT is just a dynamic text field I use to have some return of my AS (or UC with AScalls ^^). Alas, when I press the left button, buttonID is undefined and if I press the the RMB, nothing happens. But, I can read mouseMove, mouseDown : undefined or mouseUp in the other cases.
    I tested it directly in swf, with FxmediaPlayer and in my UDK level. Everything's perfect (I know, perfection is not of our world but it works ^^) but this.

    Leave a comment:


  • replied
    Originally posted by Bozor View Post
    Sorry to bother you but with the sidstyler's code, button always return undefined... In the Flash doc, "onMouseDown" take no parameters.
    So I think I need to import some GFx extension but I don't know wich one ^^
    I allready have :
    Code:
    _global.gfxExtension = true;
    import flash.external.ExternalInterface;
    What have I missed ?

    Edit : In fact, press the left button returns undefined, pressing the right click don't trigger the mouseListener at all...
    As long as you have all your paths set up and have the _gfxExtension set to true ( like you said you have ) then it should work.

    Have you gotten anything else to work using scaleform? Maybe you haven't included the paths correctly.

    Leave a comment:


  • replied
    As an aside, the doc for how to call AS from US and US from AS is ..

    http://udn.epicgames.com/Three/Scale...icalGuide.html

    Leave a comment:


  • replied
    You can send any parameter. But in this case, as button in AS accepts pressed mouse button ID, it is necessary to send 1 or 2 (can be 3 for a mouse wheel, but I didn't try)

    edit: has checked up it, the mouse wheel is defined as the button 3 (1/2 is for left/right mouse button)

    Leave a comment:


  • replied
    (I have never used this but)

    I would guess it is 0 for left and 1 for right??

    Leave a comment:


  • replied
    Sorry to bother you but with the sidstyler's code, button always return undefined... In the Flash doc, "onMouseDown" take no parameters.
    Right click is possible with the use of scaleform extensions.
    So I think I need to import some GFx extension but I don't know wich one ^^
    I allready have :
    Code:
    _global.gfxExtension = true;
    import flash.external.ExternalInterface;
    What have I missed ?

    Edit : In fact, press the left button returns undefined, pressing the right click don't trigger the mouseListener at all...

    Leave a comment:


  • replied
    I just tried your code and it worked perfectly! The only modification is that I added a stop(); command at the end to prevent it from triggering in a loop. Thanks a ton!

    Leave a comment:


  • replied
    I'll give it a try when I have time. I'm swamped with work for other classes at the moment, so I won't be able to test it out for at least few days. Please don't forget about me in the meantime!

    Leave a comment:


  • replied
    Right click is possible with the use of scaleform extensions.

    Actsionscript code:

    Code:
    var mouseListener:Object = new Object; 
    
    mouseListener.onMouseDown = function(button, target) 
    {
            // button 1 equals left click
    	if ( button == 1  )
    	{
                   // do awesom stuff here
            }
    
            // and then of course button two is right click
            else if ( button == 2  )
    	{
                   // do even moar awesom stuff here!!!!!
            }
    }
    
    Mouse.addListener(mouseListener);

    But if you want to to it the other way that you discussed ( calling actionscript function from unreal) you can do that also, you can check the scaleform part in the documentation area for how to do that, it's quite simple actually, but if you need help with that to then let me know.

    Leave a comment:


  • replied
    Alright, I found the functions in PlayerController, but I have no idea how to begin writing a function that calls to actionscript. Any suggestions or tutorials?

    Leave a comment:

Working...
X