Code not working in iOS simulator

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
lrieber
Posts: 40
Joined: Sat Sep 24, 2011 6:30 pm
Contact:

Code not working in iOS simulator

Post by lrieber » Sat Sep 24, 2011 6:46 pm

I'm programming an iPhone app for a university research project. I want an opening card to pause 3 seconds and then go to an "interaction" card, *unless* the researcher clicks on a secret area of the card (top left corner of the screen) which would then take the researcher to a "research options" card. The card script works beautifully when running in livecode, but not when I run it in the simulator.

I'm very new to programming for the iPhone, so I'm sure I'm doing something wrong that will be obvious to others.

Here's the card script:

on opencard
global varOpeningPause
put 3 into varOpeningPause

put varOpeningPause * 60 into varOpeningTicks

repeat with i = 1 to varOpeningTicks
wait 1 ticks
if the mouseV <50 and the mouseH <50 and the mouseClick then
go to card "research options"
pass opencard
end if
end repeat

go to card "interaction"
end opencard

Thanks in advance to any help offered.

Lloyd

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Code not working in iOS simulator

Post by FireWorx » Sat Sep 24, 2011 7:50 pm

The other day I built a stack and ran it on the IOS tester and it worked fine with the following code. I dont have the stack in front of me but something like. I have the splash screen on card 2. It would be nice to be loading the url into my browser while the stack is waiting on the visual however I am not sure how exactly its best to do that. IOS has a feature in the standalone settings as well where you can designate a .png graphic to flash on open up and also where you can pick an .png to be your Icon. Not sure if you can control how long the .png splash sticks around before its hidden. Mine flashed so fast if you blinked you missed it. If I could set that time period I wouldn't need a card in my stack to do it. Anyone?

On openstack
go to card 2
wait 2 secs
go to card 1
end openstack

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Code not working in iOS simulator

Post by Dixie » Sat Sep 24, 2011 8:39 pm

Fireworx...

If you have a splashScrenn that you have specified in the standalone settings then

Code: Select all

on preOpenStack
   wait 5 secs
end preOpenStack
will display your splashScreen for 5 secs before doing anything else...

Dixie

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Code not working in iOS simulator

Post by Dixie » Sat Sep 24, 2011 8:56 pm

Ireiber...

I have attached a stack for you to look at... If you run the stack in the simulator and do nothing then after three secs you will be taken to card 2... if however you click in the graphic that is placed at the top left of card one before three secs has elapsed you will be taken to card 3...

The scripts are in the card script of card 1 and in the script of the graphic

Dixie
Attachments
switchCards.zip
(20.93 KiB) Downloaded 271 times

lrieber
Posts: 40
Joined: Sat Sep 24, 2011 6:30 pm
Contact:

Re: Code not working in iOS simulator

Post by lrieber » Sun Sep 25, 2011 12:07 am

Dixie,

Thank you very much. This works great. Very clever strategy.

It's interesting, though, that when I run your code in LiveCode, it doesn't work properly but it seems to me it should. I need to get a handle on programming differences between running in LiveCode vs. the iOS simulator. I've downloaded and reviewed the "LiveCodeNotes-4_6_0-iOS.pdf" but it doesn't explain these sorts of differences beyond the very brief "what does/does not work" section on p. 14.

So, if you have any advice on where I should go to learn more on my own, please let me know.

Again, you've been very helpful. Thank you.

Lloyd

Post Reply