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...
Announcement
Collapse
No announcement yet.
Right Click in Scaleform?
Collapse
X
-
srv repliedI will not understand, what for to you listeners if function is called from u-script directly?
Leave a comment:
-
sidstyler repliedJust 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:
-
Bozor repliedAnd 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:
-
srv repliedyour function must be like this:
Code:function onMouseDown(buttonID):Void {};
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:
-
Bozor repliedMy 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);
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:
-
sidstyler repliedOriginally posted by Bozor View PostSorry 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;
Edit : In fact, press the left button returns undefined, pressing the right click don't trigger the mouseListener at all...
Have you gotten anything else to work using scaleform? Maybe you haven't included the paths correctly.
Leave a comment:
-
Blade[UG] repliedAs 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:
-
srv repliedYou 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:
-
paulv2k4 replied(I have never used this but)
I would guess it is 0 for left and 1 for right??
Leave a comment:
-
Bozor repliedSorry 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.
I allready have :
Code:_global.gfxExtension = true; import flash.external.ExternalInterface;
Edit : In fact, press the left button returns undefined, pressing the right click don't trigger the mouseListener at all...
Leave a comment:
-
Tanoran repliedI 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:
-
Tanoran repliedI'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:
-
sidstyler repliedRight 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:
-
Tanoran repliedAlright, 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:
Leave a comment: