Skip to content

Commit

Permalink
Exporter: replaced 'aspirin' dependency with 'aspire'
Browse files Browse the repository at this point in the history
com.threerings.aspirin is no longer maintained; aspire is its
actively-developed replacement. aspire does not include any display list
functionality, so I've copied aspirin's DisplayUtil and TextFieldUtil
classes into flump.
  • Loading branch information
tconkling committed Feb 8, 2014
1 parent bc1bb79 commit c363672
Show file tree
Hide file tree
Showing 27 changed files with 1,171 additions and 109 deletions.
17 changes: 5 additions & 12 deletions exporter/.actionScriptProperties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="Flump.mxml" projectUUID="394d3b90-7b79-41f0-8217-e4501b9a5c25" version="11">
<compiler additionalCompilerArguments="-locale en_US -swf-version=20" autoRSLOrdering="true" copyDependentFiles="true" flexSDK="Flex 4.6.0" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="dist" removeUnusedRSL="true" sourceFolderPath="src/main/as" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true">
<actionScriptProperties analytics="false" mainApplicationPath="Flump.mxml" projectUUID="394d3b90-7b79-41f0-8217-e4501b9a5c25" version="10">
<compiler additionalCompilerArguments="-locale en_US -swf-version=20" autoRSLOrdering="true" copyDependentFiles="true" flexSDK="Flex 4.6.0" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="dist" removeUnusedRSL="true" sourceFolderPath="src/main/as" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="true" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
Expand All @@ -10,34 +10,27 @@
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="${M2_REPO}/com/adobe/as3corelib/0.93/as3corelib-0.93.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${M2_REPO}/com/threerings/aspirin/1.13/aspirin-1.13.swc" sourcepath="/export/aspirin/src/main/as" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/flump-runtime/dist/flump-runtime.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/Starling/bin-debug/Starling.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${M2_REPO}/deng/fzip/a5430bd/fzip-a5430bd.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/react/dist/react.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="/aspire/dist/aspire.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath>
<sourceAttachmentPathEntry kind="3" linkType="1" path="${M2_REPO}/com/threerings/aspirin/1.13/aspirin-1.13.swc" sourcepath="/export/aspirin/src/main/as" useDefaultLinkType="false"/>
</sourceAttachmentPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Flump.mxml">
<airExcludes/>
</application>
</applications>
<modules/>
<workers/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
<buildTargets>
<buildTarget buildTargetName="default" platformId="default">
<buildTarget buildTargetName="default">
<airSettings airCertificatePath="" airTimestamp="true" anePathSet="true" version="1">
<airExcludes/>
<anePaths/>
<newLaunchParams/>
<modifiedLaunchParams/>
<newPackagingParams/>
<modifiedPackagingParams/>
</airSettings>
<actionScriptSettings version="1"/>
</buildTarget>
Expand Down
6 changes: 3 additions & 3 deletions exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<type>swc</type>
</dependency>
<dependency>
<groupId>com.threerings</groupId>
<artifactId>aspirin</artifactId>
<version>1.13</version>
<groupId>com.timconkling</groupId>
<artifactId>aspire</artifactId>
<version>1.1</version>
<type>swc</type>
</dependency>
</dependencies>
Expand Down
82 changes: 82 additions & 0 deletions exporter/src/main/as/flump/DisplayUtil.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// Flump - Copyright 2013 Flump Authors

package flump {

import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;

public class DisplayUtil
{
/**
* Call <code>callback</code> for <code>disp</code> and all its descendants.
*
* This is nearly exactly like mx.utils.DisplayUtil.walkDisplayObjects,
* except this method copes with security errors when examining a child.
* @param disp the root of the hierarchy at which to start the iteration
* @param callback function to call for each node in the display tree for disp. The passed
* object will never be null and the function will be called exactly once for each node, unless
* iteration is halted. The callback can have one of four signatures:
* <listing version="3.0">
* function callback (disp :DisplayObject) :void
* function callback (disp :DisplayObject) :Boolean
* function callback (disp :DisplayObject, depth :int) :void
* function callback (disp :DisplayObject, depth :int) :Boolean
* </listing>
*
* If <code>callback</code> returns <code>true</code>, traversal will halt.
*
* The passed in depth is 0 for <code>disp</code>, and increases by 1 for each level of
* children.
*
* @return <code>true</code> if <code>callback</code> returned <code>true</code>
*/
public static function applyToHierarchy (
root :DisplayObject, callback :Function, securityErrorCallback :Function=null,
maxDepth :int=int.MAX_VALUE) :Boolean
{
var toApply :Function = callback;
// Earlier versions of this function didn't pass a depth to callback, so don't
// assume that. Since we know we're getting a function of length 1 or 2, adapt manually
// instead of using F.
if (callback.length == 1) {
toApply = function (disp :DisplayObject, depth :int) :Boolean {
return callback(disp);
}
}
return applyToHierarchy0(root, maxDepth, toApply, securityErrorCallback, 0);
}

/** Helper for applyToHierarchy */
protected static function applyToHierarchy0 (root :DisplayObject, maxDepth :int,
callback :Function, securityErrorCallback :Function, depth :int) :Boolean
{
// halt traversal if callbackFunction returns true
if (Boolean(callback(root, depth))) {
return true;
}

if (++depth > maxDepth || !(root is DisplayObjectContainer)) {
return false;
}
var container :DisplayObjectContainer = DisplayObjectContainer(root);
var nn :int = container.numChildren;
for (var ii :int = 0; ii < nn; ii++) {
var child :DisplayObject;
try {
child = container.getChildAt(ii);
} catch (err :SecurityError) {
if (securityErrorCallback != null) {
securityErrorCallback(err, depth);
}
continue;
}
if (applyToHierarchy0(child, maxDepth, callback, securityErrorCallback, depth)) {
return true;
}
}

return false;
}
}
}
2 changes: 0 additions & 2 deletions exporter/src/main/as/flump/SwfTexture.as
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

package flump {

import com.threerings.display.DisplayUtil;

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.DisplayObject;
Expand Down
Loading

0 comments on commit c363672

Please sign in to comment.