Sorry - I know this has been covered before but I can't get my flash file to locate and use my document class. This is my setup (from the root)
I have a /bin folder containing my published swf and html file (/bin/test.swf).
I have a /resources folder containing an XML file which is loaded (/resources/flar/flarConfig.xml).
I have a /src folder containing my fla (/src/test.fla), and a directory called examples containing the .as file I want to use for my document class (/src/examples/FLARManagerTutorial_2D.as). It looks like this:
package examples {
public class FLARManagerTutorial_2D extends Sprite {
this.flarManager = new FlarManager("../resources/flar/flarConfig.xml)
In my flash publish settings, the class path is just "."
In my document class, if I input: FLARManagerTutorial_2D, I get the er开发者_运维百科ror:
The name of the package 'examples' does not reflect the location of this file.
What do I need to do to get it to recognize and reference this class correctly and load the XML file? I feel like no matter what combination of paths I try, I get the error - or else flash just adds its own blank document class and nothing happens. Thanks for the help.
Try setting your document class to 'examples.FLARManagerTutorial_2D'.
Package names are really just a reflection of a file structure. consider:
fla
src/
com/
mheavers/
app/
FLARManagerTutorial_2D.as
The src folder contains the folders com/mheavers/app, which contains your class. This package would then be com.mheavers.app
. Set the filepath in your fla to src (the parent folder of your package/folder structure), and your document class to com.mheavers.app.FLARManagerTutorial_2D
.
In your case, make sure a folder called examples
(that contains your .AS file) exists in your src
folder if you wish that to be your package, assign the path to src, and set the doc class to examples.FLARManagerTutorial_2D
.
I definitely had to monkey around with that a bit when I was just getting started with as3. Hope that helps.
精彩评论