Creating an application that requires BOTH gesture(swipe) support as well as simple touch events. I understand that one limiation of the built-in touch support in actionscript is that you must choose either Gesture OR Touch events as input.
So I was wondering if you can easily simulate gesture events using the TouchEvent.TOUCH_BEGIN +TouchEvent.TOUCH_END events? Are they essentially the same thing as using Gesture events?
I believe you'll be able to simulate the gestures appropriately by using the touch events. Each time a finger goes down a temporary id is assigned to it so you can easily tell if this is the first or second finger down. In terms of them being the same, it's not exactly the same since the GestureEvents seem to be all dependent on the mobile OS to report as gestures instead of just as touches so any calculation for deltas (or whatever else) would be handled by the OS already instead of you doing it (with the overhead of the VM). http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffd.html
Try making gestureevents with touchevents. There are lots of properties that can easily be converted / combined.
Related
As you may know in "real" games you need to check if a key is pressed at this time. Right now I'm using events and I remember if last event was a key-up or key-down to know if a button is held down.
BUT I'm experiencing some lags (not network) in the game when several buttons are held down. New key pushes are recognized a little bit too late. From DirectInput in DirectX and from LWJGL I know how nice and smooth input for games can work.
a) So I ask: Is there a way to check keys directly in ActionScript 3 ? I don't think any other extra package would be useful since it would just do what I do right now.
b) If no. Why wouldn't Adobe add direct input feature to Flash since it is used for games to a high percentage ?!?
I am using the Map control in Windows Phone 8.
I need to implement a page where user can select his location using the map control.
I am trying to know when the app was first manipulated by the user.
Some background info:
I saw that when the control is shown, it automatically centers the world map, and CenterChanged event is raised.
I am not able to understand how ManipulationStarted, ManipulationDelta and ManipulationCompleted work.
the first time I drag, ManipulationStarted is not called, only ManipulationCompleted.
I could consider the first manipulation by user as being the 2nd time the CenterChanged is fired.
But this is a hack or a guess, I am not happy not having a good understanding how it works.
The Map control intercepts and handles Manipulation events and as such you don't get all of them. Remember, once routed events are marked at e.Handled=true they no longer bubble up.
Depending on your Scenario WP8 exposes the UseOptimizedManipulationRouting property which might prove useful. Setting UseOptimizedManipulationRouting=false causes Map, Pivot and other controls to not swallow events for nested controls.
If that doesn't help, have a look at the following Nokia Wiki article where the author ran into the same problem as you did and used Touch.FrameReported to get out of it # http://www.developer.nokia.com/Community/Wiki/Real-time_rotation_of_the_Windows_Phone_8_Map_Control
I'm using a multi-touch screen for making an interactive presentation with Adobe AIR and four people is going to use the screen at once.
I've done some testing with MouseEvent (which works fine with one user) and I think that replacing that event with my own that can handle multiple users is the way to go, or did I miss something here?
Theres some work creating that event so i'd love some input, thanks.
You need to set the inputMode to use multi-touch, then you'll want to be listening for TouchEvents instead of MouseEvents (believe for a single point at least it will still dispatch the MouseEvent, not sure if this is true for multiple touches though).
http://help.adobe.com/en_US/flex/mobileapps/WSe11993ea1bd776e5-13e27e4812a431dbafc-8000.html
flash.ui.Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
If mouse events are used instead of touch events on touch enabled devices, does that limit "touch" input to one touch at a time?
If a mouse down event is currently in progress, will a following mouse down event simply not register or cancel the previous?
How are mouse events, historically used as single control pointers on desktop systems, handled on touch enabled devices capable of several simultaneous touch points?
Event classes have a clone() function typically used to fire multiple events, so I'm assuming MouseEvent is not limited. However, my goal is to actually limit my application to one touch at a time (exclusive touch), but I'm not sure if this will be automatically handled with the use of mouse events.
Mouse events are handled in the same manner on both single-touch and multi-touch devices. If you only want single-touch, use the MouseEvent events and if you want multi-touch use the TouchEvent events. You can use the Multitouch.supportsTouchEvents property to determine touch support.
I am making a Flash puzzle game. When the user loads the game, it needs to ask whether to resume the game from the last state (if it exists). I have a serialization system in place, but I need to ensure that the loaded state is definitely the last state.
One solution is to save the state to a SharedObject every time the state changes (when the player makes a move). However, the game state sometimes includes a countdown, so I'd have to be constantly (or periodically) saving the state in order to retain it. I guess this is acceptable, but it seems kludgey.
Is there any event which is fired when the swf is closed? Or anyone else have another elegant solution to this?
(I'm not using AIR, but solutions requiring AIR are appreciated.)
Edit: Another important point is that I may not have control over the embedding HTML for the game, as it may be syndicated to many sites. So solutions involving javascript aren't ideal.
If your Flash is hosted on a HTML page, you can use the 'Window is closing' event notification to fire a message into your Flash object either using old-skool GetVariable() or new-stylee FlashCall() mechanisms.
Whether you'll actually be able to persist state before your Flash object is destroyed is another question... you could always do the (evil) 'Are you sure you want to close/navigate away from this window?' alert that some sites use.
Handling DOM Events in Flex
HTML 5 events
The on-close event sounds the right solution, but I wonder if you could 'split' your serialisation? i.e. save the full puzzle state on each move, but also have a secondary 'lightweight' state for your countdown (or anything similar) which could be updated each time the countdown changes.
That may be easier than trying to catch the close event and save before the page is destroyed (especially as browsers are not consistent in this area).
this one should help you