Copy link to clipboard
Copied
Really want to refactor and re-architect my project, it's become basically an 11k line monobloc that desperately needs to be split into multiple classes (and class files) inside a single package.
Yes I know I should have figured all this out when I started, but this is play not work and I was brand new to AS3 when I started. And I've kept building and building and it all works, it's just become very hard to manage.
My immediate goal is to define a package and then start breaking out function groups from the current main class into subclasses that extend the base. But I'm having a problem with the first step - defining the package.
I'm getting:
C:\Users\Vossie\Documents\Fex Line of Battle Project\trunk\line_of_battle\LOB_Core.as, Line 1, Column 1 5001: The name of package 'line_of_battle' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Vossie\Documents\Fex Line of Battle Project\trunk\line_of_battle\LOB_Core.as
So I've checked:
package line_of_battle {
public class LOB_Core extends flash.display.MovieClip {
Filename is LOB_Core.as.
Path:
Class path:
Such a simple thing but I must be missing something since I keep getting the same error. I even created a new folder in a new location and created new test package parent class and child class with all new names carefully checked, and I get the exact same error. It keeps insisting my package name doesn't agree with the folder name even though that is clearly not the case.
Copy link to clipboard
Copied
your main file needs to be in trunk. at least, that's how it would work with flash/animate.
Copy link to clipboard
Copied
Sorry for slow response, as noted above this isn't work and I got pulled away for a couple days.
This does not seem to work either. I just created a folder called Flash Test and made a testClass.as and testClass.fla files inside. I gave the testClass the package name of packageTest. Then I created a folder called packageTest inside
package | packageTest | { |
public class testClass { |
C:\Users\Vossie\Documents\Flash Test\testClass.as, Line 1, Column 1 | 5001: The name of package 'packageTest' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Vossie\Documents\Flash Test\testClass.as |
Copy link to clipboard
Copied
there's a testClass.as file that is not in the packageTest folder. fix that by deleting the testClass.as shown in your screenshot.
save a testClass.as with package equal to packageTest in the packageTest folder if there's not one there already. retest.
Copy link to clipboard
Copied
Thanks for the continuing effort, just did that and... well...
C:\Users\Vossie\Documents\Flash Test\packageTest\testClass.as, Line 1, Column 1 | 5001: The name of package 'packageTest' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Vossie\Documents\Flash Test\packageTest\testClass.as |
Path is correct for the new location. And just for reference:
package | packageTest | { |
I apologize if I'm being obtuse. I'm getting pretty annoyed as I figure out 10 things a day that are seemingly considerably more complex problems than this is.
Copy link to clipboard
Copied
your screenshots look good if you were testing testClass.fla in ThisPC/Documents/Flash Test
but your error message shows you're testing something else. fix that.
Copy link to clipboard
Copied
First, again sorry for delay, work intruding on fun time.
Can you explain what you see in that error that says I'm testing something else? I don't see it.
But anyway, see below, I closed and reopened Animate, opened only one thing - testClass.fla from .../Documents/Flash Test/ and retested.
Clean, open one file, testClass.fla at the correct location.
Confirm that's only file present.
Ctrfl + Enter
I really got nothing here, and this makes no sense. Are there issues with win10? I upgraded recently, only major system change. I'm beginning to look for issues outside of standard "where is the file?" issues, it's almost like an encoding issue causing a mismatch. And it's frustrating as I have a relatively sophisticated application in need of refactoring before finalizing, and I can't even get my own packages to work.
Copy link to clipboard
Copied
there error message shows the testClass being used by your fla is in:
C:\Users\Vossie\Documents\Flash Test\packageTest
the testClass shown in your screenshot is in
<indeterminate>...\This PC\Documents\Flash Test\packageTest
you should create a new directory (or better yet, partition and directory) for your production files.
Copy link to clipboard
Copied
Ah, ok. I'm still fairly new to Win10 but those are aliases to the same location, just depends on how you navigate there; in short there aren't two locations and two versions, but maybe that's confusing Flash? Will go check what happens when I navigate to the .fla so it should have the c:\users\vossie\... path. Thanks.
Copy link to clipboard
Copied
That didn't work. According to what I'm seeing, Animate shouldn't care, they both point to the same resource. I just checked the publish settings and it's using This PC\Documents, but compiler errors seem to be thrown using the real path.
Copy link to clipboard
Copied
if you see that error message, flash cares.
again, you should create a new directory (or better yet, partition and directory) for your production files.
Copy link to clipboard
Copied
That sounded reasonable, that Flash was getting confused by Win10's aliases.
So I moved the whole Flash Test folder to the F: drive, for which there are no OS aliases like there are with the library folders (Documents, etc.) Then I killed the old class search paths on the .fla and reset them to the F:\ versions.
F:\Flash Test\packageTest\testClass.as, Line 1, Column 1 | 5001: The name of package 'packageTest' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. F:\Flash Test\packageTest\testClass.as |
Facepalm. I think the compiler simply has it in for me.
Copy link to clipboard
Copied
i don't know what you mean by "..the old class search paths...".
your source path should be the current directory indicated by a dot:
Copy link to clipboard
Copied
This time I apologize but have gotten irritated with this issue and actually went and made progress in other areas before turning back to this.
I did as requested above, now the actionscript settings for this .fla are:
And we no longer get the package naming error. However, we also are no longer executing testClass as I'm seeing no output from my trace statements, I assume because the document class specified above thinks testClass should be in the same directory it is.
Reminder of how I have it organized (which is what you suggested):
Code of the two classes:
package | packageTest | { |
public class testClass { |
public function testClass() { | |||
// constructor code | |||
trace("BIG MONKEYS"); | |||
var testInstance:testClass_Child = new testClass_Child(); | |||
} |
} | |
}
Ok... just tried several times to figure out how to paste in reasonably-formatted code and gave up. The advanced editor has a code hinting thing but it doesn't include AS3 and the result is worse than the above if I use any of them. Pasting it in just like above somehow turns it into a table with a fabulously complex and opaque editing UI.
package packageTest {
public class testClass_Child extends testClass {
public function testClass_Child() {
// constructor code
trace("BIGGER MONKEYS");
}
}
}
So as noted, now no errors, but it's also clearly not executing the class file in the packageTest directory. And if I put in any search paths that allow it to find the testClass.as file, it throws the package path error.
Copy link to clipboard
Copied
click file>publish settings>swf and make sure 'omit trace settings' is not ticked and your output panel has 'show output' ticked:
you could also add something to the stage in testClass to confirm it's being used.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now