Flash IDE Project ActionScript 3 To Flex: How to convert?
Hi I have a project which is build with Flash CS3 IDE and ActionScript 3. Now I need to integrate some feature with file refrence class. that is avail only in flex. So I want to migrate to flex(MXML)..
how is it possible?
I did some code, but doesn't work properly
ProjectFile.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete = "initApp()" >
<mx:Script>
<![CDATA[
import mx.core.UIComponent;
public function initApp():void {
var app:Applications = new Applications(this);
addChild(app);
}
]]>开发者_开发百科;
</mx:Script>
</mx:Application>
Applications.as The Applications class is called from the FLA earlier, now i need to add my base class to mxml.
package {
import com.AnotherClass;
import flash.display.*;
import flash.events.*;
public class Main extends Sprite {
public var _mystage:Stage;
public function Main() {
var app:AnotherClass= new AnotherClass(this);
addChild(app);
}
}
}
But Iam unable to load the Applicatios class object on the MXML.
Of course you can use FileReference.save
without deploying AIR content and/or porting to Flex. The only problem is: FileReference.save
is available in Flash Player 10 or greater, but CS3 will deploy only up to Flash Player 9.
It turns out you can still do it, but it's a bit messy, and you have to use a little hack:
- Get the FlashPlayer 10 AS3 libraries. They are a part of Flex SDK, which you can download from Adobe for free.
- Create a Flash 9 AS3 document.
- Add the libraries to your classpath, instead of the default ones.
- Use
FileReference.save
in your program. - Deploy to FP 9. Ignore compiler warnings, if any.
- Open the SWF in a hex editor.
- Change the 4th byte from 09 to 0A (his indicates the version number).
- Save the SWF.
- Open your SWF in Flash Player 10 - everything should work.
(Most of these hints are from ZEROSEVEN's german page).
精彩评论