checking parameter with a text in director class

Hello,

I had a project started long ago, and I was using director class. Now I have a problem. I am passing a parameter to a function named “param”. When I print(param), it writes “music1” in the console. But when I want to test it in an if state, like below:

if(param == "music1") then ..

it doesn’t enter the if statement. And this only happens, while it is working on the mobile device. It works correctly on my laptop on the simulator, os windows.

Note: While this error happens, the application on the mobile phone gives director class - error, failed to execute new(params) function on ‘screen2’. I see the console by adb.

How can I solve it?

Thanks.

Hello,

Nobody has an idea about this?

Thanks.

Is this a file name? On device the file names are case sensitive. Did you make a print on device and check the console?

yes, exactly same, case sensitivity etc.

It is a file name, but it also removes the file extension. Some files are in the resources directory, and

some are downloaded from a server. The files downloaded from server is working okay, the extension is

not left. There may be a problem about the extension, as it is “.txt”, but still there is problem in the beginning.

I see that the parameter is a string, by printing it on the console print(type(param)), Although it is same with

the “music1” that is in the if statement, it doesn’t visit inside if.

if doesn’t go inside if then something must be different.

Maybe a space or a period or a case that is different.

Put in print(param, param == “music1”) and check on the device log what get’s printed.

thanks, I will test it this night and write the results here.

Hello,

I added this line:

print(param, param == "music1")

The command line on the device is as below:

24zk6zp.png

Ok I can not see spaces like that change it to:

print(param, param == “‘music1’”)

and look for spaces between apostrophes and music1

Okay, I am testing it now. But as I said before, it’s working fine in Corona simulator.

I will write the results in ten minutes.

When I change the line as you say, in the simulator, it wrote false.

Same in the device console. What’s the cause?

Yes it’s not the comapre that’s changed look at the string where a added aphostrophes on each side to see if there are any spaces or other characters in it that would caue it to be different. Look at the ‘music1’ in the device log and see if there’s something there that shouldn’t be.

There is six characters only, nothing more.

Well something is that string thatz is causing it to not be same on device. Mybae a dot from the file name that simluator ignores or a backslash that would be interprated differentli on simulator and device. If you look at the screen shot of your console you will see that there is some weirfness there as false should be printed after the string but it’s printing in front over existing text. Maybe you have carriage return simbol in front that the simulator ignores because it’s not followed by a new line and the device just moves the output position. Something has to be in that string that is causing this.

Hello,

Nobody has an idea about this?

Thanks.

Is this a file name? On device the file names are case sensitive. Did you make a print on device and check the console?

yes, exactly same, case sensitivity etc.

It is a file name, but it also removes the file extension. Some files are in the resources directory, and

some are downloaded from a server. The files downloaded from server is working okay, the extension is

not left. There may be a problem about the extension, as it is “.txt”, but still there is problem in the beginning.

I see that the parameter is a string, by printing it on the console print(type(param)), Although it is same with

the “music1” that is in the if statement, it doesn’t visit inside if.

if doesn’t go inside if then something must be different.

Maybe a space or a period or a case that is different.

Put in print(param, param == “music1”) and check on the device log what get’s printed.

thanks, I will test it this night and write the results here.

Hello,

I added this line:

print(param, param == "music1")

The command line on the device is as below:

24zk6zp.png

Ok I can not see spaces like that change it to:

print(param, param == “‘music1’”)

and look for spaces between apostrophes and music1