0
votes

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.

1
FileReference Class? That is available in the flash IDE.Zevan
but we can't save external files from IDE, I want to save some files to the local machine path where the swf located.coderex
@coderex Saving local files via the Flash Pro IDE has no relation to the FileREference class which allows you to ask the user to save files via at runtime, from the Flash Player. You should modify your question accordingly. It is hard to tell, from your small code snippets, why this isn't working.JeffryHouser
In this regard there is no functional difference between Flex and Flash IDE. Perhaps you're looking at an AIR specific API and thinking it's a Flex API. AIR API's are available to any AIR app whether it's Flex or Flash IDE, but it has to be an AIR app.Samuel Neff
@www.Flextras.com: I think you can answer this question stackoverflow.com/questions/4406599/…coderex

1 Answers

1
votes

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).