Order Now AdSolution Sign Up | Login » Bits on the Run Sign Up | Login »

Forums

/

Yet another newb question SDL flex with mxmlc AS

No replies

Hello,
I'm completely new to this topics and I'm eager to begin learning them.

I've been looking at some turotials and so far I have downloaded and installed Flex SDK 3 in linux successfuly.

Then I started following this guide http://blog.flexcommunity.net/?p=29 but I haven't been able to find any other beginner tutorial that uses mxmlc instead of Adobe's Flex IDE or Eclipse's plug-in.

So I went into this example combining mxml and ActionScript, and while the code was embedded into the original file it does wonderfully but when it separates it in two files and tries using the custom class it gives me an error. Here is the detail:

file custom.as:

package custom
{
import mx.controls.Button;
import flash.events.MouseEvent;

public class CustomButton extends Button
{
public function CustomButton()
{
super();
}
;
override protected function clickHandler(event:MouseEvent):void{
this.x+=10;
}
}
}

file myFlexApp.mxml:

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” xmlns:custom=”custom.*” layout=”absolute”>

<custom:CustomButton id=”myBtn” x=”200″ y=”200″ label=”Button” />

</mx:Application>

I've tried compiling like this:

mxmlc myFlexApp.mxml
Loading configuration file /opt/flex-sdk/frameworks/flex-config.xml
/home/karla/flex/myFlexApp.mxml(4):  Error: Type was not found or was not a compile-time constant: CustomButton.

<custom:CustomButton id="myBtn" x="200" y="200" label="Button" />

Both files are in the same directory.
Then I thought I might been missing to compile custom.as file, and I tried to like:

mxmlc custom.as
Loading configuration file /opt/flex-sdk/frameworks/flex-config.xml
/home/karla/flex/custom.as: Error: A file found in a source-path must have the same package structure '', as the definition's package, 'custom'.

/home/karla/flex/custom.as: Error: A file found in a source-path 'custom' must have the same name as the class definition inside the file 'CustomButton'.

Then I changed the name of the file to CustomButton and it compiled by itself, but still I couldn't find the way to compile myFlexApp.mxml because my "custom" namespace wasn't there anymore.

At this point I'm feeling really confused! I would greatfully take any advice you could give me.

I hope this is the right place to post my problem and find an answer.
Thank you very much.