Page 1 of 1

Lesson 2 Screen Transitions

Posted: Tue Aug 20, 2013 8:18 pm
by EOTR
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

Re: Lesson 2 Screen Transitions

Posted: Tue Aug 20, 2013 8:44 pm
by fredotechGA2742
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.

Re: Lesson 2 Screen Transitions

Posted: Wed Aug 21, 2013 10:18 am
by elanorb
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

Re: Lesson 2 Screen Transitions

Posted: Thu Aug 22, 2013 9:23 pm
by EOTR
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

Re: Lesson 2 Screen Transitions

Posted: Fri Aug 23, 2013 3:09 am
by amanteai
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" :?: :?:

Re: Lesson 2 Screen Transitions

Posted: Fri Aug 23, 2013 4:43 am
by EOTR
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.

Re: Lesson 2 Screen Transitions

Posted: Sun Aug 25, 2013 7:13 pm
by amanteai
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: