Is it possible to move the scene in actionscript 3.0?
Hi, to briefly and simply say that I have a scene with a size of 400x400 in pixels, but I have drawn a map with a size of 1000x1000 in pixels. I want my player to be able to "walk" the stage, but stage.x and stage.y are read-only? Is there any method or way to make the scene "scroll" without having to move every object on the map?
Thanks!
a source to share
You should see the scene as a window. You can see everything behind it depending on the size of the window. You cannot resize the scene or move it.
Like a window, you can measure the size of a scene. You can use this to move, for example, movieclips around the stage using ActionScript.
Why don't you put the map and other objects on a separate layer and move the map. Other objects (for example, a large red dot indicating their location on the map to the user) are at a fixed position on the map. Just move the map by following the path along the red dot.
Not really sure what you want to do, but it is not possible to move the scene.
a source to share
The other answers are correct, but there is an alternative to moving the map:
Attach the rectangle to the scrollRect property of your map. Moving this rectangle will have the same effect as moving the scene around.
There are minor pros and cons of using scrollRect versus moving the world, but try both of them and see what's best for you.
a source to share