Trying to figure this out

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Trying to figure this out

Post by ctflatt » Fri Mar 04, 2011 7:41 pm

Hello, everyone!

I am working on a project that needs the following functionality:

As a user swipes left/right on a page (or an area of a page), a series of images are displayed in sequence. Swiping left sequences through the images in a forward direction (01.jpg, 02.jpg, 03.jpg,...), swiping right sequences through the images in a backward direction (..., 03.jpg, 02.jpg, 01.jpg).

Could someone point me in the direction I would take with the swipe gesture to achieve this?

I would REALLY appreciate it.

Thanks,

:Todd

sylvanr
Posts: 80
Joined: Wed Nov 24, 2010 10:38 am

Re: Trying to figure this out

Post by sylvanr » Fri Mar 04, 2011 8:45 pm

I'm fairly new to LiveCode, too, so I'm not sure if this is what you are looking for but it seems like it might be. In LiveCode, if you click "Help" in the menubar, and then select 'iOS Release Notes" and go to page 26, you will find some info. There will be the following note that will lead you to some sample stacks that downloaded with LiveCode, which I hadn't even noticed initially. The scroller sample does pretty much what I think you are describing. Hope this helps:

Example: You can find a simple stack using the native scroller control features in the IDE resources
folder (open using the Help > Example Stacks and Resources menu item). The stack can be found
at: Mobile Examples/Scroller Example.livecode

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Fri Mar 04, 2011 9:32 pm

Thanks, sylvanr, but UIScrollView isn't what I'm shooting for here.

I need a fixed size area to display the image, then, as the user swipes over that image, to display the remaining images in the sequence, in the same location.

Hope this helps with the description.

Thanks,

Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Trying to figure this out

Post by bn » Fri Mar 04, 2011 9:47 pm

Todd,

try this example stack in the simulator or a real device.

Kind regards

Bernd
Attachments
horzPicScroll.livecode.zip
(131.75 KiB) Downloaded 346 times

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Fri Mar 04, 2011 9:52 pm

Bernd:

Thanks for the sample, but I'm not looking for a scroller.

In your example, what I would like is for the picture area to remain stationary. As the user swipes, the photo changes in place... is this possible?

I appreciate you taking the time on the first example!

Let me know if you need more info, if this is a puzzle you'd like to help me solve :)

Thanks,

Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Trying to figure this out

Post by bn » Fri Mar 04, 2011 10:55 pm

Todd,

look at this example.

Kind regards

Bernd
Attachments
horzPicShow.livecode.zip
(131.81 KiB) Downloaded 369 times

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Fri Mar 04, 2011 11:22 pm

Bernd:

This is almost it!!!

Is there any way to cycle through all the images in one swipe, either direction?

If you're interested in continuing, could you email me?

ctflatt@me.com

Thanks, Bernd!

:Todd

hliljegren
Posts: 111
Joined: Sun Aug 23, 2009 7:48 am
Contact:

Re: Trying to figure this out

Post by hliljegren » Mon Mar 07, 2011 11:26 pm

ctflatt wrote:Bernd:
Is there any way to cycle through all the images in one swipe, either direction?

:Todd
What do you want to happen when the user swipes left? Do you want to start an "animation" where all images are presented in a defined sequence. I.e. Swipe left to start image show. If that is what you want you can use the send command to call a procedure that hides the current image and shows the next image. like

Code: Select all

send "ShowNextImage" to me in 3 seconds
___________________________________
MacBook Pro M1 MAX 64 Gb,
LiveCode 10.0.1rc3

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Wed Mar 09, 2011 10:34 am

hliljegren:

Thanks for the input.

To answer your question, yes, swiping from left-to-right plays through the sequence of images, and swiping right-to-left plays through the sequence in reverse.

I will try to post a video of the outcome here as soon as the working example is complete, and I'll describe the process as a resource/tutorial if anyone else is interested.

Have a great day!

Todd

padley123
Posts: 5
Joined: Wed Feb 09, 2011 5:20 pm

Re: Trying to figure this out

Post by padley123 » Thu Mar 17, 2011 10:26 am

It would be great if you could post a tutorial I have been trying to do the same thing for a while now.

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Thu Mar 17, 2011 10:43 am

padley123:

It's not a tutorial but, this is what we've been able to achieve based on my original request.

http://ctfinteractive.on-rev.com/video/mso_megazine.m4v

This is exactly what I was looking for.

If Bernd doesn't mind, we can make this technique publicly available.

:Todd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4163
Joined: Sun Jan 07, 2007 9:12 pm

Re: Trying to figure this out

Post by bn » Thu Mar 17, 2011 11:12 am

Hi Todd,

I don't mind at all. Please go ahead and make it publicly available.

Kind regards

Bernd

padley123
Posts: 5
Joined: Wed Feb 09, 2011 5:20 pm

Re: Trying to figure this out

Post by padley123 » Thu Mar 17, 2011 11:16 am

Thanks very much that looks great :D

ctflatt
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 243
Joined: Sun Dec 06, 2009 12:24 am
Contact:

Re: Trying to figure this out

Post by ctflatt » Thu Mar 17, 2011 11:38 am

padley123:

Thanks! The kudos go to Bernd, though. He provided two solutions (I couldn't come up with "one" :D).

One solution was to have a consistent background in place and transparent rope/letters appear based on setting the blendLevel as the user swipes. This is definitely more efficient, but only works with subject matter that lends itself to the technique.

The second, which was the one I went with, uses a series of full images shown successively as the user swipes. The video example uses image "frames" of animation exported from Photoshop or video editing app. This is more resource intensive, but ultimately more flexible, as the images can be completely unrelated (like a swipe-able slideshow).

What is your goal?

:Todd

padley123
Posts: 5
Joined: Wed Feb 09, 2011 5:20 pm

Re: Trying to figure this out

Post by padley123 » Thu Mar 17, 2011 12:36 pm

Sorry I didn't read through the the thread properly but this come in use in the future. I am actually making a catalogue which you can scroll through the pages quickly to find the relevant product. I like Bernds first example with the UIScrollView but I would it to center the page each time you scrolled across to the next page and I think that I would also have problem integrating the contents page this way.

Post Reply