I'll see if I can make a sample for you.
I'll wait for it!
It seems to work for me. Let me know if it works for you?
I just saw the bug in your code. If the variable doesn't match the function, you need to reset the variable correctly.
For reference for those who see this post and don't get the capx.
<img src="https://dl.dropbox.com/u/19625130/ScreenAlign.JPG" border="0" />
thank you very much for your help.
It works very good.
I'm trying to see if there is a way, when I change the Layout, to let this images not be "shifted" on the right when the layer is shown.
This is a ugly effect on Android.
I can post a capx to show you the problem, if anyone interested...
I'm having real headaches figuring out how to make a "single code base" for PC and mobile games. If you move stuff about on startup (to fit a mobile screen) then you are screwed the second anyone resizes a browser window running it on PC.
Yes, it's true.
I'm trying different solution to find out the correct one.
If anyone has a solution, please help!
ghale I think you guys are making this much more difficult than it needs to be.
Here is a simple example I made for you:
I used your original .capx to created 3 layers, I then set it to scale mode. After that I placed all your sprites on the HUD layer, and gave each one an anchor behavior with different settings. Then I set unbounded scrolling to yes, and set parallax to 0. This will get the effect you want on all device resolutions.
Develop games in your browser. Powerful, performant & highly capable.
can you put it the capx in r119?
I don't use the beta r120!
ghale Ok, I updated the download link to a r119 version.
maybe the file is corrupted, because I can see 1 Layout, and an empty Event Sheet!
ghale Yes, it is a simple example based on your Alignment_03.capx. You don't need any events to accomplish this. Just run the .capx and you should see a working example.
Everything is done in the properties windows.
I also wrote some tips about supporting multiple resolutions here:
Maybe I've not been clear.
There is a problem on CocoonJS aligning items at first start of application.
Please run it on CocconJS on Android and tell me if all is correct.
I've just tried your example and it not works correctly on Android (obviously yes on PC).
ghale I just tested it with the CocoonJS launcher on a Samsung Galaxy S3, and a Nexus 7. Everything looks fine here.
Here is a screen shot taken off of my Samsung Galaxy S3:
<img src="http://i51.tinypic.com/313n62c.png" border="0" />
What type of device are you testing on, and what OS is it running? CocoonJS doesn't work very well on 2.2 and older.
Maybe I'm not understanding exactly what your trying to accomplish?