开发者

Referencing ActionScript file

开发者 https://www.devze.com 2023-04-07 04:22 出处:网络
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.

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:

  1. Create instances of the imported class.
  2. Access static properties and methods defined within the class.
  3. Extend the class to create a new class which will inherit it's properties.

etc

0

精彩评论

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