When a client clicks on a lotto ball the it shows an X if not showing and visa versa.
I then need to save the state of the showX = Y or N.
When starting the app read the settings showX and show or hide it.
This is working as expected.
I now need to duplicate this for 59 different balls.
I cannot work out a way (other than duplicate each set of code & animation) to allow me to save the state of each instance of showX.
@JimScott is correct, you would do this with an array.
But localStorage only accepts strings so we would need to convert the array structure to a string and when getting it back re structure it into an array again. This is very simple as shown in this updated version of your projects.
The best was I can see to id each ball that is clicked is to make the X button into a symbol.
Then duplicate it as needed and give each one an id corresponding with a ball. Place the duplicated symbols over the corresponding balls.
(NOTE: because we are now using symbols, I have removed the time line on the scene. The symbol now has the timeline. Also I have removed the click actions from the buttons and put it on the symbols so we get the symbols id when we click. In the Main Timeline I have removed the start symbols timelines )
This works fine on the coding side.
To get the symbols to show in the middle of the balls I had to offset them to the left.
On full screen it is okay but as I make the screen smaller (or view on Iphone) the ‘X’ is offset to the left.
I cannot work out why this is happening or why I need to offset the symbols in the first place.
The problem is (I think) that the data returned is not formatted as an array.
How do I ensure I am sending an array, storing an array in xSettings.txt, then returning the array.
Any question is on the population of the balls.
The layout okay on different devices but on a web page there is a lot of white space. Is there a way to add more to the rows as the page size increases
But from what I can see from what you were doing you do not understand the php stuff that I wrote and you copied int the project.
Thats ok because it looks like you were trying. The problem is if you are going to understand my changes.
I will post this example now. And try and come back with whats going on later…
Note. Delete your file xSetting.txt in the myFiles folder before you run this.
This will always write a new one out when you click a symbol but at the start you will get odd results if your file is not formatted right.
Also this will mean you will get a 404. When you first ever run because the xSetting.txt file will not be found. Don’t worry about that at the mo.