I am making a top-down walk around game in flash, and am using the Collision Detection Kit to handle collisions. When I try to run my game, it gives me this error message in the compiler error box:
5001: The name of package 'com.coreyoneil.collision' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/student/Google Drive/School/Game for Mr Crawford/CollisionGroup.as
What is wrong, and what should I do to fix this?
It means you have a package declaration which does not match the location of the .as file. For example, if you have an .as file with the following:
package my.sub.pack.name
{
//
}
It needs to be found in the folder SOURCE_PATH/my/sub/pack/name/. Note a default SOURCE_PATH is the same directory as your FLA.
Related
Hi all I am trying to modify some flash files provided as part of a training package supplied on a DVD.
The DVD contains the final training packages as well as all the source files.
I have opened one of the source FLA files in Flash CC and fixed some typos in the text, then republished the SWF.
When republishing I get two errors.
1 Symbol 'noteBtn1' 1017: The definition of base class RolloverCursor was not found.
2 , Line 1, Column 1 5000: The class 'RolloverCursor' must subclass 'flash.display.MovieClip' since it is linked to a library symbol of that type.
I have looked at the noteBtn1 Symbol and cannot see any script attached to it ?
I have assumed that by simply hacking the original fla file all the correct paths and setting should be inherited from the FLA file.
If I try and run the resulting SWF file it doesn't initailise correctly leaving all the assets visible simultaneously.
The FLA file has a single scene in it with the first layer being a script layer.
There is only one frame in the scene
It has been a long time since I touched Flash so a little help would be gratefully appreciated !!
Regards
Gus
There must some Action Script along with it in a folder which you probably didn't copy along. This happened to me as well a lot of times. Just search for the folder containing the 'as' file of RolloverCursor.as (most probably) and make sure it is in the same folder as your flash file.
The original object in the Flash project causing the error was not used. I have removed it from the compile. This caused another error about a missing library
The missing library was a 3rd party actionscript library. This was then downloaded and installed in the same directory as the FLA file.
Import statements updated to reflect the correct package structure, the object has now compiled.
I still cannot see how to set the global class path in the Adobe CC 2014 version of Flash professional
So I'm trying to build a separate package. In that package I would like to reference TweenMax, however I'm having trouble linking to it (error Definition com.greensock:TweenMax could not be found).
Here is my dir structure:
myApp
--com
----greensock
------Tweenmax etc
----myPackage
------packageClass.as
--------elements
----------elementClass.as (this is the one trying to access tweenmax)
--src
----Main.as
main.as is the document class, just so I can test myPackage. Doesn't do anything except instantiate myPackageClass and stick it in the displayList.
In the elementClass.as I have:
import com.greensock.TweenMax;
which flashDevelop seems to see within the ide, but when I compile I get the ...could not be found error.
So how can I reference tweenmax from my elementClass file (I have src and com dirs in the classpaths.
I'm using flashDevelop with flash player 11.7 and Flex 4.6.0 SDK.
Am I going about this all wrong?
I'm going to ask the hopefully obvious question, did you import the greensock folder?
import com.greensock.TweenMax
Ok let's say you did that already. Maybe you need to tell your code where your libraries are. Go to File > ActionScript Settings, or, on the stage's property panel, click the wrench icon next to the Script drop down menu.
You should see a dialog with three tabs, the first two of which are labeled Source path and Library Path. Forget about the third.
In the Source path tab, you should at least have a dot - (.) - as one of the choices. That tells flash to look for any actionscript classes it can't find at compile time in the same directory as the source FLA. From there you can list any number of other library paths that contain supporting files.
The second tab is for SWC files. If you have a SWC library, you can tell your FLA where to find it by pathing to it here, just as you pathed to your libraries in the Source path tab.
The images below presume that there is a folder, in the same directory as the source FLA, named library. In this folder are sub folders named src and swc. Inside src are sub folders containing the greensock and facebookAPI com folders, (the latter used here for example). Inside the swc folder there is a SWC named exampleSWC.swc.
The paths shown in the pics below would allow the FLA to see the following imports:
import com.greensock.TweenMax;
import com.facebook.someFacebookAPIClass;
import com.somePackageInTheSWC.someClassFromExampleSWC;
I have an fla class referencing 'com.poole.blackjack.game', and a folder path starting at the fla root of 'com\poole\blackjack\game'.
When I compile, I get:
'C:\Users\Stephen\Desktop\Blackjack\com\poole\blackjack\Game\Player.as, Line 1 5001: The name of package 'com.poole.blackjack.game' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Stephen\Desktop\Blackjack\com\poole\blackjack\Game\Player.as'
I tried changing the reference and folder name to 'Game', but get:
'C:\Users\Stephen\Desktop\Blackjack\com\poole\blackjack\game\Player.as, Line 1 5001: The name of package 'com.poole.blackjack.Game' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. C:\Users\Stephen\Desktop\Blackjack\com\poole\blackjack\game\Player.as'
It's like flash is misinterpreting the filepath, though it has worked up until now. Very annoying!
It seems like your package is using 'game' - lowercase g
And you path in the error message is 'Game' - uppercase G
I'd verify that your folder structure case matches the package case.
your error :
When I compile, I get: 'C:\Users\Stephen\Desktop\Blackjack\com\poole\blackjack\Game\Player.as
your package :
'com.poole.blackjack.game'
Much later than the post, but we encountered a similar issue. It seems there is a bug with the buildsystem / IDE that if you have a file and a directory with the same name, things might get mixed up.
In our case, in the same directory we had a class called Util and a directory called util, and it didn't compile with the same error.
Our fix was changing the Util class to a different name.
I am new to Flash Builder so this is an easy question for anybody who has some experience with flash builder and actionscript 3.0.
So basically I have a folder with .as files. The directory of it is -
...\src\assets\Stadium\MyClass
Now I want to use it in my Flash Builder Project, but when I import like this -
import assets.Stadium.MyClass.PrefabProject;
There are warnings ... look in the image below.
How can I possibly use the contents of the folder in my as3 code.
How can I use the folder as a package?
EDIT: I went ahead and tried to use the stuff from the package in the code - This is the error I got -
A file found in a source-path must have the same package structure 'assets.Stadium.MyClass', as the definition's package, ''. MyClass.as /proj_away_alpha_new/src/assets/Stadium/MyClass Unknown Flex Problem
The error you have posted in your edit seems to imply that your package statement in MyClass is empty. The package statement should contain the same path that your class is in.
Since MyClass.as resides at the path (relative to your project): assets/Stadium/MyClass
The package statement (at the top of MyClass.as) should be the same:
package assets.Stadium.MyClass
I may have interpreted that error incorrectly. Just make sure that the package statement in MyClass.as is the same as the location of the class file on disk (relative to the project's src directory).
PS: The only time you use an empty package statement is when your class resides in that special "default package" (where your main app is).
I'm trying to use the JPGEncoder class in flash AS3 but this error keeps popping up (when testing):
1046: Type was not found or was not a compile-time constant: BitString.
The problem line is in the JPGEncoder class, which I got from here:
private function writeBits(bs:BitString):void
Anyone know how I could solve this issue? Thanks xD
This error means it cannot find the BitString class.
Make sure you hve downloaded the BitString class file and any other required classes. To be sure you might want to consider downloading the whole as3CoreLib and unzipping it while preserving file structure into your code folder.
Make sure they are placed in the correct folder structure, such as yourProjetRootFolder/com/ adobe/images/BitString.as or if in a folder out side of the root make sure the path is included in your ActionScript 3 settings.