Lesson 2 Screen Transitions

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
EOTR
Posts: 49
Joined: Fri Aug 09, 2013 7:20 pm

Lesson 2 Screen Transitions

Post by EOTR » Tue Aug 20, 2013 8:18 pm

It was really cool to learn how to make the screen transitions animate today. From a UX standpoint this works a lot better for the user than just having the next screen appear as if from nowhere.

I did get it to work, however if I'm on a particular screen (like the "Contacts" screen) and click the screen's button a second time, the card slides in again. Is there a way to stop the card from loading if it is already loaded?

thanks, Henry

fredotechGA2742
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 24
Joined: Mon Jan 16, 2012 10:39 am
Location: Maryland USA
Contact:

Re: Lesson 2 Screen Transitions

Post by fredotechGA2742 » Tue Aug 20, 2013 8:44 pm

I have the same question. I think you may be able to put some logic that says is I'm on me dont animate. I have not tried the exercise yet but when I do I will try to put an if statement.

elanorb
Livecode Staff Member
Livecode Staff Member
Posts: 251
Joined: Fri Feb 24, 2006 9:45 am

Re: Lesson 2 Screen Transitions

Post by elanorb » Wed Aug 21, 2013 10:18 am

Hi, yes the way to do this would be to use an if statement to check what card you are on, so the code for the naviagtionButtons group might be something like

on touchStart
if the uTabText of me is not the short name of this card then
set the uText of group "title" to the uTabText of me

lock screen for visual effect in rect "0,44,768,970"
go to card the uTabText of me
unlock screen with visual effect push left fast
end if
end touchStart

Because the names of the cards match the names and labels of the buttons this check works and will only change cards if we have selected a card that is not the current card. We use the short name property as that returns the name you gave the card e.g. "contacts" the name property will return ' card "contacts" '.

I hope that helps.

Kind regards

Elanor
Elanor Buchanan
Software Developer
LiveCode

EOTR
Posts: 49
Joined: Fri Aug 09, 2013 7:20 pm

Re: Lesson 2 Screen Transitions

Post by EOTR » Thu Aug 22, 2013 9:23 pm

Thanks Elanor!

This seems like a simple and elegant solution that clears things up for me a bit. One thing I struggle with is the logic of how to write this stuff. For instance my thinking was to put an if/then statement AFTER the card was loaded. The way you have it the statement checks the card BEFORE it tries to load and then kills everything if it is already loaded.

I'm not a programmer so this type of example is extremely useful for me.

thanks, Henry

amanteai
Posts: 12
Joined: Tue Aug 20, 2013 3:37 am

Re: Lesson 2 Screen Transitions

Post by amanteai » Fri Aug 23, 2013 3:09 am

I can't get the transition to work properly...any ideas why? I (believe)I followed the directions to a T, but messed up somewhere along the way. I edited the code and the contact screen slides to the left but then the next screen is blank white, nothing on it. I edited the group NavigationButtons but now all my other cards show blank screens and when I click in the contact card in the project window I get an alert "The control you selected no longer exists" :?: :?:

EOTR
Posts: 49
Joined: Fri Aug 09, 2013 7:20 pm

Re: Lesson 2 Screen Transitions

Post by EOTR » Fri Aug 23, 2013 4:43 am

Did you edit the code for the group of nav buttons? It should be on the group and not the individual buttons.

Maybe try clicking on the "Add preOpenCard code to card script" button in Mobgui. I think I got that message before too and I've done this a few times when things weren't working.

When all else fails try copying Elanor's script and pasting it in yours. If it works then it means you may have left off one small thing in your script. Here's my script:

on touchStart
if the uTabText of me is not the short name of this card then
set the uText of group "title" to the uTabText of me

lock screen for visual effect in rect 0,42,1026,670
go to card the uTabText of me
unlock screen with visual effect push left fast
end if
end touchStart

Also try checking to see if you still have "Behave like background" checked. One time I turned it off and everything stopped working.

amanteai
Posts: 12
Joined: Tue Aug 20, 2013 3:37 am

Re: Lesson 2 Screen Transitions

Post by amanteai » Sun Aug 25, 2013 7:13 pm

Thanks for responding! I don't know what I did, so I scrapped it and redid it. At some point I must have deleted something important. I was too trigger happy with the undo and apple_delete buttons and did it several more times. This last time I was very very careful and deliberate and was able to get the project correct. :wink:

Post Reply

Return to “Summer School 2013”