I was tasked with integrate my Flash app with another Flex app. I must migrate my Flash Pro app to Flash Builder in order to start working. I've searched in internet and I've tried everything but I can't get my Flash Pro app to be compiled and run by Flash Builder.
My Flash Pro app consists of a .fla file with just one frame and a couple of buttons and a canvas to draw. The funcionality of the app is made by (a lot of) as3 files. The .fla file calls the Main.as file which instantiate all the classes necessary for the app tu work.
Well, I tried to publish the .swc file of my .fla and add it to the new flex project but I can't get this app running correctly. The Main class is not executed, even though I imported all the necessary .as files to my flex project.
Any ideas of how to do this migration successfully?
Thanks a lot guys!
Edited:
I put the Main.as in a .mxml file this way:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
//imports and variables declaration
function init():void
{
//my main code here
}
//other methods of the main class
]]>
</mx:Script>
</mx:Application>
And put the rest of the .as files as they were in the flash pro project. It runs ok but I had to add an .swc (any .swc generated for any symbol of the .fla file) in order to recognize some fl classes like CheckBox, ColorPicker and so. Besides, it seems that I definitely have to create the user interface again, lucky it is not so hard, but I would REALLY like to know if there is a way to convert the .fla UI to a UI in Flash Builder.
I'm now trying to migrate some custom buttons from flash pro to flash builder, and it's resulting to be a big pain in the... These buttons have icons instead of labels, and they have 3 states. The states are controlled by another .as file. How can I migrate this kind of buttons to flash builder? This is the .as code from my class CustomButton.as:
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class CustomButton extends MovieClip {
public var button_states_mc:MovieClip;
private var _selected:Boolean = false;
public function CustomButton() {
button_states_mc.stop();
this.addEventListener(MouseEvent.ROLL_OVER, mouseHandler);
this.addEventListener(MouseEvent.ROLL_OUT, mouseHandler);
}
public function set selected(v:Boolean):void {
_selected = v;
if(_selected) {
button_states_mc.gotoAndStop("selected");
} else {
button_states_mc.gotoAndStop("up");
}
}
public function get selected():Boolean {
return _selected;
}
private function mouseHandler(e:MouseEvent):void {
if(!_selected && !e.buttonDown) {
if(e.type == MouseEvent.ROLL_OVER) {
button_states_mc.gotoAndStop("over");
} else if(e.type == MouseEvent.ROLL_OUT) {
button_states_mc.gotoAndStop("up");
}
}
}
}
}
Many thanks once more, guys!!