I made some kind of application, like a picture gallery, and i started to implement a music player into it, with next, previous buttons etc. I used a variable with an integer value to regulate the song switching. I declared it in one scene, since my application uses multiple scenes, but i cant change it's value permanently, when i switch scenes the value stays in the state i declared it, for examplei declare it like track=1; , and in one scene i increase it to 3, and when i return to the previous scene (it's not the scene it's declared in) it's 1again. I tried to declare it with _global in front, bit it doesnt seam to be working. Any sugestions? The question is how can i declare a variable do all scenes can change it's value.
This is one of the problems you can have if you work with scenes ... If you already declared it global try to use the global also when you set it like: _global.track = 3; Should, but I say 'should' ...work HTH, -c.
The interesting thing is i had the same problem when i didnt use multiple scenes. The code for the music player was in the first frame, and the rest of the components were in other frames. So when I changed the value of the variable to for example 3 in frame 6, and returned to frame 2, the value wasn't 3 but 1 again (the value i declared it in, when i declared it track=2; it was 2 when i returned to frame 2 or any other frame for that matter). I really don't know how to solve this problem.
Sorry, if I have not lost a step you are setting 'yourvar' to '6' in frame 6 and then moving to frame 2 which contains something like: _global.yourvar = 2; you complain that the value of 'yourvar' is not '6'? -c.
Don't see what you're looking for? Try a search.
|