Referencing ActionScript file
I have a process set up to create action script files. They hold functions that are called upon by my flash project. How can i reference these files so that the project knows the functions are there.
with asp.net i would simply reference the .js file. Is it the开发者_如何学C same process?
The process of importing files to be used by Flash is pretty straightforward:
At the top of each external file there will be a package
declaration, it basically represents it's path from the .fla file.
For example:
package com.site.objects
The above represents an ActionScript file within a folder objects, within site, within com whose parent folder also contains the .fla file.
When you're importing external files, you always start from the directory containing the .fla. This is always necessary with the exception of importing external files that are in the same directory as the file you're trying to access the class from.
The import statement for the above example will look like this:
import com.site.objects.MyClass;
Once you've done this, you'll be able to:
- Create instances of the imported class.
- Access static properties and methods defined within the class.
- Extend the class to create a new class which will inherit it's properties.
etc
精彩评论