Flex: Capturing long-touch events on Android & iOS mobile devices
In building the mobile dating app Xuland, one of its key features will be the ability to add many profile photos. Your admirers can tap each photo from a list, see the larger version and vote on whether they like it or not.
The thing is, because buttons are typically over-sized on mobile devices to make them fat-finger friendly, it leave little room on the screen for many of them. You could utilize the off-screen menu option on Android but iOS devices lack this seemingly basic feature. Instead you could design your app to have contextual popup menus appear when holding or pressing down on an icon, button or other object on the screen.
Unfortunately, the current version of Flex (4.5) doesn’t support a long-touch or long-click event from what I can see, but it was easy enough to simulate one using a timer:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | private var timer:Timer; private var confirmPopup:ConfirmPopup; private function onTouchBegin():void { timer=new Timer( 1000 ); timer.addEventListener( TimerEvent.TIMER, onTimerComplete ); timer.start(); } private function onTimerComplete( event:TimerEvent ):void { timer.stop(); confirmPopup=ConfirmPopup.open( "delete photo?" ); confirmPopup.addEventListener( ConfirmPopup.CONFIRMED, onDeletePhotoConfirmed ); } private function onDeletePhotoConfirmed( event:Event ):void { confirmPopup.close(); //put additional photo deletion logic here } public function onTouchEnd():void { timer.removeEventListener( TimerEvent.TIMER, onTimerComplete ); timer.stop(); } |
And the MXML…
1 2 3 4 5 6 | <s:Image id="image" source="{ xyzSource }" touchBegin="onTouchBegin()" touchEnd="onTouchEnd()" mouseDown="onTouchBegin()" mouseUp="onTouchEnd()" /> |
Essentially what happens here is that once the user touches a photo, the timer activates and starts ticking. If the user at any time during the timeout period takes his finger off the photo, the timer is stopped, otherwise when the timer reaches is preset delay, it opens a confirmation popup prompting the user to take some action.
Here’s the results:
This spring I’ve started a project called Gestouch that simplifies gestures recongnition — the long press is of course one of them.
Project sources and wiki on github https://github.com/fljot/Gestouch
Quick introduction video http://www.youtube.com/watch?v=NjkmB8rfQjY
Hiya! Quick question that’s completely off topic. Do you know how to make your site mobile friendly?
My web site looks weird when browsing from my apple iphone.
I’m trying to find a theme or plugin that might be able to correct this issue.
If you have any recommendations, please share. Appreciate it!
I almost never comment, but i did a few searching and wound
up here Flex: Capturing long-touch events on Android & iOS mobile devices | eonflex.com.
And I actually do have a few questions for you if you tend not to mind.
Is it only me or does it look like a few of the remarks come
across like written by brain dead individuals?
And, if you are posting at other online sites,
I’d like to follow everything fresh you have to post. Could you make a list of all of all your social sites like your linkedin
profile, Facebook page or twitter feed?
For the reason that the admin of this website is working, no hesitation very quickly it will be renowned, due to
its quality contents.
Thanks for your personal marvelous posting! I seriously enjoyed reading it, you might
be a great author.I will ensure that I bookmark your blog and will often come back later on. I want to encourage you continue your great
writing, have a nice evening!
While there are currently many commercial real estate property options inside the Philippines, many major corporations often thought
we would locate their businesses inside biggest business districts within the country.
Its well-linked infrastructure along with a robust economy made corporate houses setup businesses here.
All eyes are stored on the White House to find out if Obama’s job plan will receive Republican approval to stimulate
the position market; however, many Democrats strongly think
that Obama’s job plan will not provide nearly enough funding to perform need to aid with true economic recovery.
There were 8 levels of totally body exercises combined with 8 levels of ab training programs that only took 45 minutes
per session and I you are only supposed to do these workouts three days a week.
Hey, when I want to talk like that, I head to the lab.
This isometric exercise is perfect for stabilizing your core.
Hello,
You probably don’t remember me… Mainly because we’ve never met.
I want to apologise for sending you this cold email. I know…I shouldn’t have done it.
But I decided to take a chance, put my big boy pants on and email you anyway because there’s something I had to share.
My name is Robert and I run the WhatSupp Workout website . I’m writing to you because I’d love to contribute a guest post to your site, eonflex.com.
I’ve been brainstorming some topics that I think your readers would get a ton of value from:
– Get fit at home with the top 5 bodyweight exercises
– How to eat for health and get lean at the same time
– Forget the gym, here’s how to gain muscle outdoors
I very much look forward to your response…cursing is expected and welcomed
Cheers,
Robert Hudson
WhatSupp workout
whatsuppworkout.com
SEgOCbKFXilYP
I’m not that much of a internet reader to be honest
but your blogs really nice, keep it up! I’ll go
ahead and bookmark your site to come back in the future. Many thanks
My brother suggested I may like this blog. He was entirely right. This submit truly made my day. You can not consider simply how a lot time I had spent for this information! Thanks!
Pleasze let mee know iif you’re looking ffor a writer
forr youur weblog. You havve some really greeat articles annd I believe I ould be a good asset.
If you everr waant tto takee somje off thee loa off, I’d
loive too wite soime contenht for your blog in exchange for a link baqck to mine.
Please shoot mee an eail iff interested. Kudos!
Thanks again for a great post. Your blog is a favorite of mine for reliable information and interesting topics.
You really maie itt seem sso eawsy togethher with your presentation but
I in fiding thiss topic too bbe actually something which
I think I’d by nno means understand. It eems too commplex and exxtremely broaad forr me.
I amm looking foorward forr your next submit, I willl attempt too get the ccling of it!
Fabulous, what a website it is! This blog gives useful
data to us, keep it up.
g2xor8
I was suggested this web site by my cousin. I’m not sure whether
this post is written by him as no one else know such detailed about
my trouble. You’re amazing! Thanks!
If you are going for most excellent contents like I do, simply visit this site daily since it provides
feature contents, thanks
When some one searches for his necessary thing, therefore he/she desires to be available that in detail, so that thing is maintained over here.
You should be a part of a contest for one of the best blogs on the
internet. I will highly recommend this site!
What’s up Dear, are you in fact visiting this web page on a regular basis, if so then you will definitely obtain pleasant
knowledge.
Someone essentially assist to make significantly posts I’d state. That is the very first time I frequented your web page and so far? I amazed with the analysis you made to create this actual submit extraordinary. Great process!
You can certainly see your skills within the article you write.
The arena hopes for more passionate writers like you who are not afraid to mention how they
believe. All the time follow your heart.
Yesterday, while I was at work, my sister stole my
iphone and tested to see if it can survive a thirty foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
I know this is completely off topic but I had to share it with
someone!
My brother recommended I might like this website. He was totally right.
This post actually made my day. You can not imagine simply how much time I had spent for this info!
Thanks!
Greetings from Idaho! I’m bored to tears at work so I decided to check out
your site on my iphone during lunch break. I love the knowledge you provide here and can’t wait to
take a look when I get home. I’m surprised at how
quick your blog loaded on my cell phone .. I’m not even using WIFI,
just 3G .. Anyhow, great site!
Do you mind if I quote a few of your articles as long as I provide credit
and sources back to your webpage? My website is in the very same niche as yours and my visitors would certainly benefit from some
of the information you provide here. Please let me know if this okay with you.
Thanks!
If you desire to obtain a great deal from this piece
of writing then you have to apply these techniques to
your won webpage.
I used to be recommended this blog via my cousin. I’m no longer certain whether this submit is written by way of him as no one
else know such targeted about my problem. You’re amazing!
Thank you!
If some one wants expert view about blogging and site-building then i recommend
him/her to visit this blog, Keep up the nice work.
Hi there! I know this is somewhat off topic but I was wondering if you knew where I could get a captcha
plugin for my comment form? I’m using the same blog platform as
yours and I’m having problems finding one? Thanks a lot!
Howdy! Do you know if they make any plugins to safeguard against hackers?
I’m kinda paranoid about losing everything I’ve worked hard on. Any suggestions?
The other day, while I was at work, my cousin stole my apple ipad and
tested to see if it can survive a twenty five foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views.
I know this is completely off topic but I had to share it with someone!
I’m not sure where you are getting your information, but good topic.
I needs to spend a while learning more or understanding
more. Thanks for great info I was looking for this info for my mission.
Hmm it seems like your blog ate my first comment (it was super long)
so I guess I’ll just sum it up what I had written and say,
I’m thoroughly enjoying your blog. I too am an aspiring blog writer but I’m still new to the
whole thing. Do you have any tips for first-time blog writers?
I’d definitely appreciate it.
Hurrah! Finally I got a blog from where I can actually take helpful information concerning my study and knowledge.
If some one wants to be updated with most up-to-date technologies afterward
he must be pay a quick visit this site and be up to date every day.
I’m not sure where you are getting your information, but great topic.
I needs to spend some time learning more or understanding
more. Thanks for wonderful information I was looking for this info for my mission.
This is really interesting, You’re a very skilled blogger.
I have joined your rss feed and look forward to seeking more of your fantastic
post. Also, I’ve shared your web site in my social networks!
My brother recommended I might like this website.
He was entirely right. This post actually made my day.
You cann’t imagine simply how much time I had spent for this info!
Thanks!
It’s awesome to visit this site and reading the views
of all mates concerning this paragraph, while I am also keen of getting knowledge.