I have created a flex mobile as3 project that exports to air, to ipa and apk.
This project does not use any specific to mobile or air calls (camera, files. .)
my question is : how do I create a swf ?
Regards
Since your project doesn't use any AIR-specific APIs, you can use an Ant build to create a SWF from your mobile project. The following build file will do the trick if your project is self-contained as a single Flash Builder project.
<?xml version="1.0" ?>
<project name="Build" default="build">
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Adobe Flash Builder 4.7/sdks/4.6.0" />
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
<property name="PROJECT_NAME" value="MyMobileProject" />
<property name="PROJECT_BASE_DIR" value="C:/FlexProjects/${PROJECT_NAME}" />
<property name="PATH_TO_SRC_FOLDER" value="${PROJECT_BASE_DIR}/src" />
<property name="OUTPUT_DIR" value="${PROJECT_BASE_DIR}/bin" />
<target name="build">
<mxmlc file="${PATH_TO_SRC_FOLDER}/${PROJECT_NAME}.mxml"
output="${OUTPUT_DIR}/${PROJECT_NAME}.swf"
show-actionscript-warnings="false" show-binding-warnings="false"
locale="en_US" incremental="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${PATH_TO_SRC_FOLDER}" />
<external-library-path dir="${FLEX_HOME}/frameworks/libs" append="true">
<include name="*.swc" />
</external-library-path>
<compiler.library-path dir="${PROJECT_BASE_DIR}/libs" append="true" includes="*"/>
</mxmlc>
</target>
</project>
Related
I created a custom Alfresco action dialog using one of the sample SDK projects
as a base. I kept the sample projects "org.alfresco.sample" package for my java files
and it worked fine.
Then I tried to change the package name to "com.xxxxxx.xxxxx" and it stopped working.
I have checked all of the files in the project to make sure that I have replaced every instance of "org.alfresco.sample" with my new package name.
Can anyone suggest a possible reason for this?
Thanks
I found that when I build the project, it is not building the java files. Can anyone
suggest why it is not building the java files with the new package name?
Thanks
I got the java files build again. But the new actions are still not being used. The new actions use an evaluator but it does not seem to be running. (It would normally write to
the log.)
Here is part of the build.xml:
<project name="Custom Dialog Build File" default="package-amp" basedir=".">
<property name="project.dir" value="."/>
<property name="build.dir" value="${project.dir}/build"/>
<property name="config.dir" value="${project.dir}/config"/>
<property name="jsp.dir" value="${project.dir}/web/jsp"/>
<property name="web.dir" value="${project.dir}/web" />
<property name="package.file.jar" value="${build.dir}/lib/custom-dialog.jar"/>
<property name="package.file.zip" value="${build.dir}/lib/custom-dialog.zip"/>
<property name="amp.file" value="${build.dir}/dist/retailChannels.amp"/>
<path id="class.path">
<dirset dir="${build.dir}" />
<fileset dir="../../lib/server" includes="**/*.jar"/>
</path>
<target name="compile">
<mkdir dir="${build.dir}" />
<javac classpathref="class.path" srcdir="${project.dir}/source" destdir="${build.dir}" />
</target>
<target name="package-jar" depends="increment-build-number">
<delete file="${package.file.jar}" />
<jar destfile="${package.file.jar}">
<fileset dir="${build.dir}">
<exclude name="dist/**" />
<exclude name="lib/**" />
<exclude name="web/**" />
</fileset>
</jar>
</target>
<target name="mkdirs">
<mkdir dir="${build.dir}/dist" />
<mkdir dir="${build.dir}/lib" />
</target>
<target name="clean">
<delete includeemptydirs="true">
<fileset dir="${build.dir}/dist" includes="**/*"/>
</delete>
</target>
<target name="package-amp" depends="clean, mkdirs, package-jar" description="Package the Module" >
<delete file="${amp.file}" />
<zip destfile="${amp.file}" >
<fileset dir="${project.dir}/build" includes="lib/*.jar" />
<fileset dir="${project.dir}/config/alfresco/module/alfresco" includes="*.properties" />
<fileset dir="${project.dir}" includes="config/**/*.*" excludes="**/module.properties" />
<fileset dir="${project.dir}/source">
<include name="web/jsp/**/*.jsp" />
<include name="web/images/**" />
</fileset>
</zip>
</target>
</project>
I just tried going through the maven SDK tutorial that you suggested but I got
this error:
Feb 14, 2014 3:42:48 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
Check the build.xml file. Double-check the compile and package-jar tasks (or similar). For example, one or both of these tasks may have a fileset that uses a pattern to include your classes using the package structure, and it may no longer match now that you've changed your package name.
It's hard to tell without seeing your build.xml.
By the way, if you want a more up-to-date example for creating actions in Alfresco, take a look at this tutorial: http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html
It uses the Alfresco Maven SDK to package AMPs. The Alfresco Maven SDK is preferred over the old SDK you are using.
I am using ant to build my web application. I have a target in my ant script which takes approximately 8 minutes to compile. Since mxmlc compiles everything from scratch and loads up the JVM each time, it is taking a lot of time. Is there a way to optimize this task?
I am using Flex SDK 3.0. Here is my ant target:
<target name="compile.organic.flash" depends="setup">
<property name="WelcomeBack.swf" value="${www.dir}/swf/as3/apps/welcome/WelcomeBack.swf" />
<mxmlc file="${AS3.classpath}/com/organic/app/fthb/welcome/src/WelcomeBack.as"
output="${WelcomeBack.swf}"
incremental="${mxmlc.inc}"
default-frame-rate="30"
accessible="true"
default-background-color="${swf.backgrond.color}"
allow-source-path-overlap="true"
compiler.strict="true">
<default-size width="940" height="528" />
<source-path path-element="${Welcome.path}"/>
<source-path path-element="${AS3.classpath}"/>
</mxmlc>
<property name="Welcome.swf" value="${www.dir}/swf/as3/apps/welcome/Welcome.swf" />
<mxmlc file="${AS3.classpath}/com/organic/app/fthb/welcome/src/Welcome.as"
output="${Welcome.swf}"
incremental="${mxmlc.inc}"
default-frame-rate="30"
accessible="true"
default-background-color="${swf.backgrond.color}"
allow-source-path-overlap="true"
compiler.strict="true">
<default-size width="940" height="528" />
<source-path path-element="${Welcome.path}"/>
<source-path path-element="${AS3.classpath}"/>
<compiler.include-libraries dir="${AS3.component}/" >
</compiler.include-libraries>
</mxmlc>
<property name="App.swf" value="${www.dir}/swf/as3/apps/App-${svnVersion}.swf" />
<mxmlc file="${AS3.classpath}/com/organic/app/fthb/App.as"
output="${App.swf}"
incremental="${mxmlc.inc}"
default-frame-rate="30"
default-background-color="${swf.backgrond.color}"
compiler.strict="true">
<default-size width="300" height="300" />
<source-path path-element="${AS3.classpath}"/>
<compiler.include-libraries dir="${AS3.component}/" >
</compiler.include-libraries>
</mxmlc>
<property name="LSOApp.swf" value="${www.dir}/swf/as3/apps/LSOApp-${svnVersion}.swf" />
<mxmlc file="${AS3.classpath}/com/organic/boa/fthb/LSOApp.as"
output="${LSOApp.swf}"
incremental="${mxmlc.inc}"
default-frame-rate="30"
default-background-color="${swf.backgrond.color}"
compiler.strict="true">
<default-size width="300" height="300" />
<source-path path-element="${AS3.classpath}"/>
<compiler.include-libraries dir="${AS3.component}/" >
</compiler.include-libraries>
</mxmlc>
<property name="CheckRates.swf" value="${www.dir}/swf/as3/apps/CheckRates-${svnVersion}.swf" />
<mxmlc file="${CheckRates.path}/CheckRates.as"
output="${CheckRates.swf}"
incremental="${mxmlc.inc}"
default-frame-rate="40"
accessible="true"
default-background-color="${swf.backgrond.color}"
compiler.strict="true" compiler.allow-source-path-overlap="true" >
<default-size width="940" height="528" />
<compiler.source-path path-element="${AS3.classpath}"/>
<compiler.source-path path-element="${CheckRates.path}"/>
<!-- <source-path path-element="${AS3.classpath}"/> -->
<compiler.include-libraries dir="${AS3.classpath}">
<include name="fl/fl.swc" />
</compiler.include-libraries>
</mxmlc>
<copy file="${AS3.classpath}/com/organic/app/fthb/checkRates/js/config/check_rates_config.js" tofile="${www.dir}/swf/as3/apps/config/check_rates_config.js"/>
<property name="PointsCalculator.swf" value="${www.dir}/swf/as3/apps/PointsCalculator-${svnVersion}.swf" />
<property name="flash.apps.build.dir" value="${www.dir}/swf/as3/apps" />
<compile-flash basename="PointsCalculator" srcdir="${flash.apps.src.dir}/pointsCalculator">
</compile-flash>
<copy todir="${flash.apps.build.dir}/config">
<fileset dir="${flash.apps.src.dir}/pointsCalculator/config" includes="*.js"/>
</copy>
<copy todir="${build.dir}/www/css">
<fileset dir="${flash.apps.src.dir}/pointsCalculator/css" includes="*.css"/>
</copy>
<copy todir="${build.dir}/www/swf/as3/apps/welcome/assets/swfs">
<fileset dir="${flash.apps.src.dir}/welcome/assets/swfs" includes="*.swf"/>
</copy>
<copy file="${videoplayer.dir}/videoplayer.swf" tofile="${www.dir}/swf/as3/apps/videoplayer.swf" />
</target>
Use fcsh. From the first paragraph of that link
The fcsh (Flex Compiler Shell) utility provides a shell environment
that you use to compile Flex applications, modules, and component
libraries. It works very similarly to the mxmlc and compc command line
compilers, but it compiles faster than the mxmlc and compc
command-line compilers. One reason is that by keeping everything in
memory, fcsh eliminates the overhead of launching the JVM and loading
the compiler classes. Another reason is that compilation results (for
example, type information) can be kept in memory for subsequent
compilations.
We found that what was slowing down the compiler was mostly linking assets. We made a library project swf that is just used for assets (images, swfs, etc.) except fonts, and it works a treat.
We have a massive project building under 2 mins from maven.
I'm trying to compile a component using ant and keep getting this error message throughout the component . . .
ButtonSkin.mxml(179): Error: Could not resolve <s:SolidColorStroke> to a component implementation.
ButtonSkin.mxml(210): Error: Could not resolve <s:GradientEntry> to a component implementation.
It compiles fine in FlashBuilder 4. Here is the contents of the build.xml:
<project name="Flex Ant Tasks Build Script" default="compile flex project">
<property name="FLEX_HOME" value="c:/build/flex_sdk" />
<property name="SDK_VERSION" value="4.1.0.16076" />
<taskdef resource="flexTasks.tasks" classpath="c:/build/flex_sdk/lib/flexTasks.jar"/>
<echo message="File: ${FLEX_HOME}"/>
<!-- Build and output the Main.swf-->
<target name="compile flex project">
<compc output="${basedir}/../FlexSI/libs/MyLibrary.swc" locale="en_US">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${basedir}/src"/>
<include-sources dir="${basedir}/src" includes="*" />
<library-path dir="${basedir}/libs" includes="*" append="true"/>
<namespace uri="http://testapp.com/siLibrary" manifest="${basedir}/src/xml/manifest.xml" />
</compc>
</target>
</project>
SolidColorStroke doesn't belong to Spark theme. Try to use mx:SolidColorStroke instead of s:SolidColorStroke. Same with GradientEntry.
Discussion on the related issue at forums.adobe.com.
Suggested workaround or solution is to explicitly specify all Spark (Flex4) and Halo (Flex3) related class namespaces, e.g.
<namespace uri="library://ns.adobe.com/flex/spark" manifest="${FLEX_HOME}/frameworks/spark-manifest.xml"/>
<namespace uri="http://ns.adobe.com/mxml/2009" manifest="${FLEX_HOME}/frameworks/mxml-2009-manifest.xml"/>
<namespace uri="http://www.adobe.com/2006/mxml" manifest="${FLEX_HOME}/frameworks/mxml-manifest.xml"/>
i want to use Ant task to compile flex project(with many libraries, modules)
i use -dump-config build.xml compiler option in flash builder to extract build config
after i create this Ant task(for start, i try to compile only one mxml-module) :
<project name="My App Builderrrr" basedir="." default="main">
<property name="QA_PM_DEST" value="[my project dir]\src"/>
<property name="BIN_DEBUG" value="[my project dir]\bin-debug"/>
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Adobe Flash Builder 4/sdks/4.0.0"/>
<property name="APP_ROOT" value="src"/>
<property name="DEPLOY_DIR" value="c:\output"/>
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar"/>
<target name="main">
<mxmlc file="${QA_PM_DEST}/***.mxml"
output="${DEPLOY_DIR}/***.swf">
<load-config filename="***\build.xml"/>
</mxmlc>
</target>
and after
ant -buldfile mybuildfile.xml
but it generates very small swf file that runs with errors(67kb insted of 300kb in release build and 800kb in debug)
I think you need to load the following config, too:
<property name="flex.config" value="${FLEX_HOME}/frameworks/flex-config.xml"/>
<load-config filename="${flex.config}" />
(UPDATE 2010-08-19)
I also add incremental="false" to my mxmlc call and the libraries this way:
<library-path dir="${lib.dir}" append="true">
<include name="**.swc" />
</library-path>
An the following is also missing in your file:
<source-path path-element="${src.dir}"/>
Just moved my Flex app onto Ant with a basic ant script and I am getting this stupid error: mxmlc doesn't support the "file" attribute. I looked through docos and it seems that my code is right, so hows it going.
<!-- load previously defined configuration properties file -->
<property file="build.properties" />
<!-- points to our flexTasks.jar we copied to the libs folder to distribute with the project -->
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar"/>
<!-- delete and recreate the DEPLOY dir -->
<target name="init">
<delete dir="${DEPLOY_DIR}" />
<mkdir dir="${DEPLOY_DIR}" />
</target>
<!-- Build and output the Main.swf-->
<target name="compile flex project" depends="init">
<mxmlc file="${SRC_DIR}/DNASupport.mxml"
actionscript-file-encoding="UTF-8"
keep-generated-actionscript="false"
incremental="true"
optimize="true"
output="${DEPLOY_DIR}/Main.swf">
<license product="flexbuilder3" serial-number="137740016118223699076222" />
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${app_root_dir}/src" />
<source-path path-element="${FLEX_HOME}/frameworks" />
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.debug>false</compiler.debug>
</mxmlc>
</target>
are you using the flex ant tasks?
This is a part of my "typical" build file
<taskdef resource="flexTasks.tasks" />
...
<target name="compile">
<mxmlc file="Main.mxml" debug="true" output="main.swf">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml" />
<source-path path-element="${FLEX_HOME}/frameworks" />
<source-path path-element="${src}" />
</mxmlc>
</target>
Hope this helps