I’ve been trying to set up a nice environment on Flex 4 and Flash Builder 4 by using the “code behind” philosophy on my Application tag. This has given me a silly amount of problems!
So working with this:
[LIST]
[]src
[LIST][](default package)
[LIST][]Test.mxml
[]TestBase.as[/LIST]
[*]Test-app.xml[/LIST]
[/LIST]
// TestBase.as
package {
import spark.components.WindowedApplication;
import mx.controls.Alert;
public class TestBase extends WindowedApplication {
public function TestBase() {
super();
Alert.show("hello");
}
}
}
and
<?xml version="1.0" encoding="utf-8"?>
<app:TestBase xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:app="*">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</app:TestBase>
Firstly I can’t seem to be able to put either of these two files into a package other than the default one without getting error’s about the -app.xml file.
Secondly, it seems I can’t name my class Test.as, this confuses Flex so I renamed it TestBase.as.
However, once they’ve been renamed and are both in the default package Flex wants an -app.xml file for both of them. So humouring it I created a TestBase-app.xml alongside the already existing Test-app.xml.
Only now does Flash Builder 4 not show any errors in any of the files in my project. So I move to run it and I get an alert with the error:
If the program is already running, close it before attempting to run.
I googled this error but got absolutely nothing.
I also found this, thinking it was the solution to my problem but I’m not entirely sure what the solution is.
All I want is to be able to represent the Flex Application as an AS3 class, ideally in my package structure, but I guess that’s not essential.
Anybody know what on earth is going on here?