As it's warmup time in Ludum Dare, I thought I'd make sure the Flex SDK I'd just downloaded works. Short answer: it doesn’t.
Every time I try to run
./mxmlc -compiler.source-path=../../../Flixel/org/flixel ../../../Flash/FindTheLight/src/FindTheLight.as
I get:
Config in /Users/jonatannoponen/Developer/Tools/flex_sdk_4.6/frameworks/flex-config.xml loading
/Users/jonatannoponen/Developer/Flash/FindTheLight/src/FindTheLight.as(7): sar.: 36 Error: Baseclass FlxGame definition not found.
public class FindTheLight extends FlxGame
^`
Obviously, SDK can't find the FlxGame class. Where does your FlxGame.as located?
Also, don't you think that using an IDE (FlashDevelop, for example) can solve your problem? Just curious.
Related
It seems that this is a fairly common error, but I was not able to find a solution for my exact problem. I was originally working in FlashBuilder, but my free trial expired and so I am attempting to switch to flashDevelop. Everything would build just fine in FlashBuilder, but I keep getting errors in FlashDevelop I have a custom class called MyCustomClass which extends EventDispatcher. I'm not allowed to be too specific with code, as this is for work, but I have something similar to this:
package myPackage{
import myPackage.MyCustomClass;
public class SecondClass extends EventDispatcher{
private var _fields:Vector.<MyCustomClass>;
[Bindable("fieldsChanged")]
public function get fields(): Vector.<MyCustomClass> { return _fields.slice(); }
}
}
I get the error Type was not found or was not a compile-time constant: MyCustomClass
on the fourth line of code. Any ideas?
Probably your source path is not setup in Flash Develop. In the project panel (View > Project Manager) select your source root directory (probably "src" since that is what Flash Builder creates by default) and right click and choose "Add Source Path". You can also setup your source paths in Project > Properties.. > Classpaths.
Ok so I have game data parser that creates a game out of data file basically, it is using extensively getDefinitionByName which has one problem if the class is not loading somewhere else it throw variable not defined error information=ReferenceError: Error #1065: Variable {MyClass} is not defined. to workaround it I am using a class that holds all the list of components and instantiate it to make these classes available to the compiler.
Ok the question part is there any more efficient way to do that or playing with compiler argument or something ?
Is there something like export in first frame in flash professional as a compiler argument ?
I think what you want is to have a library project with all those "callable" classes, and then reference that library project in your game.
In flash builder, for a library project, you can check which classes are compiled (and so available to getDefinitionByName). (info here)
im using Adobe® Flash® Builder™ 4.6,the problem also exist in previous versions.
for some reason ,i am using
cls = applicationDomain.getDefinition(name) as Class;
to get the object's constructor and then create the instance of my modules class.thus make compile ignore my module classes ,because they are not related from my main class.how to force else classes also compiled into my swf or swc file? i didn't find where i can adjust my compile option.
by now i use this way to solve my problem,at the very beginning of the program entry.
if(1+1==3){
//never be run but do make classes merge into swf files.
new MyModule();
}
i have hundreds of modules like this one,i do hope i can find a way to solve this problem permanently
You can try with this
package
{
public class IncludeClasses
{
import com.abc.db.Database;Database;
import com.abc.logs.RemoteLogTarget; RemoteLogTarget;
import com.abc.logs.LocalLogTarget; LocalLogTarget;
import com.abc.exception.GlobalExceptionHandler; GlobalExceptionHandler;
import com.abc.utils.NetConnectionMonitor;NetConnectionMonitor;
}
}
You need to use the class to get it to compile in the swf.
Not the best method but
private var someVar:someClass;
Using the "new" keyword will cause the run-time to allocate memory for the object so you don't want to use that.
This whole loading modules and compiling classes has a code smell to it.
You would be better off having your classes in the modules implement an interface.
You need at least one strict reference to your class to appear within the project. I use a static variable of type Array to stuff all of the classes I need, and never really reference that array, if I can.
private static var dummy:Array=[OneClass, AnotherClass, Class01, Etc];
You can also do this by setting your compiler flag.
About the application compiler options
See:
include-libraries library [...]
Include only classes that are inheritance dependencies of classes that
are included with the include-classes compiler option.
The default value is false.
This is an advanced option. You might use this compiler option if you
are creating a custom RSL and want to externalize as many classes as
possible. For example:
compc -include-classes mx.collections.ListCollectionView
-include-inheritance-dependencies-only=true
-source-path . -output lcv2 -directory
I'm trying to build a simple sample project using FlashDevelop using Flash 11.2. For some reason it wont let me extend Sprite. When I try to compile it just says:
col: 31 Error: The definition of base class Sprite was not found.
All I have in my code is:
public class Game extends Sprite
{
}
Make sure that you have the following setup in your Flex SDK installation correctly:
\frameworks\libs\player\11.2\playerglobal.swc
and that you have a compiler constant called "swf-version=15" set in FD.
If that doesn't solve it, you have an ambiguous path to your libs. May they have spaces or special characters in them.
Did you import the right package? flash.display.Sprite
You put starling-framework as a tag so if you're using Starling it should be:
import starling.display.Sprite;
I am trying to build a Flex project with flash builder 4.6. This project should be fully functional because it has been built before, however I am getting a lot of build errors involving "CONFIG"
The error:
"Access of undefined property LOGGING."
CONFIG::LOGGING
{
import org.osmf.logging.Logger;
}
To be honest I am a ActionScript noob, so I am not sure what to call this snip of code. Although it looks like a namespace or a struct I suspect its a configuration option. How so I define this property LOGGING? Why would it be missing?
It sounds like you're missing a compiler argument that adds conditional compilation. Check out the docs.
Basically, you'll need to add something like this:
-define=CONFIG::LOGGING,true
to your compiler string.