开发者

Flash IDE Project ActionScript 3 To Flex: How to convert?

开发者 https://www.devze.com 2023-01-31 17:04 出处:网络
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).

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:

  1. Get the FlashPlayer 10 AS3 libraries. They are a part of Flex SDK, which you can download from Adobe for free.
  2. Create a Flash 9 AS3 document.
  3. Add the libraries to your classpath, instead of the default ones.
  4. Use FileReference.save in your program.
  5. Deploy to FP 9. Ignore compiler warnings, if any.
  6. Open the SWF in a hex editor.
  7. Change the 4th byte from 09 to 0A (his indicates the version number).
  8. Save the SWF.
  9. Open your SWF in Flash Player 10 - everything should work.

(Most of these hints are from ZEROSEVEN's german page).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号