开发者

Is it possible to move the stage in actionscript 3.0?

Hi to keep it short and simple let's say I have a stage with 400x400 size in pixels, but I've drawn a map of 1000x1000 size in pixels. I want my player to be able to "walk" about the stage, but it appears stage.x and stage.y are read-only? Is there any method or way to have the stage "scroll" about, w开发者_如何转开发ithout having to move each object on the map?


Don't move the stage, move the 1000x1000 object,then it'll look like the whole thing is moving.


You should see the stage like a window. You can see everything behind it depending on the size of the window. You cannot change the size of the stage, or move it.

Just like a window you can measure the size of the stage. You can use this to navigate for example movieclips across the stage with actionscript.

Why don't you put the map and the other objects in a seperate layer, and move the map around. Other objects (for example a big red dot to tell the user its' location on the map) are on a fixed position on the map. Just move the map following a sort of path according the red dot.

Not entirely sure what you want to do, but it isn't possible to move the stage.


You can put all the movieclips (the player and the map, if you want) in one movieclip, put only that movieclip on the stage and move that.

But if you only want the map to scroll, just move the map around.


The other answers are correct, but there's an alternative to moving the map:

ScrollRect

Attach a rectangle to a your map's scrollRect property. Moving that rectangle will have the same apparent effect as moving the stage around.

There are minor pros and cons to using scrollRect vs. moving the world, but try them both and see which works better for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜