Hello,
I have created a tutorial that acts like a simple slideshow. How I pull it off is by having 6 full-sized images placed side-by-side within long display group. I then scroll the display group to view the correct image. But, for some reason, things aren’t acting the way I would suspect they should in terms of positioning the display group. Here’s a small piece of my code:
screen1 = display.newImage("tutorial/screen1.png")
screen2 = display.newImage("tutorial/screen2.png")
screen3 = display.newImage("tutorial/screen3.png")
screen4 = display.newImage("tutorial/screen4.png")
screen5 = display.newImage("tutorial/screen5.png")
screen6 = display.newImage("tutorial/screen6.png")
screen1.x = 1024 \* 0
screen2.x = 1024 \* 1
screen3.x = 1024 \* 2
screen4.x = 1024 \* 3
screen5.x = 1024 \* 4
screen6.x = 1024 \* 5
slideshow\_group:insert(screen1)
slideshow\_group:insert(screen2)
slideshow\_group:insert(screen3)
slideshow\_group:insert(screen4)
slideshow\_group:insert(screen5)
slideshow\_group:insert(screen6)
slideshow\_group.x = 512;
Look at that last line of code, the “slideshow_group.x = 512;”. That actually works. It shows the first slide properly. I would have thought that it should be: slideshow_group.x = 0;
Even stranger, in order to transition to the next slides, I have to use these offsets:
local slide_offsets = {-512, -1536, -2560, -3584, -4608, -5632}
In other words, to view screen #2, I need to subtract 512 from slideshow_group.x. To view screen #3, I need to subtract 1536 (512 + 1024). To view screen #4, I need to subtract 2560 (512 + 1024 + 1024) Very odd.
Any ideas what’s going on?
Thanks!
- Bret [import]uid: 168791 topic_id: 31168 reply_id: 331168[/import]
[import]uid: 52491 topic_id: 31168 reply_id: 124661[/import]