Problem modulating action script project - apache-flex

I am refactoring a hugh action script solution in Flash builder (beta 2) using the flex 4 sdk.
The project does NOT use the mx framework.
What i want to have is:
A big 'MAIN' project
several small 'MODULE' projects. each 'MODULE' class refrences the 'MAIN' project as an External reference (doesnt compile into swf) - this is done by setting link type = external in the 'MODULE' project properties -> library path.
'MAIN' loads a 'MODULE' project on runtime using the 'loader' class.
the problem:
I recieve an error from the MODULE project:
VerifyError: Error #1014: Class [some class in MAIN] could not be found.
PLEASE HELP!

Check which application domain you are loading your module into. The app domain needs to be able to access the class you have externalised or you'll get that error.

It might just be a bug with the beta version of the sdk. It seems like the import of a class in a module created in another project doesn't force it's inclusion in the main swf.
try putting a dummy dependency in you main application class, like:
private var forcedImports:Array = [MyClass];
It fixed some of my problems before.

Related

VerifyError: Error #1014: Class mx.controls.advancedDataGridClasses::AdvancedDataGridRendererProvider could not be found

I am porting over a Flex application from 4.1 to 4.5 and have run into some issues with the AdvancedDataGrid classes being found. The application compiles ok under 4.5.1 but at runtime I get the following error:
VerifyError: Error #1014: Class mx.controls.advancedDataGridClasses::AdvancedDataGridRendererProvider could not be found.
It appears that what was the old datavisualization.swc was divided into to libraries (advancedgrids_4.5.21328.swf and charts_4.5.21328.swf) both of which are present in my project. is there anything in the configuration that I need to update?
I am currently using Eclipse Java EE IDE for Web Developers (Helios Service Release 1)
Many thanks,
Ian
Verify error really means that there's something wrong with versions of classes you are trying to access at runtime.
First of all, you can try plaing with 'merged/rsl' settings. Second, you can double-check your includes or try to build your app outside ide, with ant task, for example.
You will have to merge your libraries into code. This might be helpful -
VerifyError: Error #1014: class could not be found

Class mx.core::DesignLayer could not be found

I am trying to run my Flex project, however on runtime I get the error:
VerifyError: Error #1014: Class mx.core::DesignLayer could not be found
So I have added an import statement for the Design layer class: import mx.core.DesignLayer, and now I get the error on compile:
Definition mx.core::DesignLayer could not be found
What is DesignLayer? Why it could not be found even tough I import it?
Thanks.
You are probably building new functionality with an old SDK. Or perhaps you are reusing a third-party component that was built with a newer SDK inside you application built with an older SDK.
In either event the DesignLayer class was introduced in Flex version 4, as stated in the docs. So if you're building your application with some flavor of Flex 3, it makes sense the DesignLayer class can't be found, simply because it isn't there.
Go have a look in the framework's source code at [sdk-path]\frameworks\projects\framework\src\mx\core. In Flex 4+ you'll find the file DesignLayer.as there. Not so in Flex 3.

javaFX 2.0 XYChart and CSS

I am new to JavaFX 2.0 and to do practice I have followed the Oracle example about Line Chart (Stock Monitoring)
http://docs.oracle.com/javafx/2.0/charts/line-chart.htm#CIHGBCFI
Now I would like to ad a CSS class in the same package to modify Stroke, color, etc but I can't succed.
Searching here on StackOverflow I have found
scene.getStylesheets().add(this.getClass().getResource("linechart.css").toExternalForm());
but I still get errors
Exception in Application start method Exception in thread "main" java.lang.RuntimeException: Exception in Application start method at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
My java class name is JavaFXApplication2 and CSS class name is linechart.css
Would someone be so kind to explain me where I am wrong?
There is another nice tutorial about the CSS use with Stock Monitoring example here
http://docs.oracle.com/javafx/2.0/charts/css-styles.htm
but I do not know how to add the CSS examples to the java class
Thanks
I suspect that the css file is not being copied to the folder where the java files are compiled. Are you using an IDE? Can you add this line to your app System.out.println(this.getClass().getResource(".").toExternalForm());
and copy the css file to the folder path printed by this line.
You can build the project or copy the css file to the build path.If you using netbeans,you must build the project once after new resource file added.

How to include resource bundles in ActionScript Modules using Flex 4.1?

In the simplest of Flex Projects, create an MXML Flex Module and then load it using the ModuleManager. No problem. Create an ActionScript class that extends Module and then configure your project to compile that into a Module. Load this new module instead. The project compiles, but crashes when running with the following error:
"Error: Could not find compiled resource bundle 'containers' for locale 'en_US'."
I believe the compiler is failing to compile the required class definitions into ActionScript only module, while it succeeds for the MXML module. I can see that my skeleton MXML module is slightly larger than my ActionScript module (66KB vs. 45KB).
How can I resolve this problem (if that is indeed the issue)?
A good approach in these sort of situations is to use -keep-generated-actionscript for two projects, one with the mxml approach, and one with the actionscript approach. You can then compare the code to see what might be missing from one project, but included in another.
Have you tried adding an explicit reference to [ResourceBundle("containers")] to your ActionScript project class? The mxmlc is different to the compc compiler in behaviour for many valid reasons.
I was having this same problem when compiling a library swc. I was able to fix it by adding the following section to the projects projectName-config.xml
<include-libraries append="true">
<library>${flexlib}/locale/{locale}/framework_rb.swc</library>
</include-libraries>
This forces the compiler to include the framework resource bundle for the specified locale.
for me the issue was finding out which project - in my case a library - and which class in this library caused this behavior (I needed to realize my last changes - no info from flashbuilder). Then applying the following attribute to the class:
[ResourceBundle("containers")]
public class IpChecker {
...
That did the trick.

Warning when migratring from Flex 3 to Flex 4

I received this warning when I migrated my application from flex 3 to flex 4:
components:MyApp is a module or application that is directly referenced. This will cause components:MyApp and all of its dependencies to be linked in with modules:searchModule. Using an interface is the recommended practice to avoid this. Unknown Flex Problem
MyApp is a class which extends the Application component and in the module named "searchModule" there's this line:
var parentApp:myApp = parentApplication as MyApp;
I then use the variable myApp to call methods defined in the MyApp class from within this module.
This warning is reported 10 times because I am doing the same in other modules.
I want to fix it but I don't understand the part "this will cause its dependencies to be linked in with modules" and how would I make an interface to avoid this? And why there wasn't a warning about it in flex 3?
Thanks in advance
I'm guessing a bit, but...
The Flex Framework is one of those special Adobe-only libraries that can be cached by the Flex player. As such, with certain compile settings, the SWF from the compiler does not contain the Flex library. In lex 4, the framework is not compiled into your application SWf, resulting in significantly smaller application file size.
If you extend the Application class, which it sounds like you done, the compiler cannot count on your new "Application" being in the cached Flex Framework and therefore must compile your new class, and therefore the Application tag into your SWF. This is going to daisy chain significantly; as the Application tag does a lot of Flex Framework setup stuff.
I assume that is what the warning means in terms of dependencies.
Did you really extend Application with additional functionality? Or is "MyApp.mxml" just the name of the your main application file?
You might try this:
var parentApp:Application = parentApplication as Application;
I believe there is a FlexGlobals class introduced in Flex 4, which can also give you access to the top level Application.
In terms of using an interface. Interfaces are designed to help remove specific dependencies. You can create an interface for your new functionality of the new Application class and reference that instead.
var parentApp:myApp = parentApplication as IMyApp
Based on my interpertation of the messages you're seeing that may address the issue.
I had this error when I had Application MXML insted of Component MXML, for example.
Changed Application to Group, in referenced Component, and warning was no more.
Reason for error was, because I worked on component in separate project as application, and later copied it to main project, but I didn't change it to component.

Resources