简体   繁体   English

在Flash CS5(AS3)中创建图层功能

[英]Creating the layer functionality in Flash CS5 (as3)

Hi I need to create the application in Flash CS5 with the help of as3 where the user can draw according to his requirement but in layers. 嗨,我需要在as3的帮助下在Flash CS5中创建应用程序,用户可以根据自己的要求分层绘制。 This app will provide user to create Business Cards, Broushers etc. Can anyone help me in create the layer functionality. 该应用程序将向用户提供创建名片,代理等的功能。有人可以帮助我创建图层功能吗? Only the layer functionality of this app is remaining. 仅剩下此应用程序的图层功能。 If anyone one can resolve it please help me out. 如果有人可以解决,请帮助我。

The answer you are looking for requires a lot of development time. 您要寻找的答案需要大量的开发时间。 The basic idea is to create a stack of sprites and draw on each one of them the shapes or images that you need. 基本思想是创建一堆精灵,并在每个精灵上绘制所需的形状或图像。 Last year I build an application just like that and it took several month to finish. 去年,我就这样构建了一个应用程序,并且花了几个月的时间才能完成。 If you want to build it yourself you should ask much more specific question on how to do things. 如果您想自己构建它,您应该问更具体的问题。

You can treat each layer as a sprite and draw into these sprites using the graphics object of each, you can easily change the ordering of the layers by changing the indices of the sprites in the container they are in. 您可以将每个图层视为一个精灵,并使用每个对象的图形对象将其绘制到这些精灵中,可以通过更改它们所在的容器中的精灵的索引来轻松更改图层的顺序。

var layer1:Sprite = new Sprite();
container.addChild(layer1);
var layer2:Sprite = new Sprite();
container.addChild(layer2);

layer1.graphics.***  //drawing functions
layer2.graphics.***  //drawing functions

container.setChildIndex(layer1,1);  //change ordering

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM