Hi !
I’m trying to compile AS3 with the free Flex SDK.
I’ve been using FlashDevelop as an editor.
Flashdevelop.org doesn’t have a tutorial posted yet to show how to do things if you are using this type of workflow.
Here’s what I’ve been doing:
-
I’ve installed the Flex SDK and Java 1.6+ which I understand the SDK needs.
-
I’ve installed FlashDevelop and followed the instructions for enabling it to use the SDK and Flashplayer 10.
-
I enter AS3 code in FlashDevelop - for example (file name is Test.as):
package
{
import flash.display.Sprite;
import flash.events.Event;
public class FirstAnimation extends flash.display.Sprite {
private var ball:Sprite;
public function FirstAnimation() {
init();
}
private function init():void {
ball = new Sprite();
addChild(ball);
ball.graphics.beginFill(0xff0000);
ball.graphics.drawCircle(0, 0, 40);
ball.graphics.endFill();
ball.x = 20;
ball.y = stage.stageHeight / 2;
ball.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onEnterFrame(event:Event):void {
}
}
}
(This code is from Keith Peters’ very wonderful AS3 Animation book.)
-
When I go to FlashDevelop/Project/Test Movie I just end up with a blank swf.
-
When I try to compile by directing Flex SDK to my AS file using the Windows command prompt like so…
C:\AS3Classes C:/Flex/bin/mxmlc.exe Test.as
…I get this error message:
Exception in thread “main” java.io.FileNotFoundException: C:\Flex\bin\mxmlc.jar
(The system cannot find the file specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(init)(Unknown Source)
at java.util.jar.JarFile.(init)(Unknown Source)
at java.util.jar.JarFile.(init)(Unknown Source)
I notice in the Flash workflow tutorial Flashdevelop.org has posted that they tell you this:
** Writing the main class **
When working with Flex you must create a main class. This will be the “entry point” of the SWF:
[LIST]
[] select the main class in the project tree,
[] right-click, select “Always compile”.
[/LIST]
package
{
import flash.display.Sprite;
import flash.events.Event;
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point
addChild(new MySymbol());
}
}
}
OK, after painting this picture, let me boil things down to a couple of questions:
-
Is that error in the command prompt because I somehow haven’t installed Java 1.6+ correctly?
-
Is that thread “main” the SDK can’t seem to find actually a Main class I need to write?
-
Am I missing some vital piece of information I need in order to set up a workflow like this?
OK, well, it’s true I AM in several fathoms over my head!
I’ve always gotten truly excellent support here, and any help anyone may offer me for this quandary is as usual, most gratefully received.
Thank you & regards,
Galland@squareheadsRus
:block: