Multiple Actionscript 3 layers

2019-07-10 17:14发布

问题:

I'm wondering if I split up certain bits of code that are meant for different sections into different layers will they have functionality between them or act as separate things. (will I be able to reference a variable on one layer from the other?)

Basically I have a set of code that runs throughout every frame but also need code specific to certain frames but still be able to access the main code.

Thanks

回答1:

You could have code that spans multiple frames as well as individual frame script:

In this case, individual key frame script from actions layer could call functions defined in main actions, likewise main actions can call functions from code within the current frame of actions layer.

As applications increase in complexity, you may want to consider using classes over frame script, defining a base document class for your project.

As well, define classes per symbols in the library through AS Linkage:

There are many design patterns for larger applications to reduce complexity.