Home‎ > ‎

Problems

Here will be solutions to some of the common problems that you may have

1. My Code Does Not Work

"I typed (or copied) exactly as you had it in the lesson but mine does not work. I press the button but nothing happens. Why not?"

Solution:
The usual problem is that you may have used a different type of object than I did or you gave it a different name. Remember, every object has 2 parts: the type and its name (button "box", image "sunset", graphic "box", etc). 

Check that the code refers to your object and that its name is correct. You can click on your object, bring up its Property Inspector and at the top it will have the type and name listed. Check for extra spaces in the name - button "box " vs button "box"

2. LiveCode is frozen, nothing works, nothing is happening

Chances are, you have an error and your stopped in the debugger. Look for a window that looks like this with a Blue Square in the top left corner of the code (script) window. You have an error and LiveCode stopped the program and is waiting for you to "debug" it. The orange circle with an ">" in it marks the bad line of code. The error is at the bottom where the red circle with an "X" in it is.

You have to click on either the Green Triangle to "GO" or the Blue Square to stop the debugger. Then you fix the error and continue.

                              

3. The arrowKeys change screens instead of moving the object
    A: In the preOpenStack procedure, add the following:

4. The animation looks fine on LiveCode but when I package it into my phone, the animation appears very laggy and slows down frequently.
    A: Besides setting acceleratedRendering, you also need to set the layerMode of each block to "dynamic".
                         
5. How do you prevent carraige returns in data? How do you restrict the user to one line of data?
    A: A quick, cheap way to disallow carriage returns in a field is to set the height of the field to a single line and then turn on autoTab. That forces a carriage return to tab to the next field rather than entering an actual return. Or you can just trap "returnInField".
You also could trap exitfield and closefield messages to strip unwanted cr and other characters, otherwise data pasted in rather than typed could contain the wrong things.

6. I am having trouble with variables.
    A: Many people here have adapted the habit to prepend the variables with a letter depending on what type of variables they are:
t (like in temp) for local variables
s (like in script local) for script local variables
g (like in global) for global variables
Comments