Optimize SWC
I am creating an SWC library that I like to distribute to a third party developer. And I like to optimize the SWC beforehand so that even if the other developer fail to optimize his/her final SWF, my library will still perform at maximum efficiency.
I manage to remove the debug information using debug=false as a compiler argument. Next I try to merge the dozens of doABC tags together to make the library smaller. Unfortunately, the Flash Builder 4 refuses to load the optimized SWC if I merge the doABC tags together.
I am wondering if this is by design or if I am not doing this right. Can I merge the doABC tags together in a traditional SWC library (not a RSL)?
You may want to simply consider DRM. Here's a couple links to check out:
Adobe docs:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fla sh/net/drm/DRMManager.html
Adobe usage info:
http://help.adobe.com/en_US/as3/dev/WSe3d2d52902616553-41317b6911d1b4b fb29-8000.html
Aside that, images are just binary data so you're free to encrypt them with something fast like RC4 using a library, for example:
https://code.google.com/p/as3crypto/
Ultimately If someone REALLY wants your content, there's no 100% hackproof way. I'd implement a reasonable attempt at DRM or encryption but really measure it against the performance hit you'll take to do so, along with the knowledge that you truely can't guarantee protection anyhow.
Similar Messages
-
Flex sdk incremental build will lose swc information
I have a mxmlc ant task job like this
<mxmlc
file="${trunk_dir}/main/src/main.mxml"
output="${local_tmp}/app/bin/main.swf"
>
<load-config filename="${basedir}/flex-config-sea.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
</mxmlc>
in flex-config-sea.xml I put this in for incremental compile and swc build
<include-libraries>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/Mate_08_9.swc</library>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/xprogress.swc</library>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/component.swc</library>
</include-libraries>
<incremental>true</incremental>
the first time build is ok, but the second time after I changed one single file, the output is
[mxmlc] Loading configuration file /opt/cruisecontrol-bin-2.8.4/projects/cc/flex-config-sea.xml
[mxmlc] Recompile: /opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/src/C.as
[mxmlc] Reason: The source file or one of the included files has been updated.
[mxmlc] Files changed: 1 Files affected: 0
[mxmlc] Required RSLs:
[mxmlc] textLayout_2.0.0.232.swz with 1 failover.
[mxmlc] framework_4.6.0.23201.swz with 1 failover.
[mxmlc] rpc_4.6.0.23201.swz with 1 failover.
[mxmlc] mx_4.6.0.23201.swz with 1 failover.
[mxmlc] spark_4.6.0.23201.swz with 1 failover.
[mxmlc] sparkskins_4.6.0.23201.swz with 1 failover.
[mxmlc] /tmp/sea_local/app/bin/main.swf (426617 bytes)
but the output swf is complaining lack of some swc when running, which didn't show up in the first time
ReferenceError: Error #1065: Variable _shared_maps_GlobalMapWatcherSetupUtil is not defined.
at global/flash.utils::getDefinitionByName()
at shared.maps::GlobalMap()
at main/_main_GlobalMap1_i()
at main()
at _main_mx_managers_SystemManager/create()
at mx.managers.systemClasses::ChildManager/initializeTopLevelWindow()
at mx.managers::SystemManager/initializeTopLevelWindow()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::kickOff()
at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::preloader_completeHandler()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.preloaders::Preloader/timerHandler()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
this message normally shows up when there's no Mate_08_9.swc found at runtime. but this shouldn't happen.
is there anyway to work around this? thanks a lot
here is the full flex-config-sea.xml:
<flex-config>
<!-- benchmark: output performance benchmark-->
<!-- benchmark usage:
<benchmark>boolean</benchmark>
-->
<compiler>
<!-- compiler.accessible: generate an accessible SWF-->
<accessible>true</accessible>
<!-- compiler.actionscript-file-encoding: specifies actionscript file encoding. If there is no BOM in the AS3 source files, the compiler will use this file encoding.-->
<!-- compiler.actionscript-file-encoding usage:
<actionscript-file-encoding>string</actionscript-file-encoding>
-->
<!-- compiler.allow-source-path-overlap: checks if a source-path entry is a subdirectory of another source-path entry. It helps make the package names of MXML components unambiguous.-->
<allow-source-path-overlap>false</allow-source-path-overlap>
<!-- compiler.as3: use the ActionScript 3 class based object model for greater performance and better error reporting. In the class based object model most built-in functions are implemented as fixed methods of classes.-->
<as3>true</as3>
<!-- compiler.compress usage:
<compress>boolean</compress>
-->
<!-- compiler.context-root: path to replace {context.root} tokens for service channel endpoints-->
<!-- compiler.context-root usage:
<context-root>context-path</context-root>
-->
<!-- compiler.debug: generates a movie that is suitable for debugging-->
<debug>false</debug>
<!-- compiler.defaults-css-files usage:
<defaults-css-files>
<filename>string</filename>
<filename>string</filename>
</defaults-css-files>
-->
<!-- compiler.defaults-css-url: defines the location of the default style sheet. Setting this option overrides the implicit use of the defaults.css style sheet in the framework.swc file.-->
<!-- compiler.defaults-css-url usage:
<defaults-css-url>string</defaults-css-url>
-->
<!-- compiler.define: define a global AS3 conditional compilation definition, e.g. -define=CONFIG::debugging,true or -define+=CONFIG::debugging,true (to append to existing definitions in flex-config.xml) -->
<!-- compiler.define usage:
<define>
<name>string</name>
<value>string</value>
<value>string</value>
</define>
-->
<!-- compiler.enable-runtime-design-layers usage:
<enable-runtime-design-layers>boolean</enable-runtime-design-layers>
-->
<!-- compiler.es: use the ECMAScript edition 3 prototype based object model to allow dynamic overriding of prototype properties. In the prototype based object model built-in functions are implemented as dynamic properties of prototype objects.-->
<es>false</es>
<extensions>
<!-- compiler.extensions.extension usage:
<extension>
<extension>string</extension>
<parameters>string</parameters>
</extension>
-->
</extensions>
<!-- compiler.external-library-path: list of SWC files or directories to compile against but to omit from linking-->
<external-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/player/11.1/playerglobal.swc</path-element>
</external-library-path>
<fonts>
<!-- compiler.fonts.advanced-anti-aliasing: enables advanced anti-aliasing for embedded fonts, which provides greater clarity for small fonts.-->
<advanced-anti-aliasing>true</advanced-anti-aliasing>
<!-- compiler.fonts.flash-type: enables FlashType for embedded fonts, which provides greater clarity for small fonts.-->
<!-- compiler.fonts.flash-type usage:
<flash-type>boolean</flash-type>
-->
<languages>
<!-- compiler.fonts.languages.language-range: a range to restrict the number of font glyphs embedded into the SWF-->
<!-- compiler.fonts.languages.language-range usage:
<language-range>
<lang>string</lang>
<range>string</range>
<range>string</range>
</language-range>
-->
</languages>
<!-- compiler.fonts.local-font-paths usage:
<local-font-paths>
<path-element>string</path-element>
<path-element>string</path-element>
</local-font-paths>
-->
<!-- compiler.fonts.local-fonts-snapshot: File containing system font data produced by flex2.tools.FontSnapshot.-->
<!-- compiler.fonts.managers: Compiler font manager classes, in policy resolution order-->
<managers>
<manager-class>flash.fonts.JREFontManager</manager-class>
<manager-class>flash.fonts.BatikFontManager</manager-class>
<manager-class>flash.fonts.AFEFontManager</manager-class>
<manager-class>flash.fonts.CFFFontManager</manager-class>
</managers>
<!-- compiler.fonts.max-cached-fonts: sets the maximum number of fonts to keep in the server cache. The default value is 20.-->
<max-cached-fonts>20</max-cached-fonts>
<!-- compiler.fonts.max-glyphs-per-face: sets the maximum number of character glyph-outlines to keep in the server cache for each font face. The default value is 1000.-->
<max-glyphs-per-face>1000</max-glyphs-per-face>
</fonts>
<!-- compiler.headless-server: a flag to set when Flex is running on a server without a display-->
<!-- compiler.headless-server usage:
<headless-server>boolean</headless-server>
-->
<!-- compiler.include-libraries: a list of libraries (SWCs) to completely include in the SWF-->
<!-- compiler.include-libraries usage:
<include-libraries>
<library>string</library>
<library>string</library>
</include-libraries>
-->
<include-libraries>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/Mate_08_9.swc</library>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/xprogress.swc</library>
<library>/opt/cruisecontrol-bin-2.8.4/projects/sea_client/trunk/main/libs/component.swc</library>
</include-libraries>
<!-- compiler.incremental: enables incremental compilation-->
<!-- compiler.incremental usage:
<incremental>boolean</incremental>
-->
<incremental>true</incremental>
<!-- compiler.isolate-styles: enables the compiled application or module to set styles that only affect itself and its children-->
<!-- compiler.isolate-styles usage:
<isolate-styles>boolean</isolate-styles>
-->
<!-- compiler.keep-all-type-selectors: disables the pruning of unused CSS type selectors-->
<!-- compiler.keep-all-type-selectors usage:
<keep-all-type-selectors>boolean</keep-all-type-selectors>
-->
<!-- compiler.keep-as3-metadata: keep the specified metadata in the SWF-->
<!-- compiler.keep-as3-metadata usage:
<keep-as3-metadata>
<name>string</name>
<name>string</name>
</keep-as3-metadata>
-->
<!-- compiler.keep-generated-actionscript: save temporary source files generated during MXML compilation-->
<keep-generated-actionscript>false</keep-generated-actionscript>
<!-- compiler.library-path: list of SWC files or directories that contain SWC files-->
<library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/flash-integration.swc</path-element>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/authoringsupport.swc</path-element>
<path-element>/opt/flexsdk/4.6.0/frameworks/locale/{locale}</path-element>
</library-path>
<!-- compiler.locale: specifies the locale for internationalization-->
<locale>
<locale-element>en_US</locale-element>
</locale>
<!-- compiler.minimum-supported-version usage:
<minimum-supported-version>string</minimum-supported-version>
-->
<!-- compiler.mobile: specifies the target runtime is a mobile device-->
<mobile>false</mobile>
<mxml>
<!-- compiler.mxml.compatibility-version: specifies a compatibility version. e.g. -compatibility-version=2.0.1-->
<!-- compiler.mxml.compatibility-version usage:
<compatibility-version>version</compatibility-version>
-->
<!-- compiler.mxml.minimum-supported-version usage:
<minimum-supported-version>string</minimum-supported-version>
-->
<!-- compiler.mxml.qualified-type-selectors usage:
<qualified-type-selectors>boolean</qualified-type-selectors>
-->
</mxml>
<namespaces>
<!-- compiler.namespaces.namespace: Specify a URI to associate with a manifest of components for use as MXML elements-->
<namespace>
<uri>http://ns.adobe.com/mxml/2009</uri>
<manifest>/opt/flexsdk/4.6.0/frameworks/mxml-2009-manifest.xml</manifest>
</namespace>
<namespace>
<uri>library://ns.adobe.com/flex/spark</uri>
<manifest>/opt/flexsdk/4.6.0/frameworks/spark-manifest.xml</manifest>
</namespace>
<namespace>
<uri>library://ns.adobe.com/flex/mx</uri>
<manifest>/opt/flexsdk/4.6.0/frameworks/mx-manifest.xml</manifest>
</namespace>
<namespace>
<uri>http://www.adobe.com/2006/mxml</uri>
<manifest>/opt/flexsdk/4.6.0/frameworks/mxml-manifest.xml</manifest>
</namespace>
</namespaces>
<!-- compiler.omit-trace-statements: toggle whether trace statements are omitted-->
<omit-trace-statements>true</omit-trace-statements>
<!-- compiler.optimize: Enable post-link SWF optimization-->
<optimize>true</optimize>
<!-- compiler.preloader: Specifies the default value for the Application's preloader attribute. If not specified, the default preloader value is mx.preloaders.SparkDownloadProgressBar when -compatibility-version >= 4.0 and mx.preloaders.DownloadProgressBar when -compatibility-version < 4.0.-->
<!-- compiler.preloader usage:
<preloader>string</preloader>
-->
<!-- compiler.report-invalid-styles-as-warnings: enables reporting of invalid styles as warnings-->
<!-- compiler.report-invalid-styles-as-warnings usage:
<report-invalid-styles-as-warnings>boolean</report-invalid-styles-as-warnings>
-->
<!-- compiler.report-missing-required-skin-parts-as-warnings: Use this option to generate a warning instead of an error when a missing required skin part is detected.-->
<!-- compiler.report-missing-required-skin-parts-as-warnings usage:
<report-missing-required-skin-parts-as-warnings>boolean</report-missing-required-skin-parts-as-warnings>
-->
<!-- compiler.services: path to Flex Data Services configuration file-->
<!-- compiler.services usage:
<services>filename</services>
-->
<!-- compiler.show-actionscript-warnings: runs the AS3 compiler in a mode that detects legal but potentially incorrect code-->
<show-actionscript-warnings>true</show-actionscript-warnings>
<!-- compiler.show-binding-warnings: toggle whether warnings generated from data binding code are displayed-->
<show-binding-warnings>true</show-binding-warnings>
<!-- compiler.show-invalid-css-property-warnings: toggle whether invalid css property warnings are reported-->
<!-- compiler.show-invalid-css-property-warnings usage:
<show-invalid-css-property-warnings>boolean</show-invalid-css-property-warnings>
-->
<!-- compiler.show-shadowed-device-font-warnings: toggles whether warnings are displayed when an embedded font name shadows a device font name-->
<show-shadowed-device-font-warnings>false</show-shadowed-device-font-warnings>
<!-- compiler.show-unused-type-selector-warnings: toggle whether warnings generated from unused CSS type selectors are displayed-->
<show-unused-type-selector-warnings>true</show-unused-type-selector-warnings>
<!-- compiler.source-path: list of path elements that form the roots of ActionScript class hierarchies-->
<source-path>
</source-path>
<!-- compiler.strict: runs the AS3 compiler in strict error checking mode.-->
<strict>true</strict>
<!-- compiler.theme: list of CSS or SWC files to apply as a theme-->
<!-- compiler.use-resource-bundle-metadata: determines whether resources bundles are included in the application.-->
<use-resource-bundle-metadata>true</use-resource-bundle-metadata>
<!-- compiler.verbose-stacktraces: save callstack information to the SWF for debugging-->
<verbose-stacktraces>false</verbose-stacktraces>
<!-- compiler.warn-array-tostring-changes: Array.toString() format has changed.-->
<warn-array-tostring-changes>false</warn-array-tostring-changes>
<!-- compiler.warn-assignment-within-conditional: Assignment within conditional.-->
<warn-assignment-within-conditional>true</warn-assignment-within-conditional>
<!-- compiler.warn-bad-array-cast: Possibly invalid Array cast operation.-->
<warn-bad-array-cast>true</warn-bad-array-cast>
<!-- compiler.warn-bad-bool-assignment: Non-Boolean value used where a Boolean value was expected.-->
<warn-bad-bool-assignment>true</warn-bad-bool-assignment>
<!-- compiler.warn-bad-date-cast: Invalid Date cast operation.-->
<warn-bad-date-cast>true</warn-bad-date-cast>
<!-- compiler.warn-bad-es3-type-method: Unknown method.-->
<warn-bad-es3-type-method>true</warn-bad-es3-type-method>
<!-- compiler.warn-bad-es3-type-prop: Unknown property.-->
<warn-bad-es3-type-prop>true</warn-bad-es3-type-prop>
<!-- compiler.warn-bad-nan-comparison: Illogical comparison with NaN. Any comparison operation involving NaN will evaluate to false because NaN != NaN.-->
<warn-bad-nan-comparison>true</warn-bad-nan-comparison>
<!-- compiler.warn-bad-null-assignment: Impossible assignment to null.-->
<warn-bad-null-assignment>true</warn-bad-null-assignment>
<!-- compiler.warn-bad-null-comparison: Illogical comparison with null.-->
<warn-bad-null-comparison>true</warn-bad-null-comparison>
<!-- compiler.warn-bad-undefined-comparison: Illogical comparison with undefined. Only untyped variables (or variables of type *) can be undefined.-->
<warn-bad-undefined-comparison>true</warn-bad-undefined-comparison>
<!-- compiler.warn-boolean-constructor-with-no-args: Boolean() with no arguments returns false in ActionScript 3.0. Boolean() returned undefined in ActionScript 2.0.-->
<warn-boolean-constructor-with-no-args>false</warn-boolean-constructor-with-no-args>
<!-- compiler.warn-changes-in-resolve: __resolve is no longer supported.-->
<warn-changes-in-resolve>false</warn-changes-in-resolve>
<!-- compiler.warn-class-is-sealed: Class is sealed. It cannot have members added to it dynamically.-->
<warn-class-is-sealed>true</warn-class-is-sealed>
<!-- compiler.warn-const-not-initialized: Constant not initialized.-->
<warn-const-not-initialized>true</warn-const-not-initialized>
<!-- compiler.warn-constructor-returns-value: Function used in new expression returns a value. Result will be what the function returns, rather than a new instance of that function.-->
<warn-constructor-returns-value>false</warn-constructor-returns-value>
<!-- compiler.warn-deprecated-event-handler-error: EventHandler was not added as a listener.-->
<warn-deprecated-event-handler-error>false</warn-deprecated-event-handler-error>
<!-- compiler.warn-deprecated-function-error: Unsupported ActionScript 2.0 function.-->
<warn-deprecated-function-error>true</warn-deprecated-function-error>
<!-- compiler.warn-deprecated-property-error: Unsupported ActionScript 2.0 property.-->
<warn-deprecated-property-error>true</warn-deprecated-property-error>
<!-- compiler.warn-duplicate-argument-names: More than one argument by the same name.-->
<warn-duplicate-argument-names>true</warn-duplicate-argument-names>
<!-- compiler.warn-duplicate-variable-def: Duplicate variable definition -->
<warn-duplicate-variable-def>true</warn-duplicate-variable-def>
<!-- compiler.warn-for-var-in-changes: ActionScript 3.0 iterates over an object's properties within a "for x in target" statement in random order.-->
<warn-for-var-in-changes>false</warn-for-var-in-changes>
<!-- compiler.warn-import-hides-class: Importing a package by the same name as the current class will hide that class identifier in this scope.-->
<warn-import-hides-class>true</warn-import-hides-class>
<!-- compiler.warn-instance-of-changes: Use of the instanceof operator.-->
<warn-instance-of-changes>true</warn-instance-of-changes>
<!-- compiler.warn-internal-error: Internal error in compiler.-->
<warn-internal-error>true</warn-internal-error>
<!-- compiler.warn-level-not-supported: _level is no longer supported. For more information, see the flash.display package.-->
<warn-level-not-supported>true</warn-level-not-supported>
<!-- compiler.warn-missing-namespace-decl: Missing namespace declaration (e.g. variable is not defined to be public, private, etc.).-->
<warn-missing-namespace-decl>true</warn-missing-namespace-decl>
<!-- compiler.warn-negative-uint-literal: Negative value will become a large positive value when assigned to a uint data type.-->
<warn-negative-uint-literal>true</warn-negative-uint-literal>
<!-- compiler.warn-no-constructor: Missing constructor.-->
<warn-no-constructor>false</warn-no-constructor>
<!-- compiler.warn-no-explicit-super-call-in-constructor: The super() statement was not called within the constructor.-->
<warn-no-explicit-super-call-in-constructor>false</warn-no-explicit-super-call-in-constructor>
<!-- compiler.warn-no-type-decl: Missing type declaration.-->
<warn-no-type-decl>true</warn-no-type-decl>
<!-- compiler.warn-number-from-string-changes: In ActionScript 3.0, white space is ignored and '' returns 0. Number() returns NaN in ActionScript 2.0 when the parameter is '' or contains white space.-->
<warn-number-from-string-changes>false</warn-number-from-string-changes>
<!-- compiler.warn-scoping-change-in-this: Change in scoping for the this keyword. Class methods extracted from an instance of a class will always resolve this back to that instance. In ActionScript 2.0 this is looked up dynamically based on where the method is invoked from.-->
<warn-scoping-change-in-this>false</warn-scoping-change-in-this>
<!-- compiler.warn-slow-text-field-addition: Inefficient use of += on a TextField.-->
<warn-slow-text-field-addition>true</warn-slow-text-field-addition>
<!-- compiler.warn-unlikely-function-value: Possible missing parentheses.-->
<warn-unlikely-function-value>true</warn-unlikely-function-value>
<!-- compiler.warn-xml-class-has-changed: Possible usage of the ActionScript 2.0 XML class.-->
<warn-xml-class-has-changed>false</warn-xml-class-has-changed>
</compiler>
<!-- debug-password: the password to include in debuggable SWFs-->
<!-- debug-password usage:
<debug-password>string</debug-password>
-->
<!-- default-background-color: default background color (may be overridden by the application code)-->
<default-background-color>0xFFFFFF</default-background-color>
<!-- default-frame-rate: default frame rate to be used in the SWF.-->
<default-frame-rate>24</default-frame-rate>
<!-- default-script-limits: default script execution limits (may be overridden by root attributes)-->
<default-script-limits>
<max-recursion-depth>1000</max-recursion-depth>
<max-execution-time>60</max-execution-time>
</default-script-limits>
<!-- default-size: default application size (may be overridden by root attributes in the application)-->
<default-size>
<width>500</width>
<height>375</height>
</default-size>
<!-- externs: a list of symbols to omit from linking when building a SWF-->
<!-- externs usage:
<externs>
<symbol>string</symbol>
<symbol>string</symbol>
</externs>
-->
<frames>
<!-- frames.frame: A SWF frame label with a sequence of classnames that will be linked onto the frame.-->
<!-- frames.frame usage:
<frame>
<label>string</label>
<classname>string</classname>
</frame>
-->
</frames>
<framework>halo</framework>
<!-- include-inheritance-dependencies-only: only include inheritance dependencies of classes specified with include-classes -->
<!-- include-inheritance-dependencies-only usage:
<include-inheritance-dependencies-only>boolean</include-inheritance-dependencies-only>
-->
<!-- include-resource-bundles: a list of resource bundles to include in the output SWC-->
<!-- include-resource-bundles usage:
<include-resource-bundles>
<bundle>string</bundle>
<bundle>string</bundle>
</include-resource-bundles>
-->
<!-- includes: a list of symbols to always link in when building a SWF-->
<!-- includes usage:
<includes>
<symbol>string</symbol>
<symbol>string</symbol>
</includes>
-->
<!-- link-report: Output a XML-formatted report of all definitions linked into the application.-->
<!-- link-report usage:
<link-report>filename</link-report>
-->
<!-- load-config: load a file containing configuration options-->
<!-- load-externs: an XML file containing <def>, <pre>, and <ext> symbols to omit from linking when building a SWF-->
<!-- load-externs usage:
<load-externs>filename</load-externs>
-->
<metadata>
<!-- metadata.contributor: A contributor's name to store in the SWF metadata-->
<!-- metadata.contributor usage:
<contributor>name</contributor>
-->
<!-- metadata.creator: A creator's name to store in the SWF metadata-->
<creator>darkhutgme</creator>
<!-- metadata.date: The creation date to store in the SWF metadata-->
<!-- metadata.date usage:
<date>text</date>
-->
<!-- metadata.description: The default description to store in the SWF metadata-->
<description></description>
<!-- metadata.language: The language to store in the SWF metadata (i.e. EN, FR)-->
<language>EN</language>
<!-- metadata.localized-description: A localized RDF/XMP description to store in the SWF metadata-->
<!-- metadata.localized-description usage:
<localized-description>
<text>string</text>
<lang>string</lang>
<lang>string</lang>
</localized-description>
-->
<!-- metadata.localized-title: A localized RDF/XMP title to store in the SWF metadata-->
<!-- metadata.localized-title usage:
<localized-title>
<title>string</title>
<lang>string</lang>
<lang>string</lang>
</localized-title>
-->
<!-- metadata.publisher: A publisher's name to store in the SWF metadata-->
<publisher>darkhutgame</publisher>
<!-- metadata.title: The default title to store in the SWF metadata-->
<title>GAME</title>
</metadata>
<!-- raw-metadata: XML text to store in the SWF metadata (overrides metadata.* configuration)-->
<!-- raw-metadata usage:
<raw-metadata>text</raw-metadata>
-->
<!-- remove-unused-rsls: remove RSLs that are not being used by the application-->
<remove-unused-rsls>true</remove-unused-rsls>
<!-- resource-bundle-list: prints a list of resource bundles to a file for input to the compc compiler to create a resource bundle SWC file. -->
<!-- resource-bundle-list usage:
<resource-bundle-list>filename</resource-bundle-list>
-->
<!-- runtime-shared-libraries: a list of runtime shared library URLs to be loaded before the application starts-->
<!-- runtime-shared-libraries usage:
<runtime-shared-libraries>
<url>string</url>
<url>string</url>
</runtime-shared-libraries>
-->
<!-- runtime-shared-library-path: specifies a SWC to link against, an RSL URL to load, with an optional policy file URL and optional failover URLs -->
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/textLayout.swc</path-element>
<rsl-url>textLayout_2.0.0.232.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/osmf.swc</path-element>
<rsl-url>osmf_1.0.0.16316.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/osmf_1.0.0.16316.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/framework.swc</path-element>
<rsl-url>framework_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/framework_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/charts.swc</path-element>
<rsl-url>charts_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/charts_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/rpc.swc</path-element>
<rsl-url>rpc_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/rpc_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/mx/mx.swc</path-element>
<rsl-url>mx_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/mx_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/advancedgrids.swc</path-element>
<rsl-url>advancedgrids_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/advancedgrids_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark.swc</path-element>
<rsl-url>spark_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/spark_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark_dmv.swc</path-element>
<rsl-url>spark_dmv_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/spark_dmv_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-path>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/sparkskins.swc</path-element>
<rsl-url>sparkskins_4.6.0.23201.swz</rsl-url>
<policy-file-url></policy-file-url>
<rsl-url>http://fpdownload.adobe.com/pub/swz/flex/4.6.0.23201/sparkskins_4.6.0.23201.swz</rsl-url>
<policy-file-url>http://fpdownload.adobe.com/pub/swz/crossdomain.xml</policy-file-url>
</runtime-shared-library-path>
<runtime-shared-library-settings>
<!-- runtime-shared-library-settings.application-domain: override the application domain an RSL is loaded into. The supported values are 'current', 'default', 'parent', or 'top-level'.-->
<application-domain>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/textLayout.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/osmf.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/framework.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/charts.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/rpc.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/mx/mx.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/advancedgrids.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/spark_dmv.swc</path-element>
<application-domain-target>default</application-domain-target>
<path-element>/opt/flexsdk/4.6.0/frameworks/libs/sparkskins.swc</path-element>
<application-domain-target>default</application-domain-target>
</application-domain>
<!-- runtime-shared-library-settings.force-rsls: force an RSL to be loaded, overriding the removal caused by using the remove-unused-rsls option-->
<!-- runtime-shared-library-settings.force-rsls usage:
<force-rsls>
<path-element>string</path-element>
<path-element>string</path-element>
</force-rsls>
-->
</runtime-shared-library-settings>
<!-- size-report: Output an XML-formatted report detailing the size of all code and data linked into the application.-->
<!-- size-report usage:
<size-report>filename</size-report>
-->
<!-- static-link-runtime-shared-libraries: statically link the libraries specified by the -runtime-shared-libraries-path option.-->
<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<!-- swf-version: specifies the version of the compiled SWF file.-->
<swf-version>14</swf-version>
<!-- target-player: specifies the version of the player the application is targeting. Features requiring a later version will not be compiled into the application. The minimum value supported is "9.0.0".-->
<target-player>11.1.0</target-player>
<!-- tools-locale: specifies the locale used by the compiler when reporting errors and warnings.-->
<!-- tools-locale usage:
<tools-locale>string</tools-locale>
-->
<!-- use-direct-blit: Use hardware acceleration to blit graphics to the screen, where such acceleration is available.-->
<!-- use-direct-blit usage:
<use-direct-blit>boolean</use-direct-blit>
-->
<!-- use-gpu: Use GPU compositing features when drawing graphics, where such acceleration is available.-->
<!-- use-gpu usage:
<use-gpu>boolean</use-gpu>
-->
<!-- use-network: toggle whether the SWF is flagged for access to network resources-->
<use-network>true</use-network>
<!-- verify-digests: verifies the libraries loaded at runtime are the correct ones.-->
<verify-digests>true</verify-digests>
<!-- warnings: toggle the display of warnings-->
<!-- warnings usage:
<warnings>boolean</warnings>
-->
</flex-config>Somewhere in your pom.xml where you are configuring your build dependancies there will be a line <scope>caching</scope> this line is configuring the build to use a flex runtime shared library. This line is generating the error because caching is not a valid dependancy scope in maven 3 however mojos uses it anyway. There was a defect opened against flexmojos; I've linked it below. Froeder's response to the issue was that it was not fixable, that the warning is expected and that we'll have to live with it for now.
https://issues.sonatype.org/browse/FLEXMOJOS-363?page=com.atlassian.jira.plugin.system.iss uetabpanels%3Achangehistory-tabpanel -
How to include a SWC using custom Console?
Currently, it appears as if it is not possible to include an external SWC for use in a custom Console implementation.
For instance, assume that I have a SWC: Foo.swc that contains the class
com.test::Foo
I also have a custom com.adobe.flascc.Console implementation which imports and uses com.test.Foo from the Foo.swc library.
I've managed to get my SWF to compile without a problem, but I get the following run-time error:
VerifyError: Error #1014: Class com.test::Foo could not be found.
Here's how I've setup the compile:
CCC:=$(FLASCC)/usr/bin/g++
Console.abc:
$(ASC) -merge -md -abcfuture -AS3 -optimize -strict \
-import $(call nativepath,$(FLASCC)/usr/lib/builtin.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/playerglobal.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/BinaryData.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/ISpecialFile.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/IBackingStore.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/IVFS.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/InMemoryBackingStore.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/PlayerKernel.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/CModule.abc) \
-import $(call nativepath,$(FLASCC)/usr/lib/C_Run.abc) \
-li $(call nativepath,./aslibs/Foo.swc) \
-le $(call nativepath,./aslibs/framework.swc) \
Console.as -outdir . -out Console
test.swf: Console.abc
$(CCC) -jvmopt=$(JVMARGS) -Wall -g -O0 -fno-exceptions -o test.swf \
main.cpp \
-lAS3++ \
-fllvm-llc-opt=-ascopt=-li \
-fllvm-llc-opt=-ascopt=$(call nativepath,./aslibs/Foo.swc) \
-fllvm-llc-opt=-ascopt=-le \
-fllvm-llc-opt=-ascopt=$(call nativepath,./aslibs/framework.swc) \
-symbol-abc=Console.abc \
-emit-swf \
-swf-size=800x600
I've also attempted adding -no-swf-preloader assuming that the problem was linkage in the first frame, but this did not work either.
If I only use asc2.jar to generate a SWF (using the -li and -le options), it works, but I need access to the libraries via flascc Console.
Any ideas?
Regards,
Matt BoltThanks for the response and the suggested work-around! This solution worked exactly as you described and was precisely the result I was looking for.
--- Some Follow Up Ranting and Questions ---
Was the behavior I mentioned in my previous post a bug? It seems like the issue may be due to the following:
* Compiling .as to .abc referencing a swc will simply refer to the contents of the swc to resolve external references and there's nothing in the abc itself referring to the external library (Could be way off here).
* Compiling .as to .swf will resolve fully.
* Because we compile Console to abc first, we lose the ability to resolve external references before going to SWF.
If the above statements are correct, then -li and -le behave identically when compiling to .abc, and the behavior mentioned in my previous post would make sense.
What is strange to me is that the ASC provides a way to compile to .abc but no way to link .abc and output a swf. Perhaps it's because of the loss of data that occurs (full resolution tracks dependencies in memory).
I'm not sure that what I'm claiming is even remotely close to the truth, but it seems accurate based on my observations. If anyone knows for sure, please feel free to set me straight. -
Inline functions in C, gcc optimization and floating point arithmetic issues
For several days I really have become a fan of Alchemy. But after intensive testing I have found several issues which I'd like to solve but I can't without any help.
So...I'm porting an old game console emulator written by me in ANSI C. The code is working on both gcc and VisualStudio without any modification or crosscompile macros. The only platform code is the audio and video output which is out of scope, because I have ported audio and video witin AS3.
Here are the issues:
1. Inline functions - Having only a single inline function makes the code working incorrectly (although not crashing) even if any optimization is enabled or not (-O0 or O3). My current workarround is converting the inline functions to macros which achieves the same effect. Any ideas why inline functions break the code?
2. Compiler optimizations - well, my project consists of many C files one of which is called flash.c and it contains the main and exported functions. I build the project as follows:
gcc -c flash.c -O0 -o flash.o //Please note the -O0 option!!!
gcc -c file1.c -O3 -o file1.o
gcc -c file2.c -O3 -o file2.o
... and so on
gcc *.o -swc -O0 -o emu.swc //Please note the -O0 option again!!!
mxmlc.exe -library-path+=emu.swc --target-player=10.0.0 Emu.as
or file in $( ls *.o ) //Removes the obj files
do
rm $file
done
If I define any option different from -O0 in gcc -c flash.c -O0 -o flash.o the program stops working correctly exactly as in the inline funtions code (but still does not crash or prints any errors in debug). flash has 4 static functions to be exported to AS3 and the main function. Do you know why?
If I define any option different from -O0 in gcc *.o -swc -O0 -o emu.swc the program stops working correctly exactly as above, but if I specify -O1, -O2 or O3 the SWC file gets smaller up to 2x for O3. Why? Is there a method to optimize all the obj files except flash.o because I suspect a similar issue as when compilling it?
3. Flating point issues - this is the worst one. My code is mainly based on integer arithmetic but on 1-2 places it requires flating point arithmetic. One of them is the conversion of 16-bit 44.1 Khz sound buffer to a float buffer with same sample rate but with samples in the range from -1.0 to 1.0.
My code:
void audio_prepare_as()
uint32 i;
for(i=0;i<audioSamples;i+=2)
audiobuffer[i] = (float)snd.buffer[i]/32768;
audiobuffer[i+1] = (float)snd.buffer[i+1]/32768;
My audio playback is working perfectly. But not if using the above conversion and I have inspected the float numbers - all incorrect and invalid. I tried other code with simple floats - same story. As if alchemy refuses to work with floats. What is wrong? I have another lace whre I must resize the framebuffer and there I have a float involved - same crap. Please help me?
Found the floating point problem: audiobuffer is written to a ByteArray and then used in AS. But C floats are obviously not the same as those in AS3. Now the floating point is resolved.
The optimization issues remain! I really need to speed up my code.
Thank you in advice!Dear Bernd,
I am still unable to run the optimizations and turn on the inline functions. None of the inline functions contain any stdli function just pure asignments, reads, simple arithmetic and bitwise operations.
In fact, the file containing the main function and those functions for export in AS3 did have memset and memcpy. I tried your suggestion and put the code above the functions calling memset and memcpy. It did not work soe I put the code in a header which is included topmost in each C file. The only system header I use is malloc.h and it is included topmost. In other C file I use pow, sin and log10 from math.h but I removed it and made the same thing:
//shared.h
#ifndef _SHARED_H_
#define _SHARED_H_
#include <malloc.h>
static void * custom_memmove( void * destination, const void * source, unsigned int num ) {
void *result;
__asm__("%0 memmove(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num));
return result;
static void * custom_memcpy ( void * destination, const void * source, unsigned int num ) {
void *result;
__asm__("%0 memcpy(%1, %2, %3)\n" : "=r"(result) : "r"(destination), "r"(source), "r"(num));
return result;
static void * custom_memset ( void * ptr, int value, unsigned int num ) {
void *result;
__asm__("%0 memset(%1, %2, %3)\n" : "=r"(result) : "r"(ptr), "r"(value), "r"(num));
return result;
static float custom_pow(float x, int y) {
float result;
__asm__("%0 pow(%1, %2)\n" : "=r"(result) : "r"(x), "r"(y));
return result;
static double custom_sin(double x) {
double result;
__asm__("%0 sin(%1)\n" : "=r"(result) : "r"(x));
return result;
static double custom_log10(double x) {
double result;
__asm__("%0 log10(%1)\n" : "=r"(result) : "r"(x));
return result;
#define memmove custom_memmove
#define memcpy custom_memcpy
#define memset custom_memset
#define pow custom_pow
#define sin custom_sin
#define log10 custom_log10
#include "types.h"
#include "macros.h"
#include "m68k.h"
#include "z80.h"
#include "genesis.h"
#include "vdp.h"
#include "render.h"
#include "mem68k.h"
#include "memz80.h"
#include "membnk.h"
#include "memvdp.h"
#include "system.h"
#include "loadrom.h"
#include "input.h"
#include "io.h"
#include "sound.h"
#include "fm.h"
#include "sn76496.h"
#endif /* _SHARED_H_ */
It still behave the same way as if nothing was changed (works incorrectly - displays jerk which does not move, whereby the image is supposed to move)
As I am porting an emulator (Sega Mega Drive) I use manu arrays of function pointers for implementing the opcodes of the CPU's. Could this be an issue?
I did a workaround for the floating point problem but processing is very slow so I hear only bzzt bzzt but this is for now out of scope. The emulator compiled with gcc runs at 300 fps on a 1.3 GHz machine, whereby my non optimized AVM2 code compiled by alchemy produces 14 fps. The pure rendering is super fast and the problem lies in the computational power of AVM. The frame buffer and the enulation are generated in the C code and only the pixels are copied to AS3, where they are plotted in a BitmapData. On 2.0 GHz Dual core I achieved only 21 fps. Goal is 60 fps to have smooth audio and video. But this is offtopic. After all everything works (slow) without optimization, and I would somehow turn it on. Suggestions?
Here is the file with the main function:
#include "shared.h"
#include "AS3.h"
#define FRAMEBUFFER_LENGTH (320*240*4)
static uint8* framebuffer;
static uint32 audioSamples;
AS3_Val sega_rom(void* self, AS3_Val args)
int size, offset, i;
uint8 hardware;
uint8 country;
uint8 header[0x200];
uint8 *ptr;
AS3_Val length;
AS3_Val ba;
AS3_ArrayValue(args, "AS3ValType", &ba);
country = 0;
offset = 0;
length = AS3_GetS(ba, "length");
size = AS3_IntValue(length);
ptr = (uint8*)malloc(size);
AS3_SetS(ba, "position", AS3_Int(0));
AS3_ByteArray_readBytes(ptr, ba, size);
//FILE* f = fopen("boris_dump.bin", "wb");
//fwrite(ptr, size, 1, f);
//fclose(f);
if((size / 512) & 1)
size -= 512;
offset += 512;
memcpy(header, ptr, 512);
for(i = 0; i < (size / 0x4000); i += 1)
deinterleave_block(ptr + offset + (i * 0x4000));
memset(cart_rom, 0, 0x400000);
if(size > 0x400000) size = 0x400000;
memcpy(cart_rom, ptr + offset, size);
/* Free allocated file data */
free(ptr);
hardware = 0;
for (i = 0x1f0; i < 0x1ff; i++)
switch (cart_rom[i]) {
case 'U':
hardware |= 4;
break;
case 'J':
hardware |= 1;
break;
case 'E':
hardware |= 8;
break;
if (cart_rom[0x1f0] >= '1' && cart_rom[0x1f0] <= '9') {
hardware = cart_rom[0x1f0] - '0';
} else if (cart_rom[0x1f0] >= 'A' && cart_rom[0x1f0] <= 'F') {
hardware = cart_rom[0x1f0] - 'A' + 10;
if (country) hardware=country; //simple autodetect override
//From PicoDrive
if (hardware&8)
hw=0xc0; vdp_pal=1;
} // Europe
else if (hardware&4)
hw=0x80; vdp_pal=0;
} // USA
else if (hardware&2)
hw=0x40; vdp_pal=1;
} // Japan PAL
else if (hardware&1)
hw=0x00; vdp_pal=0;
} // Japan NTSC
else
hw=0x80; // USA
if (vdp_pal) {
vdp_rate = 50;
lines_per_frame = 312;
} else {
vdp_rate = 60;
lines_per_frame = 262;
/*SRAM*/
if(cart_rom[0x1b1] == 'A' && cart_rom[0x1b0] == 'R')
save_start = cart_rom[0x1b4] << 24 | cart_rom[0x1b5] << 16 |
cart_rom[0x1b6] << 8 | cart_rom[0x1b7] << 0;
save_len = cart_rom[0x1b8] << 24 | cart_rom[0x1b9] << 16 |
cart_rom[0x1ba] << 8 | cart_rom[0x1bb] << 0;
// Make sure start is even, end is odd, for alignment
// A ROM that I came across had the start and end bytes of
// the save ram the same and wouldn't work. Fix this as seen
// fit, I know it could probably use some work. [PKH]
if(save_start != save_len)
if(save_start & 1) --save_start;
if(!(save_len & 1)) ++save_len;
save_len -= (save_start - 1);
saveram = (unsigned char*)malloc(save_len);
// If save RAM does not overlap main ROM, set it active by default since
// a few games can't manage to properly switch it on/off.
if(save_start >= (unsigned)size)
save_active = 1;
else
save_start = save_len = 0;
saveram = NULL;
else
save_start = save_len = 0;
saveram = NULL;
return AS3_Int(0);
AS3_Val sega_init(void* self, AS3_Val args)
system_init();
audioSamples = (44100 / vdp_rate)*2;
framebuffer = (uint8*)malloc(FRAMEBUFFER_LENGTH);
return AS3_Int(vdp_rate);
AS3_Val sega_reset(void* self, AS3_Val args)
system_reset();
return AS3_Int(0);
AS3_Val sega_frame(void* self, AS3_Val args)
uint32 width;
uint32 height;
uint32 x, y;
uint32 di, si, r;
uint16 p;
AS3_Val fb_ba;
AS3_ArrayValue(args, "AS3ValType", &fb_ba);
system_frame(0);
AS3_SetS(fb_ba, "position", AS3_Int(0));
width = (reg[12] & 1) ? 320 : 256;
height = (reg[1] & 8) ? 240 : 224;
for(y=0;y<240;y++)
for(x=0;x<320;x++)
di = 1280*y + x<<2;
si = (y << 10) + ((x + bitmap.viewport.x) << 1);
p = *((uint16*)(bitmap.data + si));
framebuffer[di + 3] = (uint8)((p & 0x1f) << 3);
framebuffer[di + 2] = (uint8)(((p >> 5) & 0x1f) << 3);
framebuffer[di + 1] = (uint8)(((p >> 10) & 0x1f) << 3);
AS3_ByteArray_writeBytes(fb_ba, framebuffer, FRAMEBUFFER_LENGTH);
AS3_SetS(fb_ba, "position", AS3_Int(0));
r = (width << 16) | height;
return AS3_Int(r);
AS3_Val sega_audio(void* self, AS3_Val args)
AS3_Val ab_ba;
AS3_ArrayValue(args, "AS3ValType", &ab_ba);
AS3_SetS(ab_ba, "position", AS3_Int(0));
AS3_ByteArray_writeBytes(ab_ba, snd.buffer, audioSamples*sizeof(int16));
AS3_SetS(ab_ba, "position", AS3_Int(0));
return AS3_Int(0);
int main()
AS3_Val romMethod = AS3_Function(NULL, sega_rom);
AS3_Val initMethod = AS3_Function(NULL, sega_init);
AS3_Val resetMethod = AS3_Function(NULL, sega_reset);
AS3_Val frameMethod = AS3_Function(NULL, sega_frame);
AS3_Val audioMethod = AS3_Function(NULL, sega_audio);
// construct an object that holds references to the functions
AS3_Val result = AS3_Object("sega_rom: AS3ValType, sega_init: AS3ValType, sega_reset: AS3ValType, sega_frame: AS3ValType, sega_audio: AS3ValType",
romMethod, initMethod, resetMethod, frameMethod, audioMethod);
// Release
AS3_Release(romMethod);
AS3_Release(initMethod);
AS3_Release(resetMethod);
AS3_Release(frameMethod);
AS3_Release(audioMethod);
// notify that we initialized -- THIS DOES NOT RETURN!
AS3_LibInit(result);
// should never get here!
return 0; -
Hey,
I am trying to optimize a few library projects I have for deployment. I have read Optimizing RSL SWF Files and have run this command on my decompressed library swc file folder (library.swc plus catalog.xml):
optimizer -keep-as3-metadata="Bindable,Managed,ChangeEvent,NonCommittingChangeEvent,Transient" -input /path/to/swc_folder/library.swf -output /path/to/swc_folder/output.swf
It cut the swc file down in size by more than half, which is great! Still haven't used it yet, that's the next mission.
But my question is, how do I manage the assets/resource-bundles in the decompressed folder, many of which I don't want. The unix command "ls -Rla" shows all the files in the decompressed swc:
./swc_folder:
catalog.xml
library.swf
locale
mx
spark
./swc_folder/locale:
en_US
./swc_folder/locale/en_US:
base.properties
collections.properties
components.properties
controls.properties
core.properties
effects.properties
layout.properties
logging.properties
messaging.properties
rpc.properties
skins.properties
sparkEffects.properties
styles.properties
textLayout.properties
./swc_folder/mx:
controls
./swc_folder/mx/controls:
Button.png
HScrollBar.png
Image.png
List.png
SWFLoader.png
TextInput.png
Tree.png
VScrollBar.png
./swc_folder/spark:
components
./swc_folder/spark/components:
Button.png
DataGroup.png
Group.png
HGroup.png
HScrollBar.png
Label.png
List.png
Panel.png
RichEditableText.png
Scroller.png
SkinnableContainer.png
SkinnableDataContainer.png
TextArea.png
ToggleButton.png
VScrollBar.png
First, I am not using any of those pngs in my project, so how do I get rid of them? And second, for the resource bundles, if I have 5 library projects all using the same bundles (plus a few of their own), how do I extract them out of this swf/swc and make them all reference the same one, so I can cut down on size/duplication? Can't seem to find this kind of detail anywhere.
Thanks so much for your help, really looking forward to some good compression/optimization
Best,
LanceHi Lance,
The first step is understanding the difference between SWC and SWF files.
SWC files are for authoring - they contain all possible information needed by tooling and for authoring. This includes debug symbols, icons for the components panel, embedded resources, etc.
SWF files are for deployment - they only contain the minimal information needed at runtime.You can choose more information, like debug symbols and/or line information, which will affect the size of the SWF. The optimzier tool can be used to strip this extra information out of a SWF file.
RSLs are just SWF files that are loaded at runtime. SWZ files are just signed RSLs.
I would not be concerned about the size of SWC files. SWF files are a different story, and should be made as small as possible.
Hope this helps,
Glenn -
Running optimizer of custom RSL prevents digest match
For automation purposes, I am compiling an application using command line compiler, and compiling a custom library using flexbuilder 3. When I compile the entire application and copy the library.swf from the unpackaged .swc to the correct deploy location, all is well. However, when I run the command line RSL optimizer on library.swf, suddenly I get an #1001 error:
Flex Error #1001: Digest mismatch with RSL
{the URL to my library file}
Redeploy the matching RSL or relink your application with the matching library.
I've looked all over, at every bit of documentation, but can't seem to understand why running the optimizer using the same flex sdk as I use to compile the app, might invalidate the digest.
If I use compiler option -verify-digests=false then the app loads well, but since I'm also using framework RSLs, I don't want to do this for production purposes.
Please respond if you have any ideas.I have the same problem.
skin_url seems to be variable containing the path/to/a/skin. But it is not correctly filled. It is a $_SESSION variable
also i have another problem. The includes/database.php file uses $_SERVER variables to establish a db connection. These variables are also not filled (and i definitely set them in the mythweb.conf)
seems mythweb has some problems with "$_"-variables, or the php implementation or apache...i don't know
using latest php (5.5) and latest apache -
How to Best Optimize Flash site for performance (not SEO)
I am a newbie to Flash design. I have build this site for my client www.888acolyte.com
I watched a bunch of YouTube Videos on how to stracture a site and then pulled together a lot of features from different learning resources.
I loved Flash for its animation capabilities and used a lot of time line tweening in my site layout. My background has a moving blurry colorful spots animation, my pages come out and assemble themselves as animations, transitions and rollover done as animations.
All of it done via Flash's time line tweening.
As the end result site is stattering in performance rather significantly. I am not sure if it is because of the animations I have employed or because of something else?
I used JPG instead of PNGs as they take a lesser size. I used an 80 quality in them out of Photoshop.
Every JPG is scaled to 75% of its actual size as I expect the site to be bigger on some bigger screens. I set it up to "Allow Full screen"
Flash Tab Settings:
In the export options :
JPG Quality = 80
No Sound
SWF Settings:
Checked "Compress Movie"
Checked "Include Hidden Layers"
Checked "Include XMP Metada"
UnChecked "Export SWC"
HTML Tab Settings:
Dimensions: 100%
Quality: High
I looked up some resources for "how to optimise a flash site" and seems that the best one around would be from 2009: http://www.netmagazine.com/tutorials/optimise-flash-movies
There is also this "magic button" "Save and Compact", which did not seem to have much effect on the final size of an .swf file.
I hope to receive a feedback on how to properly stracture and optimize a Flash site for the best performance.
If to go into details is too complicated perhaps someone can point me to a good learning resource on the topic?If you're just needing a flash player, have you tried the JWPlayer from Longtail Video? That's what I'm using to view flash video on my site.
http://www.longtailvideo.com/players/jw-flv-player/ -
How can I optimize just the video on a project timeline?
Hi everyone,
I've been working on a 1 hour documentary using original non-optimized media, now that I'm approaching the final steps of the edit I would like to optimize all the video in the timeline, but NOT all the footage I have in the events.
I did NOT optimized my media on import: all my events and project are made up of video non-converted, just imported. I did that because I didn't have enough storage to transcode to ProRes the whole 40 hours of footage.
The folders now full of media in Final Cut Events are the "original media" ones.
Now I'll add some title, subtitles and color-correction and I want to be a little more fast. Then I'll step in the "export" zone, and I know it is much better to export from optimized media than from original media, that's why I want a 'ProRes opimized media' project timeline.
Thank you in advance to anyone with advices!Thank you Tom,
at least I know there is no need I keep on wondering "WHY?"...
This impossibility to transcote footage on timeline seem to me a big downside to this new version... I just have in mind all the options for managing media in FCP 7...
Thank you again,
always read your tips: veru useful! -
My Lenovo G770 will not boot in normal or safe mode. I usually escape out of the boot optimizer. Today I let it run and it went to the "starting windows" screen with a brief startup of the windows 7 animation...it freezes for a second, then a quick flash of the bsod, then to the "windows error recovery page" giving me the option of "starting windows normally" or "Launch Startup Repair (recommended)."
Starting Windows Normally eventually brings me back to the same place repeating what I just stated above paragraph.
When I launch the Startup Repair it "Cannot repair this computer automatically".
So I go to view advanced options for system recovery and support.
It brings me to 5 options:
Startup Repair (we already tried this above)
System Restore (unfortunately I didn't create any restore points)
System Image Recovery (unfortunately I haven't created an image to recover)
Windows Memory Diagnostic (no problems found-done several times)
Command Prompt (don't know what I can do here except for remove a bad/corrupted driver which may be the problem, but I don't know the driver name that is associated with the boot optimizer...can anyone tell me this?)
I've tried booting to safe mode in all of its incarnations and I can't even do that..it repeats the same things as stated above...windows 7 animation briefly starts then locks up, flash of bsod, then the windows error recovery page.
I've tried booting to last known good configuration (same thing occurs...brief startup of windows 7 animation, freeze, flash of bsod, then error recovery page.
The only thing that has given me any kind of result was "disabling system restart on system failure." When I do this, the BSOD doesn't flash briefly..it stays. and it gives me the error message page_fault_in_nonpaged_area.
I'm at a loss as to what to do. Not being able to boot into Safe Mode even is really frustrating. Any advice from anyone? can I remove the driver associated with the boot optimizer? If so, what is the name of the driver and where (directory) is it located?How did you resolve the issue?
I have the exactly same issue.
When I go System Image Recovery -->Select System Image-->Advanced->I can open all the drives [:Local Drive(C , LENOVO(D, Local Disk(E, Boot(X-where i think executable booting is here]. It comes with an Open prompt asking me to enter File Name with a File type: Setup Information.
I don't know which setup information and where to find it on my Drives.
Anyone know how to fix?
I was trying to re-install Win 7 from DVD but it is not executing either.
Can I boot with USB Ubuntu and Install Win 7 from there??? but how?
Need help? -
Column optimization in GUI_DOWNLOAD--Exce
Hi Experts,
I am writing an Excel file using GUI_DOWNLOAD function module. Is there any way to do column optimization in Excel file while downloading.
Thanks and regards,
VenkatHi,
There is a Complete & Very good documentation by SAP available on this URL. Please read this.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/204d1bb8-489d-2910-d0b5-cdddb3227820
Hope your query get solved.
Thanks and regards,
Ramani N -
Query optimization in Oracle 8i (tunning)
Hi everyone,
The following SQL statement use more than 15% of the CPU of the machine where it is executed. Please if somebody can help me to rewrite or hinting the query.
This is the statement:
SELECT
/*+ INDEX(APD IDX_ABAPLANI_DET_SOL) */
apd.sinonimo,
apd.sinonimo_planificacion,
apd.cod_despensa,
apd.estante_cod,
apd.correlativo_solicitud,
apd.prioridad,
apd.correlativo_det_sol,
apd.insumo_sinonimo,
apd.cantidad_solicitada,
apd.cantidad_despachada,
apd.estado,
apd.sinonimo_usuario,
apd.sinonimo_observacion,
ap.fecha_creacion,
ap.centro_resultado,
aud.nombre,
aud.a_paterno,
aud.rut,
aud.username,
cenres.cod_flex codigocr,
insumo.cod_flex insumocod,
cenres.des_flex despensa_descripcion,
cenres.des_flex crdescripcion,
insumo.des_flex insumodescripcion
FROM
aba_usuario_despachador aud,
cenres,
insumo,
aba_planificacion_detalle apd,
aba_planificacion ap
WHERE ap.sinonimo = apd.sinonimo_planificacion
AND aud.sinonimo = apd.sinonimo_usuario
AND ap.centro_resultado = cenres.sinonimo
AND insumo.sinonimo = apd.insumo_sinonimo
AND apd.sinonimo_usuario = NVL (:b1, apd.sinonimo_usuario)
AND apd.sinonimo_planificacion = NVL (:b2, apd.sinonimo_planificacion)
AND apd.correlativo_solicitud = NVL (:b3, apd.correlativo_solicitud)
AND apd.estante_cod = NVL (UPPER (:b4), apd.estante_cod)
AND apd.cod_despensa = NVL (UPPER (:b5), apd.cod_despensa)
AND apd.estado = NVL (:b6, apd.estado)
AND ap.centro_resultado = NVL (:b7, ap.centro_resultado)
AND TO_DATE (TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy'), 'dd/mm/yyyy')
BETWEEN TO_DATE (NVL (:b8,TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy')),'dd/mm/yyyy')
AND TO_DATE (NVL (:b9,TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy')),'dd/mm/yyyy')
AND apd.estado NOT LIKE :b10
ORDER BY apd.sinonimo;The version of the database is 8.1.7.4.0.
Here is the output of EXPLAIN PLAN:
Plan
SELECT STATEMENT CHOOSECost: 2,907 Bytes: 104,312 Cardinality: 472
32 SORT ORDER BY Cost: 2,907 Bytes: 104,312 Cardinality: 472
31 CONCATENATION
15 FILTER
14 NESTED LOOPS Cost: 11 Bytes: 52,156 Cardinality: 236
11 NESTED LOOPS Cost: 10 Bytes: 177 Cardinality: 1
8 NESTED LOOPS Cost: 9 Bytes: 133 Cardinality: 1
5 NESTED LOOPS Cost: 8 Bytes: 67 Cardinality: 1
2 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_PLANIFICACION_DETALLE Cost: 7 Bytes: 52 Cardinality: 1
1 INDEX FULL SCAN NON-UNIQUE ADMABA.IDX_ABAPLANI_DET_SOL Cost: 3 Cardinality: 1
4 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_PLANIFICACION Cost: 1 Bytes: 15 Cardinality: 1
3 INDEX UNIQUE SCAN UNIQUE ADMABA.PK_ABA_PLANIFICACION Cardinality: 1
7 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_USUARIO_DESPACHADOR Cost: 1 Bytes: 3,498 Cardinality: 53
6 INDEX UNIQUE SCAN UNIQUE ADMABA.ABA_USUARIO_DESPACHADOR_PK Cardinality: 53
10 TABLE ACCESS BY INDEX ROWID OPS$NUCLEO.NUC_CODIGOS_FLEXIBLES Cost: 1 Bytes: 14,828 Cardinality: 337
9 INDEX UNIQUE SCAN UNIQUE OPS$NUCLEO.NUC_CODFLEX_PK Cardinality: 337
13 TABLE ACCESS BY INDEX ROWID OPS$NUCLEO.NUC_CODIGOS_FLEXIBLES Cost: 1 Bytes: 1.037.828 Cardinality: 23,587
12 INDEX UNIQUE SCAN UNIQUE OPS$NUCLEO.NUC_CODFLEX_PK Cardinality: 23,587
30 FILTER
29 NESTED LOOPS Cost: 11 Bytes: 52,156 Cardinality: 236
26 NESTED LOOPS Cost: 10 Bytes: 177 Cardinality: 1
23 NESTED LOOPS Cost: 9 Bytes: 133 Cardinality: 1
20 NESTED LOOPS Cost: 8 Bytes: 67 Cardinality: 1
17 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_PLANIFICACION_DETALLE Cost: 7 Bytes: 52 Cardinality: 1
16 INDEX RANGE SCAN NON-UNIQUE ADMABA.IDX_ABAPLANI_DET_SOL Cost: 3 Cardinality: 1
19 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_PLANIFICACION Cost: 1 Bytes: 15 Cardinality: 1
18 INDEX UNIQUE SCAN UNIQUE ADMABA.PK_ABA_PLANIFICACION Cardinality: 1
22 TABLE ACCESS BY INDEX ROWID ADMABA.ABA_USUARIO_DESPACHADOR Cost: 1 Bytes: 3,498 Cardinality: 53
21 INDEX UNIQUE SCAN UNIQUE ADMABA.ABA_USUARIO_DESPACHADOR_PK Cardinality: 53
25 TABLE ACCESS BY INDEX ROWID OPS$NUCLEO.NUC_CODIGOS_FLEXIBLES Cost: 1 Bytes: 14,828 Cardinality: 337
24 INDEX UNIQUE SCAN UNIQUE OPS$NUCLEO.NUC_CODFLEX_PK Cardinality: 337
28 TABLE ACCESS BY INDEX ROWID OPS$NUCLEO.NUC_CODIGOS_FLEXIBLES Cost: 1 Bytes: 1.037.828 Cardinality: 23,587
27 INDEX UNIQUE SCAN UNIQUE OPS$NUCLEO.NUC_CODFLEX_PK Cardinality: 23,587 Thanks in advance!
Edited by: user491853 on 21-ago-2012 15:29A few comments looking at your sql query:
How much time the query is taking?
How many rows are there in the tables?
Make sure the stats are up-to-date.
Please kindly follow the instructions provided by others as well.
>
The version of the database is 8.1.7.4.0
>
Suggestion: Upgrade your version. Oracle Cost Based Optimizer is more smarter now.Upgrading will make your life much more easier as there are so many enhancements.
AND TO_DATE (TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy'), 'dd/mm/yyyy')
BETWEEN TO_DATE (NVL (:b8,TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy')),'dd/mm/yyyy')
AND TO_DATE (NVL (:b9,TO_CHAR (ap.fecha_creacion, 'dd/mm/yyyy')),'dd/mm/yyyy')Why are you using TO_DATE/TO_CHAR on a date column?
AND ap.centro_resultado = NVL (:b7, ap.centro_resultado)the same can be rewritten as below:
AND (ap.centro_resultado =:b7 and :b7 is not null) or :b7 is null This applies to other predicates you are using as well.
The table used in the plan is not found in your sql query eg NUC_CODIGOS_FLEXIBLES.
Regards
Biju -
Unable to optimize album art on my iPod and then display the art on my iPod
When I optimize album art it gives me an error message "unknown error (-50)"
I would like to fix that. Any pointers?get the order number from itunes account "Purchase History" & then send a mail to itunes store from following website. www.apple.com/support/itunes/ They will provide you exception to redownload because its Apple's problem
-
Help needed to optimize the query
Help needed to optimize the query:
The requirement is to select the record with max eff_date from HIST_TBL and that max eff_date should be > = '01-Jan-2007'.
This is having high cost and taking around 15mins to execute.
Can anyone help to fine-tune this??
SELECT c.H_SEC,
c.S_PAID,
c.H_PAID,
table_c.EFF_DATE
FROM MTCH_TBL c
LEFT OUTER JOIN
(SELECT b.SEC_ALIAS,
b.EFF_DATE,
b.INSTANCE
FROM HIST_TBL b
WHERE b.EFF_DATE =
(SELECT MAX (b2.EFF_DATE)
FROM HIST_TBL b2
WHERE b.SEC_ALIAS = b2.SEC_ALIAS
AND b.INSTANCE =
b2.INSTANCE
AND b2.EFF_DATE >= '01-Jan-2007')
OR b.EFF_DATE IS NULL) table_c
ON table_c.SEC_ALIAS=c.H_SEC
AND table_c.INSTANCE = 100;To start with, I would avoid scanning HIST_TBL twice.
Try this
select c.h_sec
, c.s_paid
, c.h_paid
, table_c.eff_date
from mtch_tbl c
left
join (
select sec_alias
, eff_date
, instance
from (
select sec_alias
, eff_date
, instance
, max(eff_date) over(partition by sec_alias, instance) max_eff_date
from hist_tbl b
where eff_date >= to_date('01-jan-2007', 'dd-mon-yyyy')
or eff_date is null
where eff_date = max_eff_date
or eff_date is null
) table_c
on table_c.sec_alias = c.h_sec
and table_c.instance = 100; -
How do I use a Flex swc in Flash CS3?
My engineering team has used Flex to create a nice little swc
for me to use inside of Flash CS3, but now I'm having trouble
finding any documentation on how to actually import it. Placing it
in the Components folder doesn't work, as it's not recognized by
the Components window (either as an AS2 or AS3 swc). Is it even
possible to use swcs from Flex in Flash? Thank you very much for
the help.
-- JeremyUse these links
Modular Applications
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f22.html
Creating Flex Libraries
http://help.adobe.com/en_US/Flex/4.0/UsingFlashBuilder/WS6f97d7caa66ef6eb1e63e3d11b6c4d0d2 1-7fe6.html
-Pramod
http://www.flexmycode.com -
Aggregation script is taking long time - need help on optimization
Hi All,
Currently we are working to build a BSO solution (version 11.1.2.2) for a customer where we are facing performance issue in aggregating the database. The most common activity of the solution will be to generate data on different scenario from Actual and Budget (Actual Vs Budget difference data in one scenario) and to be used for reporting purpose mainly.
We are aggregating the data to top level using AGG command for Sparse dimensions. While doing this activity, we found that it is creating a lot of page files and thereby filling up the present physical memory of the drive (to the tune of 70GB). Moreover it is taking a long time to aggregate. The no. of stored members that is present are as follows:
Dimension - Type - Stored member (Total members)
Account - Dense- 1597 (1845)
Period - Dense - 13 (19)
Year - Sparse - 11 (12)
Version - Sparse - 2 (2)
CV - Sparse- 5 (6)
Scenario - Sparse - 94 (102)
EV - Sparse - 120 (122)
FC - Sparse- 118 (121)
CP - Sparse - 1887 (2049)
M1 - Sparse - 4873 (4874)
Entity - Sparse - 12020 (32349) - Includes two alternate hierarchies for rolling up the data
The other properties are as follows:
Index Cache - 152000
Data File Cache - 32768
Data cache - 153600
ACR = 0.65
We are using Buffered I/O
The level 0 datafile is about 3 GB.( 2 year budget and 1 year 2 months Actuals data)
Customer is going to use SmartView to retrieve the data and having Planning Plus License only. So could not go for an ASO solution. We could not reduce the members of huge Sparse dimensions M1 and CP as well. To improve the data retrieval time, we had to make upper level members as stored which resolved data retrieval issue
I am seeking for help on the following:
1. How can we optimize the time taken? Currently each dimension is taking about an hour to aggregate. Calc Dim is taking even longer time. Hence opted for AGG
2. Will change of dense and sparse setting help our cause? ACR is ona lower side. Please note that most calculations are either on Period dimensions or FC. There is no such calculation on Account dimension
3. Will change of a few non-level 0 members from store to dynamic-calc help? Will this slow down calculations in the cube?
4. What should be the best performance order for this cube?
Appreciate your help in these regard,
Regards,
SukhamoyPlease provide following information
1) Block size and other statistic
2) Aggreagation script
>>Index Cache - 152000
>>Data File Cache - 32768
>>Data cache - 153600
Try this settings
Index Cache - 1120000
Data cache - 3153600
Maybe you are looking for
-
I bought Skype Premium for 1 year but I didn't rec...
I bought Skype Premium 1-year, not from this site. I buyed it, because I'm intrested of that feature but I didn't receive it. I want call to Finland from Skype. Before I bought Skype Premium 1-year, I readed that "Unlimited calls to a country/region
-
Is there any way to set password to protect the location service, to keep GPS open? so, the theft cannot turn it off so easy, because once the location service is turn off, all GPS track is useless...
-
Hi Forum! I need to include a css in my htmlb document. I write: <%@page language="abap"%> <%@extension name="htmlb" prefix="htmlb"%> <%@extension name="phtmlb" prefix="phtmlb"%> <htmlb:content design="design2003"> <htmlb:document > <htmlb:docu
-
Hi, There are three types of availabilty check: Rule based, ATP and product allocation. Can you please explain me the two except ATP that how it works? Regrads Deepak Sharma
-
I have over 8,000 photos in iPhoto and had been happy with it until now. I am unable to copy or manage my photos because I keep getting "photo is busy". This bug has me totally shutdown and I am ready to switch my photos to another program. Any sugge