Is it possible to read (and possibly change) the sources of files in the main flash class?

I would like to read the source of the class flash.net.FileReference . Is it possible? Where can I find the source files, they come with Adobe Flash or Flash Builder?

+7
source share
3 answers

To read the flash files, you can find playerglobal.swc - change the name to playerglobal.zip and unzip the package. Then decompile the library.swf file and get the script files. Here is what I found for FileReference:

 //FileReference package flash.net { import flash.events.*; import flash.utils.*; public class FileReference extends flash.events.EventDispatcher { public function FileReference() { super(); return; } public function upload(arg1:flash.net.URLRequest, arg2:String="Filedata", arg3:Boolean=false):void { } private function _load(arg1:flash.utils.ByteArray):void { } public function load():void { this._load(new ByteArray()); return; } public function get size():uint { } public function get type():String { } public function browse(arg1:Array=null):Boolean { } public function get name():String { } public function get creator():String { } public function get creationDate():Date { } public function download(arg1:flash.net.URLRequest, arg2:String=null):void { } public function get modificationDate():Date { } public function get data():flash.utils.ByteArray { } public function cancel():void { } private function _save(arg1:flash.utils.ByteArray, arg2:String):void { } public function save(arg1:*, arg2:String=null):void { var defaultFileName:String=null; var data:*; var d:flash.utils.ByteArray; var loc1:*; data = arg1; defaultFileName = arg2; d = new ByteArray(); if (data == null) { throw new ArgumentError("data"); } if (data is String) { d.writeUTFBytes(data as String); } else if (data is XML) { d.writeUTFBytes((data as XML).toXMLString()); } else if (data is ByteArray) { d.writeBytes(data as ByteArray); } else { try { d.writeUTFBytes(data); } catch (e:Error) { throw new ArgumentError("data"); } } d.position = 0; if (defaultFileName == null) { defaultFileName = ""; } this._save(d, defaultFileName); return; } } } 

I highly recommend not changing this file and rather expanding it and overriding the functions that need to be changed. Otherwise, you will need to recompile library.swf and create a custom playerglobal.swc.

+6
source

As already mentioned, you can see the sources for the Flash and Flex framework classes. The exact location will vary.

For Flash CS4 on Windows 7:

C:\Users\<your_user>\AppData\Local\Adobe\Flash CS4\en\Configuration

For Flex:

...\flex_sdk\frameworks\projects\framework\src

You can change any frame class you want if you are careful. In the Flash nomenclature, this is called Monkey Patching. Create a class in your project with the same complete package structure and class name as the framework class, and the compiler will find and use your own class instead of the framework class.

There are several complications when working with the RSL framework. To do this, see here:

How to clear Monkey when using Flex RSL

http://blogs.adobe.com/dloverin/2010/01/how_to_monkey_patch_when_using_flex_rsls.html

This does not apply to inline or "inner" classes. They are built into the player and will, until they have a stub code in the above sources. You cannot change inner classes.

+3
source

Any of the "material" available to you for viewing is (for Win7 anyway) located in C:\Users\<your_user>\AppData\Local\Adobe\Flash CS4\en\Configuration

Part of Flash CS4 may vary depending on the version you have. Classes are located in the Classes folder inside the configuration.

0
source

All Articles