Skip to content

Instantly share code, notes, and snippets.

Avatar
🙈
Taking care of my kid

Matt Wright mattupstate

🙈
Taking care of my kid
View GitHub Profile
View getTimeCode.as
/**
* Converts the amount of milliseconds into a string based time code.
* @param milliseconds
* @param delimiter
* @param withHours
* @return The time code as a string.
*/
function getTimeCode( milliseconds:Number, delimeter:String = ":", withHours:Boolean = false ):String
{
var posHours:Number = Math.floor( milliseconds / 1000 / 60 / 60 );
View PseudoAntProcess.as
function run( buildFile:File, targetName:String, parameters:Array = null ):void
{
var file:File = new File( "C:/windows/system32/cmd.exe" );
var args:Vector.<String> = new Vector.<String>();
args.push( "/c" );
args.push( "ant" );
if( parameters )
{
View gist:458254
package
{
import flash.display.Bitmap;
import flash.display.Sprite;
public class CenteredImage extends Sprite
{
private var _image:Bitmap;
public function CenteredImage( image:Bitmap )
View ant-exec-pseudo
<target name="compile">
<exec executable="C:/sdk/flex/4.1/bin/mxmlc.exe" dir="${basedir}">
<arg line="${basedir}/Project.as"/>
<arg line="-output=${basedir}/bin/project.swf"/>
<arg line="-source-path+=${basedir}/src"/>
<arg line="-library-path+=${basedir}/lib"/>
</exec>
</target>
View gist:464694
<taskdef resource="flexTasks.tasks" classpath="${basedir}/ant/flexTasks.jar"/>
<target name="compile">
<mxmlc file="${basedir}/src/Project.as" output="${basedir}/bin/Project.swf" debug="true">
<source-path path-element="${basedir}/src" />
<compiler.library-path dir="${basedir}/lib" append="true">
<include name="*.*"/>
</compiler.library-path>
</mxmlc>
</target>
View gist:464799
<target name="compile">
<java jar="${FLEX_HOME}/lib/mxmlc.jar" dir="${FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${basedir}/src/Project.swf" />
<arg value="-output=${basedir}/bin/Project.swf" />
<arg value="-source-path=${basedir}/src" />
<arg value="-library-path+=${basedir}/lib" />
</java>
</target>
View gist:464846
<!-- identify properties file -->
<property file="build.properties" />
<!-- identify environment variables -->
<property environment="env" />
<!-- Add the ant-contrib tasks -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="${resources.dir}/ant-contrib.jar" />
<!-- Set up FlexUnit Ant tasks -->
View gist:464853
<!-- Set's the FLEX_HOME property based on a command line parameter or environment variable. -->
<target name="init">
<if>
<equals arg1="${FLEX_HOME}" arg2="$${FLEX_HOME}" />
<then>
<if>
<equals arg1="${env.FLEX_HOME}" arg2="$${env.FLEX_HOME}" />
<then>
<fail message="Variable FLEX_HOME does not exist. Set an environment variable or pass Ant a parameter like so: ant -DFLEX_HOME='/sdk/flex/4.1' compile-swf" />
</then>
View gist:464860
<!-- Cleans up the project compile output. -->
<target name="clean-bin">
<delete dir="${bin.dir}" failonerror="false" includeemptydirs="true" />
<mkdir dir="${bin.dir}" />
</target>
<!-- Cleans up the test output. -->
<target name="clean-test">
<delete dir="${test.bin.dir}" failonerror="false" includeemptydirs="true" />
<mkdir dir="${test.bin.dir}" />
View gist:464872
<!-- Compiles the project into a SWF. -->
<target name="compile-swf" depends="init,clean-bin">
<java jar="${env.FLEX_HOME}/lib/mxmlc.jar" dir="${env.FLEX_HOME}/frameworks" fork="true" failonerror="true">
<arg value="${debug.compile.target}" />
<arg value="-output=${debug.compile.output}" />
<arg value="-source-path=${src.dir}" />
<arg value="-library-path+=${lib.dir}" />
<arg value="-static-link-runtime-shared-libraries=true" />
<arg value="-incremental=true" />
<arg value="-verbose-stacktraces=true" />
You can’t perform that action at this time.