Tutorials usually don't deal with scope in Actionscript. Can you point me to some documentation and/or explain what should I know about it. I want to avoid problems arising from certain classes are not visible at certain places.
相关问题
- garbage collection best practices
- JavaScript variable scope question: to var, or not
- How to load flex swf from flash?
- Scope on each last elements of a has_many relation
- FlashDevelop Haxe (Flash) debugger
相关文章
- Rails scope for values only between two dates
- How to scope closure's variables in CF10?
- Cannot access self:: when no class scope is active
- Are there any benefits when using final in AS3?
- Function hiding and using-declaration in C++
- Trace on Chrome/Browser console
- Is there a way to call a private Class method from
- Nodejs accessing nested variable in global scope
These should help.
Function scope:
http://livedocs.adobe.com/flex/3/html/help.html?content=03_Language_and_Syntax_21.html
Packaging and namespace:
http://livedocs.adobe.com/flex/3/html/03_Language_and_Syntax_04.html#119303
You're a bit vague, but hopefully I'm getting you ;)
Scope for classes are generally pretty easy to handle, it mostly comes down to packages. Packages are created in a simple tree structure, and in ActionScript3 the filestructre has to follow the namespaces. Which makes it even easier.
You can access any class from anywhere, but if it's in another package you will need to "import" the class. This is done by writing an import statement in the beginning of class or interface where you need to use it. Like so:
There is an exception to this rule, a class can be declared with the internal keyword, in which case the class will only be available within that package. This is mostly used for helper classes.
Basicly you should not worry about classes not being available.
NB: You create package with the package keyword.