====== MX v.2 Components Patch ====== ===== Introduction ===== Many people use the **Macromedia Flash MX V.2 Components** to create user interfaces for their flash applications. Since Open Source UI frameworks (like [[ActionStep|ActionStep]]) aren’t released yet, Flash Developers have no worthy alternative in choosing the most comfortable and functional UI library with which to satisfy all their needs. Another issue is the absence of UI builder tools for existing Open Source frameworks. Consequently, Flash developers are often forced to use Macromedia’s UI framework. However, because of the extremely poor quality of the V2 Components source code, it’s practically impossible to use it together with other open source tools. One of the most prominent issues is not being able to use MX source code with the [[MTASC|MTASC SWF compiler]]. The coding standards used in the V2 Components code are incompatible with those of **MTASC** so its parser produces numerous warning and error messages. But even updated MX code compiled with **MTASC** won’t make SWF work properly. Because of differences in class registration order and using initialization code from assets inside SWF’s library, component skins are initialized incorrectly. As a result components may be displayed only partly or not at all. So currently it is not possible to use **MTASC** to compile a SWF that uses the **Macromedia V2 Components**. **MTASC** has a special //-mx// option that allows the skipping of MX classes during SWF compilation and leaves it as is. But in practice, the inability to properly compile MX classes with **MTASC** makes its use inconvenient and seriously limits the area of its application. ===== Purpose ===== Provided patch serves for two purposes: * Makes MX sources compatible to [[http://www.powerflasher.com/fdt/flashsite/flash.htm|FDT IDE]], [[ASDT|ASDT IDE]] and [[MTASC|MTASC compiler]] syntax checkers. * Contains special fixes allowed to create correctly worked flash applications contained **MX V2 Components** using **MTASC**. So using this patch Flash Developer could feel the power and freedom of the open source development applied to **MX** solutions framework. ===== Prerequisites ===== Patch can only be applied to **MX** sources distributed with **Macromedia Flash 8**. **MX** sources published with **Flash 8** are different from sources distributed with **Flash MX 2004**. It contains missed packages like //services// and //xpath//. Also sources are updated and rewritten a little. So it made possible to patch it and makes compatible with **MTASC**. Patched **MX** sources could be used to recompile not only SWF produced by **Flash 8** but also SWF published using **Flash 2004**. Also you need to install [[ http://www.macromedia.com/software/flashremoting/downloads/components/ | Macromedia Flash Remoting MX Components ]] in order to have complete classes collection on your computer. ===== How To ===== ==== Distribution Restrictions ==== Because of **Macromedia Flash License Agreement**, it’s impossible to publish patched **MX** sources. So below you can find patch files produced by **DIFF** tool and instructions how you can apply it to your **MX** sources. ==== License Agreement ==== Copyright the original author or authors. Licensed under the **MOZILLA PUBLIC LICENSE**, Version 1.1 (the "License"); you may not use this file except in compliance with the **License**. You may obtain a copy of the **License** at http://www.mozilla.org/MPL/MPL-1.1.html Unless required by applicable law or agreed to in writing, software distributed under the **License** is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the **License** for the specific language governing permissions and limitations under the **License**. ==== Patching Tools ==== In order to apply this patch you need to download and install [[http://ant.apache.org/bindownload.cgi | ANT]] (cross-platform, requires [[http://java.sun.com/j2se/1.5.0/download.jsp | JRE]]) or get **PATCH** utility. **PATCH** utility is a standard UNIX tool. **Microsoft Windows** users could download ported version from [[http://gnuwin32.sourceforge.net/packages/patch.htm | GnuWin32]] site. For **OCX** users **PATCH** utility is available within so-called **"Developer package"**. Installation instructions could be found here: * **ANT**: http://ant.apache.org/manual/index.html * **PATCH**: http://gnuwin32.sourceforge.net/install.html ==== Download Patch ==== All patches are grouped into 3 categories: * **[[#core_7 | CORE 7]]** provides patches for **Flash MX 2004 (Flash 7)** core classes. * **[[#core_8 | CORE 8]]** provides patches for **Flash 8** core classes. * **[[#mx | MX]]** provides patches for **MX** package which is used to create both **Flash 7** and **Flash 8** applications and movies. Each category contains a set of patches allowed to update original sources to any released patched version. Also it’s possible to update some particular patched version to any subsequently released version. Below are the tables contained all released patch versions. === CORE 7 === ^ Version ^ Original ^ Subsequent ^ ^ 1.0 | [[http://prdownloads.sourceforge.net/mxpatch/core7.patch_to_1.0.zip?download | to 1.0]] | - | === CORE 8 === ^ Version ^ Original ^ Subsequent ^ ^ 1.0 | [[http://prdownloads.sourceforge.net/mxpatch/core8.patch_to_1.0.zip?download | to 1.0]] | - | === MX === ^ Version ^ Original ^ Subsequent ^ ^ 1.0 | [[http://prdownloads.sourceforge.net/mxpatch/mx.patch_to_1.0.zip?download | to 1.0]] | - | ^ 1.1 | [[http://prdownloads.sourceforge.net/mxpatch/mx.patch_to_1.1.zip?download | to 1.1]] | [[http://prdownloads.sourceforge.net/mxpatch/mx.patch_1.0_to_1.1.zip?download | 1.0 to 1.1]] | ==== Apply Patch ==== Before using patch it’s strongly recommended to **backup** your original Flash source files. Also it will be better to create local copies of the **Flash** **Core** and **MX** directories and apply patch to. Then you could edit **CLASSPATH** settings for **MMC**, **MTASC** and used **IDE** to use patched copies instead of original sources from the default location. For the various OS you could find required sources at: * **Windows**: [DISK]:\\Documents and Settings\[USERNAME]\Local Settings\Application Data\Macromedia\Flash 8\en\Configuration\Classes\ I'm not familiar very well with **UNIX** and **OCX** systems. So please [[#contacts | contact me]] to help to complete this section with Flash sources location for this OS. So, for example, create **”C:\Flash\lib\Macromedia”** folder and copy **FP7**, **FP8** and **MX** directories to. This example will be used below to illustrate how to apply patches. === Using PATCH Tool === - Copy required patch (**core7.patch**, **core8.patch**, **mx.patch**) to the **”C:\Flash\lib\Macromedia”** directory. - Run **PATCH** from the **”C:\Flash\lib\Macromedia”** directory with appropriate arguments: * for **core7** patch: **//"patch –u –p3 –d ./FP7 < core7.patch"//** * for **core8** patch: **//"patch –u –p3 –d ./FP8 < core8.patch"//** * for **mx** patch: **//"patch –u –p3 –d . < mx.patch//"** - Read the [[#Use_Patched_Sources | next section]] :-) **IMPORTANT NOTE:** Using Copy/Paste on patch execution strings can lead to patch failing with message **//patch: ûd: extra operand//**. In this case please type execution string manually. === Using ANT === Comming soon... ==== Use Patched Sources ==== You don’t need to modify your source code in order to work with patched **MX** classes. But there is one significant requirement. You need to **force** compilation of the //**mx.core.ext.UIComponentExtensions**// class into your SWF file. It could be done with 2 different ways: * Refer it from any (desirable, main) class: private static var incExt = mx.core.ext.UIComponentExtensions; * Include it to the **MTASC** command line: mtasc -cp ./src -cp C:/Flash/lib/Macromedia mx/core/ext/UIComponentExtensions -main MyMainClass And it seems that's all. Enjoy the patch! :-D ===== Contacts ===== For more detailed information, issue reports, participation proposals and etc. you could contact: * **Igor Sadovskiy** (Author): //**isadovskiy**[at]**gmail**[dot]**com**// Also you could use [[http://sourceforge.net/projects/mxpatch/ | MXPATCH]] project page at [[http://www.sf.net | SourceForge.net]] to commit [[http://sourceforge.net/tracker/?group_id=151562&atid=781358 | bugs]] and request [[http://sourceforge.net/tracker/?atid=781361&group_id=151562&func=browse | improvements]].