Added Atlas and Flash rendering to spine-as3.

This commit is contained in:
NathanSweet 2013-05-04 11:41:37 +02:00
parent 45f93ca31f
commit 09aa13c643
62 changed files with 3938 additions and 17 deletions

4
.gitignore vendored
View File

@ -52,7 +52,9 @@ spine-love/spine-lua/
spine-love/love/
!spine-love/spine-lua/Place spine-lua here.txt
spine-as3/bin
spine-as3/spine-as3/bin
spine-as3/spine-as3-example/bin-debug
spine-as3/spine-as3-example/bin-release
spine-starling/spine-starling/bin
spine-starling/spine-starling-example/bin-debug
spine-starling/spine-starling-example/bin-release

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexLibProperties includeAllClasses="true" useMultiPlatformConfig="false" version="3">
<includeClasses/>
<includeResources/>
<namespaceManifests/>
</flexLibProperties>

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="Main.as" projectUUID="98e371df-ee9f-4aef-8e4b-fdb975214a26" version="11">
<compiler additionalCompilerArguments="-locale en_US" advancedTelemetry="false" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="0">
<libraryPathEntry kind="4" path="">
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="1" linkType="1" path="${PROJECT_FRAMEWORKS}/locale/{locale}"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/framework.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/netmon.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/datavisualization.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp_air.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/videoPlayer.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flash-integration.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_flashflexkit.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="/spine-as3/bin/spine-as3.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
<applications>
<application path="Main.as"/>
</applications>
<modules/>
<workers/>
<buildCSSFiles/>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
</actionScriptProperties>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>spine-as3-example</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.adobe.flexbuilder.project.flexbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.adobe.flexbuilder.project.actionscriptnature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,3 @@
#Sat May 04 09:13:10 CEST 2013
eclipse.preferences.version=1
encoding/<project>=utf-8

View File

@ -0,0 +1,49 @@
package {
import flash.display.Sprite;
import spine.AnimationStateData;
import spine.SkeletonData;
import spine.SkeletonJson;
import spine.atlas.Atlas;
import spine.attachments.AtlasAttachmentLoader;
import spine.flash.SingleTextureLoader;
import spine.flash.SkeletonAnimationSprite;
[SWF(width = "640", height = "480", frameRate = "60", backgroundColor = "#dddddd")]
public class Main extends Sprite {
[Embed(source = "spineboy.atlas", mimeType = "application/octet-stream")]
static public const SpineboyAtlas:Class;
[Embed(source = "spineboy.png")]
static public const SpineboyAtlasTexture:Class;
[Embed(source = "spineboy.json", mimeType = "application/octet-stream")]
static public const SpineboyJson:Class;
private var skeleton:SkeletonAnimationSprite;
public function Main () {
var atlas:Atlas = new Atlas(new SpineboyAtlas(), new SingleTextureLoader(new SpineboyAtlasTexture()));
var json:SkeletonJson = new SkeletonJson(new AtlasAttachmentLoader(atlas));
var skeletonData:SkeletonData = json.readSkeletonData(new SpineboyJson());
var stateData:AnimationStateData = new AnimationStateData(skeletonData);
stateData.setMixByName("walk", "jump", 0.2);
stateData.setMixByName("jump", "walk", 0.4);
stateData.setMixByName("jump", "jump", 0.2);
skeleton = new SkeletonAnimationSprite(skeletonData);
skeleton.setAnimationStateData(stateData);
skeleton.x = 320;
skeleton.y = 420;
skeleton.setAnimation("walk", true);
skeleton.addAnimation("jump", false, 3);
skeleton.addAnimation("walk", true);
addChild(skeleton);
}
}
}

View File

@ -0,0 +1,285 @@
goblins.png
format: RGBA8888
filter: Linear,Linear
repeat: none
spear
rotate: false
xy: 2, 142
size: 22, 368
orig: 22, 368
offset: 0, 0
index: -1
goblingirl/head
rotate: false
xy: 26, 429
size: 103, 81
orig: 103, 81
offset: 0, 0
index: -1
goblin/head
rotate: false
xy: 26, 361
size: 103, 66
orig: 103, 66
offset: 0, 0
index: -1
goblin/torso
rotate: false
xy: 131, 414
size: 68, 96
orig: 68, 96
offset: 0, 0
index: -1
goblingirl/torso
rotate: false
xy: 26, 263
size: 68, 96
orig: 68, 96
offset: 0, 0
index: -1
dagger
rotate: false
xy: 26, 153
size: 26, 108
orig: 26, 108
offset: 0, 0
index: -1
goblin/right-lower-leg
rotate: false
xy: 201, 434
size: 36, 76
orig: 36, 76
offset: 0, 0
index: -1
goblingirl/right-lower-leg
rotate: false
xy: 54, 185
size: 36, 76
orig: 36, 76
offset: 0, 0
index: -1
goblin/left-upper-leg
rotate: false
xy: 96, 286
size: 33, 73
orig: 33, 73
offset: 0, 0
index: -1
goblin/pelvis
rotate: false
xy: 131, 369
size: 62, 43
orig: 62, 43
offset: 0, 0
index: -1
goblingirl/pelvis
rotate: false
xy: 131, 324
size: 62, 43
orig: 62, 43
offset: 0, 0
index: -1
goblin/right-foot
rotate: false
xy: 131, 289
size: 63, 33
orig: 63, 33
offset: 0, 0
index: -1
goblin/left-lower-leg
rotate: false
xy: 2, 70
size: 33, 70
orig: 33, 70
offset: 0, 0
index: -1
goblin/right-upper-leg
rotate: false
xy: 2, 5
size: 34, 63
orig: 34, 63
offset: 0, 0
index: -1
goblingirl/left-lower-leg
rotate: false
xy: 195, 342
size: 33, 70
orig: 33, 70
offset: 0, 0
index: -1
goblingirl/left-upper-leg
rotate: false
xy: 37, 81
size: 33, 70
orig: 33, 70
offset: 0, 0
index: -1
goblingirl/right-upper-leg
rotate: false
xy: 38, 16
size: 34, 63
orig: 34, 63
offset: 0, 0
index: -1
goblin/eyes-closed
rotate: false
xy: 38, 2
size: 34, 12
orig: 34, 12
offset: 0, 0
index: -1
goblin/undies
rotate: false
xy: 54, 154
size: 36, 29
orig: 36, 29
offset: 0, 0
index: -1
goblin/right-arm
rotate: false
xy: 72, 102
size: 23, 50
orig: 23, 50
offset: 0, 0
index: -1
goblin/left-foot
rotate: false
xy: 131, 256
size: 65, 31
orig: 65, 31
offset: 0, 0
index: -1
goblingirl/right-arm
rotate: false
xy: 196, 290
size: 28, 50
orig: 28, 50
offset: 0, 0
index: -1
goblingirl/left-shoulder
rotate: false
xy: 226, 294
size: 28, 46
orig: 28, 46
offset: 0, 0
index: -1
goblin/left-arm
rotate: false
xy: 198, 253
size: 37, 35
orig: 37, 35
offset: 0, 0
index: -1
goblingirl/left-foot
rotate: false
xy: 92, 223
size: 65, 31
orig: 65, 31
offset: 0, 0
index: -1
goblingirl/right-foot
rotate: false
xy: 92, 188
size: 63, 33
orig: 63, 33
offset: 0, 0
index: -1
goblin/undie-straps
rotate: false
xy: 92, 167
size: 55, 19
orig: 55, 19
offset: 0, 0
index: -1
goblingirl/left-arm
rotate: false
xy: 159, 219
size: 37, 35
orig: 37, 35
offset: 0, 0
index: -1
goblin/right-shoulder
rotate: false
xy: 97, 120
size: 39, 45
orig: 39, 45
offset: 0, 0
index: -1
goblingirl/right-shoulder
rotate: false
xy: 198, 206
size: 39, 45
orig: 39, 45
offset: 0, 0
index: -1
goblin/left-hand
rotate: false
xy: 157, 176
size: 36, 41
orig: 36, 41
offset: 0, 0
index: -1
goblin/neck
rotate: false
xy: 195, 163
size: 36, 41
orig: 36, 41
offset: 0, 0
index: -1
goblingirl/undie-straps
rotate: false
xy: 97, 99
size: 55, 19
orig: 55, 19
offset: 0, 0
index: -1
goblingirl/neck
rotate: false
xy: 138, 120
size: 35, 41
orig: 35, 41
offset: 0, 0
index: -1
goblingirl/left-hand
rotate: false
xy: 175, 121
size: 35, 40
orig: 35, 40
offset: 0, 0
index: -1
goblin/left-shoulder
rotate: false
xy: 212, 117
size: 29, 44
orig: 29, 44
offset: 0, 0
index: -1
goblingirl/eyes-closed
rotate: false
xy: 154, 97
size: 37, 21
orig: 37, 21
offset: 0, 0
index: -1
goblin/right-hand
rotate: false
xy: 193, 78
size: 36, 37
orig: 36, 37
offset: 0, 0
index: -1
goblingirl/right-hand
rotate: false
xy: 74, 39
size: 36, 37
orig: 36, 37
offset: 0, 0
index: -1
goblingirl/undies
rotate: false
xy: 74, 8
size: 36, 29
orig: 36, 29
offset: 0, 0
index: -1

View File

@ -0,0 +1,499 @@
{
"bones": [
{ "name": "root" },
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
{ "name": "left lower leg", "parent": "left upper leg", "length": 49.89, "x": 56.34, "y": 0.98, "rotation": -16.65 },
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 58.94, "y": -7.61, "rotation": 102.43 },
{ "name": "right upper leg", "parent": "hip", "length": 42.45, "x": -20.07, "y": -6.83, "rotation": -97.49 },
{ "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 42.99, "y": -0.61, "rotation": -14.34 },
{ "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
{ "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 93.92 },
{ "name": "neck", "parent": "torso", "length": 18.38, "x": 81.67, "y": -6.34, "rotation": -1.51 },
{ "name": "head", "parent": "neck", "length": 68.28, "x": 20.93, "y": 11.59, "rotation": -13.92 },
{ "name": "right shoulder", "parent": "torso", "length": 37.24, "x": 76.02, "y": 18.14, "rotation": 133.88 },
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 37.6, "y": 0.31, "rotation": 36.32 },
{ "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
{ "name": "left shoulder", "parent": "torso", "length": 35.43, "x": 74.04, "y": -20.38, "rotation": -156.96 },
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 37.85, "y": -2.34, "rotation": 28.16 },
{ "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
{ "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 }
],
"slots": [
{ "name": "left shoulder", "bone": "left shoulder", "attachment": "left shoulder" },
{ "name": "left arm", "bone": "left arm", "attachment": "left arm" },
{ "name": "left hand item", "bone": "left hand", "attachment": "spear" },
{ "name": "left hand", "bone": "left hand", "attachment": "left hand" },
{ "name": "left foot", "bone": "left foot", "attachment": "left foot" },
{ "name": "left lower leg", "bone": "left lower leg", "attachment": "left lower leg" },
{ "name": "left upper leg", "bone": "left upper leg", "attachment": "left upper leg" },
{ "name": "neck", "bone": "neck", "attachment": "neck" },
{ "name": "torso", "bone": "torso", "attachment": "torso" },
{ "name": "pelvis", "bone": "pelvis", "attachment": "pelvis" },
{ "name": "right foot", "bone": "right foot", "attachment": "right foot" },
{ "name": "right lower leg", "bone": "right lower leg", "attachment": "right lower leg" },
{ "name": "undie straps", "bone": "pelvis", "attachment": "undie straps" },
{ "name": "undies", "bone": "pelvis", "attachment": "undies" },
{ "name": "right upper leg", "bone": "right upper leg", "attachment": "right upper leg" },
{ "name": "head", "bone": "head", "attachment": "head" },
{ "name": "eyes", "bone": "head" },
{ "name": "right shoulder", "bone": "right shoulder", "attachment": "right shoulder" },
{ "name": "right arm", "bone": "right arm", "attachment": "right arm" },
{ "name": "right hand item", "bone": "right hand", "attachment": "dagger" },
{ "name": "right hand", "bone": "right hand", "attachment": "right hand" }
],
"skins": {
"default": {
"left hand item": {
"dagger": { "x": 7.88, "y": -23.45, "rotation": 10.47, "width": 26, "height": 108 },
"spear": { "x": -4.55, "y": 39.2, "rotation": 13.04, "width": 22, "height": 368 }
},
"right hand item": {
"dagger": { "x": 6.51, "y": -24.15, "rotation": -8.06, "width": 26, "height": 108 }
}
},
"goblin": {
"neck": {
"neck": { "name": "goblin/neck", "x": 10.1, "y": 0.42, "rotation": -93.69, "width": 36, "height": 41 }
},
"undies": {
"undies": { "name": "goblin/undies", "x": 6.3, "y": 0.12, "rotation": 0.91, "width": 36, "height": 29 }
},
"right hand": {
"right hand": { "name": "goblin/right-hand", "x": 7.88, "y": 2.78, "rotation": 91.96, "width": 36, "height": 37 }
},
"right arm": {
"right arm": { "name": "goblin/right-arm", "x": 16.44, "y": -1.04, "rotation": 94.32, "width": 23, "height": 50 }
},
"head": {
"head": { "name": "goblin/head", "x": 25.73, "y": 2.33, "rotation": -92.29, "width": 103, "height": 66 }
},
"left shoulder": {
"left shoulder": { "name": "goblin/left-shoulder", "x": 15.56, "y": -2.26, "rotation": 62.01, "width": 29, "height": 44 }
},
"left arm": {
"left arm": {
"name": "goblin/left-arm",
"x": 16.7,
"y": -1.69,
"scaleX": 1.057,
"scaleY": 1.057,
"rotation": 33.84,
"width": 37,
"height": 35
}
},
"left hand": {
"left hand": {
"name": "goblin/left-hand",
"x": 3.47,
"y": 3.41,
"scaleX": 0.892,
"scaleY": 0.892,
"rotation": 31.14,
"width": 36,
"height": 41
}
},
"right lower leg": {
"right lower leg": { "name": "goblin/right-lower-leg", "x": 25.68, "y": -3.15, "rotation": 111.83, "width": 36, "height": 76 }
},
"right upper leg": {
"right upper leg": { "name": "goblin/right-upper-leg", "x": 20.35, "y": 1.47, "rotation": 97.49, "width": 34, "height": 63 }
},
"pelvis": {
"pelvis": { "name": "goblin/pelvis", "x": -5.61, "y": 0.76, "width": 62, "height": 43 }
},
"left lower leg": {
"left lower leg": { "name": "goblin/left-lower-leg", "x": 23.58, "y": -2.06, "rotation": 105.75, "width": 33, "height": 70 }
},
"left upper leg": {
"left upper leg": { "name": "goblin/left-upper-leg", "x": 29.68, "y": -3.87, "rotation": 89.09, "width": 33, "height": 73 }
},
"torso": {
"torso": { "name": "goblin/torso", "x": 38.09, "y": -3.87, "rotation": -94.95, "width": 68, "height": 96 }
},
"right shoulder": {
"right shoulder": { "name": "goblin/right-shoulder", "x": 15.68, "y": -1.03, "rotation": 130.65, "width": 39, "height": 45 }
},
"right foot": {
"right foot": { "name": "goblin/right-foot", "x": 23.56, "y": 9.8, "rotation": 1.52, "width": 63, "height": 33 }
},
"left foot": {
"left foot": { "name": "goblin/left-foot", "x": 24.85, "y": 8.74, "rotation": 3.32, "width": 65, "height": 31 }
},
"undie straps": {
"undie straps": { "name": "goblin/undie-straps", "x": -3.87, "y": 13.1, "scaleX": 1.089, "width": 55, "height": 19 }
},
"eyes": {
"eyes closed": { "name": "goblin/eyes-closed", "x": 32.21, "y": -21.27, "rotation": -88.92, "width": 34, "height": 12 }
}
},
"goblingirl": {
"left upper leg": {
"left upper leg": { "name": "goblingirl/left-upper-leg", "x": 30.21, "y": -2.95, "rotation": 89.09, "width": 33, "height": 70 }
},
"left lower leg": {
"left lower leg": { "name": "goblingirl/left-lower-leg", "x": 25.02, "y": -0.6, "rotation": 105.75, "width": 33, "height": 70 }
},
"left foot": {
"left foot": { "name": "goblingirl/left-foot", "x": 25.17, "y": 7.92, "rotation": 3.32, "width": 65, "height": 31 }
},
"right upper leg": {
"right upper leg": { "name": "goblingirl/right-upper-leg", "x": 19.69, "y": 2.13, "rotation": 97.49, "width": 34, "height": 63 }
},
"right lower leg": {
"right lower leg": { "name": "goblingirl/right-lower-leg", "x": 26.15, "y": -3.27, "rotation": 111.83, "width": 36, "height": 76 }
},
"right foot": {
"right foot": { "name": "goblingirl/right-foot", "x": 23.46, "y": 9.66, "rotation": 1.52, "width": 63, "height": 33 }
},
"torso": {
"torso": { "name": "goblingirl/torso", "x": 36.28, "y": -5.14, "rotation": -95.74, "width": 68, "height": 96 }
},
"left shoulder": {
"left shoulder": { "name": "goblingirl/left-shoulder", "x": 19.8, "y": -0.42, "rotation": 61.21, "width": 28, "height": 46 }
},
"left arm": {
"left arm": { "name": "goblingirl/left-arm", "x": 19.64, "y": -2.42, "rotation": 33.05, "width": 37, "height": 35 }
},
"left hand": {
"left hand": {
"name": "goblingirl/left-hand",
"x": 4.34,
"y": 2.39,
"scaleX": 0.896,
"scaleY": 0.896,
"rotation": 30.34,
"width": 35,
"height": 40
}
},
"neck": {
"neck": { "name": "goblingirl/neck", "x": 6.16, "y": -3.14, "rotation": -98.86, "width": 35, "height": 41 }
},
"head": {
"head": { "name": "goblingirl/head", "x": 27.71, "y": -4.32, "rotation": -85.58, "width": 103, "height": 81 }
},
"right shoulder": {
"right shoulder": { "name": "goblingirl/right-shoulder", "x": 14.46, "y": 0.45, "rotation": 129.85, "width": 39, "height": 45 }
},
"right arm": {
"right arm": { "name": "goblingirl/right-arm", "x": 16.85, "y": -0.66, "rotation": 93.52, "width": 28, "height": 50 }
},
"right hand": {
"right hand": { "name": "goblingirl/right-hand", "x": 7.21, "y": 3.43, "rotation": 91.16, "width": 36, "height": 37 }
},
"pelvis": {
"pelvis": { "name": "goblingirl/pelvis", "x": -3.87, "y": 3.18, "width": 62, "height": 43 }
},
"undie straps": {
"undie straps": { "name": "goblingirl/undie-straps", "x": -1.51, "y": 14.18, "width": 55, "height": 19 }
},
"undies": {
"undies": { "name": "goblingirl/undies", "x": 5.4, "y": 1.7, "width": 36, "height": 29 }
},
"eyes": {
"eyes closed": { "name": "goblingirl/eyes-closed", "x": 28, "y": -25.54, "rotation": -87.04, "width": 37, "height": 21 }
}
}
},
"animations": {
"walk": {
"bones": {
"left upper leg": {
"rotate": [
{ "time": 0, "angle": -26.55 },
{ "time": 0.1333, "angle": -8.78 },
{ "time": 0.2333, "angle": 9.51 },
{ "time": 0.3666, "angle": 30.74 },
{ "time": 0.5, "angle": 25.33 },
{ "time": 0.6333, "angle": 26.11 },
{ "time": 0.7333, "angle": -7.7 },
{ "time": 0.8666, "angle": -21.19 },
{ "time": 1, "angle": -26.55 }
],
"translate": [
{ "time": 0, "x": -1.32, "y": 1.7 },
{ "time": 0.3666, "x": -0.06, "y": 2.42 },
{ "time": 1, "x": -1.32, "y": 1.7 }
]
},
"right upper leg": {
"rotate": [
{ "time": 0, "angle": 42.45 },
{ "time": 0.1333, "angle": 52.1 },
{ "time": 0.2333, "angle": 8.53 },
{ "time": 0.5, "angle": -16.93 },
{ "time": 0.6333, "angle": 1.89 },
{
"time": 0.7333,
"angle": 28.06,
"curve": [ 0.462, 0.11, 1, 1 ]
},
{
"time": 0.8666,
"angle": 58.68,
"curve": [ 0.5, 0.02, 1, 1 ]
},
{ "time": 1, "angle": 42.45 }
],
"translate": [
{ "time": 0, "x": 6.23, "y": 0 },
{ "time": 0.2333, "x": 2.14, "y": 2.4 },
{ "time": 0.5, "x": 2.44, "y": 4.8 },
{ "time": 1, "x": 6.23, "y": 0 }
]
},
"left lower leg": {
"rotate": [
{ "time": 0, "angle": -22.98 },
{ "time": 0.1333, "angle": -63.5 },
{ "time": 0.2333, "angle": -73.76 },
{ "time": 0.5, "angle": 5.11 },
{ "time": 0.6333, "angle": -28.29 },
{ "time": 0.7333, "angle": 4.08 },
{ "time": 0.8666, "angle": 3.53 },
{ "time": 1, "angle": -22.98 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{ "time": 0.2333, "x": 2.55, "y": -0.47 },
{ "time": 0.5, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1, "x": 0, "y": 0 }
]
},
"left foot": {
"rotate": [
{ "time": 0, "angle": -3.69 },
{ "time": 0.1333, "angle": -10.42 },
{ "time": 0.2333, "angle": -5.01 },
{ "time": 0.3666, "angle": 3.87 },
{ "time": 0.5, "angle": -3.87 },
{ "time": 0.6333, "angle": 2.78 },
{ "time": 0.7333, "angle": 1.68 },
{ "time": 0.8666, "angle": -8.54 },
{ "time": 1, "angle": -3.69 }
]
},
"right shoulder": {
"rotate": [
{
"time": 0,
"angle": 5.29,
"curve": [ 0.264, 0, 0.75, 1 ]
},
{ "time": 0.6333, "angle": 6.65 },
{ "time": 1, "angle": 5.29 }
]
},
"right arm": {
"rotate": [
{
"time": 0,
"angle": -4.02,
"curve": [ 0.267, 0, 0.804, 0.99 ]
},
{
"time": 0.6333,
"angle": 19.78,
"curve": [ 0.307, 0, 0.787, 0.99 ]
},
{ "time": 1, "angle": -4.02 }
]
},
"right hand": {
"rotate": [
{ "time": 0, "angle": 8.98 },
{ "time": 0.6333, "angle": 0.51 },
{ "time": 1, "angle": 8.98 }
]
},
"left shoulder": {
"rotate": [
{
"time": 0,
"angle": 6.25,
"curve": [ 0.339, 0, 0.683, 1 ]
},
{
"time": 0.5,
"angle": -11.78,
"curve": [ 0.281, 0, 0.686, 0.99 ]
},
{ "time": 1, "angle": 6.25 }
],
"translate": [
{ "time": 0, "x": 1.15, "y": 0.23 }
]
},
"left hand": {
"rotate": [
{
"time": 0,
"angle": -21.23,
"curve": [ 0.295, 0, 0.755, 0.98 ]
},
{
"time": 0.5,
"angle": -27.28,
"curve": [ 0.241, 0, 0.75, 0.97 ]
},
{ "time": 1, "angle": -21.23 }
]
},
"left arm": {
"rotate": [
{
"time": 0,
"angle": 28.37,
"curve": [ 0.339, 0, 0.683, 1 ]
},
{
"time": 0.5,
"angle": 60.09,
"curve": [ 0.281, 0, 0.686, 0.99 ]
},
{ "time": 1, "angle": 28.37 }
]
},
"torso": {
"rotate": [
{ "time": 0, "angle": -10.28 },
{
"time": 0.1333,
"angle": -15.38,
"curve": [ 0.545, 0, 0.818, 1 ]
},
{
"time": 0.3666,
"angle": -9.78,
"curve": [ 0.58, 0.17, 0.669, 0.99 ]
},
{
"time": 0.6333,
"angle": -15.75,
"curve": [ 0.235, 0.01, 0.795, 1 ]
},
{
"time": 0.8666,
"angle": -7.06,
"curve": [ 0.209, 0, 0.816, 0.98 ]
},
{ "time": 1, "angle": -10.28 }
],
"translate": [
{ "time": 0, "x": -1.29, "y": 1.68 }
]
},
"right foot": {
"rotate": [
{ "time": 0, "angle": -5.25 },
{ "time": 0.2333, "angle": -1.91 },
{ "time": 0.3666, "angle": -6.45 },
{ "time": 0.5, "angle": -5.39 },
{ "time": 0.7333, "angle": -11.68 },
{ "time": 0.8666, "angle": 0.46 },
{ "time": 1, "angle": -5.25 }
]
},
"right lower leg": {
"rotate": [
{
"time": 0,
"angle": -3.39,
"curve": [ 0.316, 0.01, 0.741, 0.98 ]
},
{
"time": 0.1333,
"angle": -45.53,
"curve": [ 0.229, 0, 0.738, 0.97 ]
},
{ "time": 0.2333, "angle": -4.83 },
{ "time": 0.5, "angle": -19.53 },
{ "time": 0.6333, "angle": -64.8 },
{
"time": 0.7333,
"angle": -82.56,
"curve": [ 0.557, 0.18, 1, 1 ]
},
{ "time": 1, "angle": -3.39 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.5, "x": 0, "y": 0 },
{ "time": 0.6333, "x": 2.18, "y": 0.21 },
{ "time": 1, "x": 0, "y": 0 }
]
},
"hip": {
"rotate": [
{ "time": 0, "angle": 0, "curve": "stepped" },
{ "time": 1, "angle": 0 }
],
"translate": [
{ "time": 0, "x": 0, "y": -4.16 },
{
"time": 0.1333,
"x": 0,
"y": -7.05,
"curve": [ 0.359, 0.47, 0.646, 0.74 ]
},
{ "time": 0.3666, "x": 0, "y": 6.78 },
{ "time": 0.5, "x": 0, "y": -6.13 },
{
"time": 0.6333,
"x": 0,
"y": -7.05,
"curve": [ 0.359, 0.47, 0.646, 0.74 ]
},
{ "time": 0.8666, "x": 0, "y": 6.78 },
{ "time": 1, "x": 0, "y": -4.16 }
]
},
"neck": {
"rotate": [
{ "time": 0, "angle": 3.6 },
{ "time": 0.1333, "angle": 17.49 },
{ "time": 0.2333, "angle": 6.1 },
{ "time": 0.3666, "angle": 3.45 },
{ "time": 0.5, "angle": 5.17 },
{ "time": 0.6333, "angle": 18.36 },
{ "time": 0.7333, "angle": 6.09 },
{ "time": 0.8666, "angle": 2.28 },
{ "time": 1, "angle": 3.6 }
]
},
"head": {
"rotate": [
{
"time": 0,
"angle": 3.6,
"curve": [ 0, 0, 0.704, 1.17 ]
},
{ "time": 0.1333, "angle": -0.2 },
{ "time": 0.2333, "angle": 6.1 },
{ "time": 0.3666, "angle": 3.45 },
{
"time": 0.5,
"angle": 5.17,
"curve": [ 0, 0, 0.704, 1.61 ]
},
{ "time": 0.6666, "angle": 1.1 },
{ "time": 0.7333, "angle": 6.09 },
{ "time": 0.8666, "angle": 2.28 },
{ "time": 1, "angle": 3.6 }
]
}
},
"slots": {
"eyes": {
"attachment": [
{ "time": 0.7, "name": "eyes closed" },
{ "time": 0.8, "name": null }
]
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB

View File

@ -0,0 +1,166 @@
spineboy.png
format: RGBA8888
filter: Linear,Linear
repeat: none
head
rotate: false
xy: 1, 122
size: 121, 132
orig: 121, 132
offset: 0, 0
index: -1
torso
rotate: false
xy: 1, 28
size: 68, 92
orig: 68, 92
offset: 0, 0
index: -1
left-pant-bottom
rotate: false
xy: 1, 4
size: 44, 22
orig: 44, 22
offset: 0, 0
index: -1
right-pant-bottom
rotate: false
xy: 47, 8
size: 46, 18
orig: 46, 18
offset: 0, 0
index: -1
right-upper-leg
rotate: false
xy: 71, 50
size: 44, 70
orig: 44, 70
offset: 0, 0
index: -1
pelvis
rotate: false
xy: 95, 1
size: 63, 47
orig: 63, 47
offset: 0, 0
index: -1
left-upper-leg
rotate: false
xy: 117, 53
size: 33, 67
orig: 33, 67
offset: 0, 0
index: -1
right-foot
rotate: false
xy: 160, 224
size: 67, 30
orig: 67, 30
offset: 0, 0
index: -1
left-shoulder
rotate: false
xy: 124, 201
size: 34, 53
orig: 34, 53
offset: 0, 0
index: -1
left-ankle
rotate: false
xy: 229, 222
size: 25, 32
orig: 25, 32
offset: 0, 0
index: -1
left-foot
rotate: false
xy: 160, 192
size: 65, 30
orig: 65, 30
offset: 0, 0
index: -1
neck
rotate: false
xy: 124, 171
size: 34, 28
orig: 34, 28
offset: 0, 0
index: -1
right-arm
rotate: false
xy: 124, 124
size: 21, 45
orig: 21, 45
offset: 0, 0
index: -1
right-ankle
rotate: false
xy: 227, 190
size: 25, 30
orig: 25, 30
offset: 0, 0
index: -1
left-hand
rotate: false
xy: 147, 131
size: 35, 38
orig: 35, 38
offset: 0, 0
index: -1
left-arm
rotate: false
xy: 184, 161
size: 35, 29
orig: 35, 29
offset: 0, 0
index: -1
eyes-closed
rotate: false
xy: 221, 161
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-lower-leg
rotate: false
xy: 152, 65
size: 51, 64
orig: 51, 64
offset: 0, 0
index: -1
right-foot-idle
rotate: false
xy: 184, 131
size: 53, 28
orig: 53, 28
offset: 0, 0
index: -1
left-lower-leg
rotate: false
xy: 205, 65
size: 49, 64
orig: 49, 64
offset: 0, 0
index: -1
right-shoulder
rotate: false
xy: 160, 12
size: 52, 51
orig: 52, 51
offset: 0, 0
index: -1
eyes
rotate: false
xy: 214, 36
size: 34, 27
orig: 34, 27
offset: 0, 0
index: -1
right-hand
rotate: false
xy: 214, 2
size: 32, 32
orig: 32, 32
offset: 0, 0
index: -1

View File

@ -0,0 +1,787 @@
{
"bones": [
{ "name": "root" },
{ "name": "hip", "parent": "root", "x": 0.64, "y": 114.41 },
{ "name": "left upper leg", "parent": "hip", "length": 50.39, "x": 14.45, "y": 2.81, "rotation": -89.09 },
{ "name": "left lower leg", "parent": "left upper leg", "length": 56.45, "x": 51.78, "y": 3.46, "rotation": -16.65 },
{ "name": "left foot", "parent": "left lower leg", "length": 46.5, "x": 64.02, "y": -8.67, "rotation": 102.43 },
{ "name": "right upper leg", "parent": "hip", "length": 45.76, "x": -18.27, "rotation": -101.13 },
{ "name": "right lower leg", "parent": "right upper leg", "length": 58.52, "x": 50.21, "y": 0.6, "rotation": -10.7 },
{ "name": "right foot", "parent": "right lower leg", "length": 45.45, "x": 64.88, "y": 0.04, "rotation": 110.3 },
{ "name": "torso", "parent": "hip", "length": 85.82, "x": -6.42, "y": 1.97, "rotation": 94.95 },
{ "name": "neck", "parent": "torso", "length": 18.38, "x": 83.64, "y": -1.78, "rotation": 0.9 },
{ "name": "head", "parent": "neck", "length": 68.28, "x": 19.09, "y": 6.97, "rotation": -8.94 },
{ "name": "right shoulder", "parent": "torso", "length": 49.95, "x": 81.9, "y": 6.79, "rotation": 130.6 },
{ "name": "right arm", "parent": "right shoulder", "length": 36.74, "x": 49.95, "y": -0.12, "rotation": 40.12 },
{ "name": "right hand", "parent": "right arm", "length": 15.32, "x": 36.9, "y": 0.34, "rotation": 2.35 },
{ "name": "left shoulder", "parent": "torso", "length": 44.19, "x": 78.96, "y": -15.75, "rotation": -156.96 },
{ "name": "left arm", "parent": "left shoulder", "length": 35.62, "x": 44.19, "y": -0.01, "rotation": 28.16 },
{ "name": "left hand", "parent": "left arm", "length": 11.52, "x": 35.62, "y": 0.07, "rotation": 2.7 },
{ "name": "pelvis", "parent": "hip", "x": 1.41, "y": -6.57 }
],
"slots": [
{ "name": "left shoulder", "bone": "left shoulder", "attachment": "left-shoulder" },
{ "name": "left arm", "bone": "left arm", "attachment": "left-arm" },
{ "name": "left hand", "bone": "left hand", "attachment": "left-hand" },
{ "name": "left foot", "bone": "left foot", "attachment": "left-foot" },
{ "name": "left lower leg", "bone": "left lower leg", "attachment": "left-lower-leg" },
{ "name": "left upper leg", "bone": "left upper leg", "attachment": "left-upper-leg" },
{ "name": "pelvis", "bone": "pelvis", "attachment": "pelvis" },
{ "name": "right foot", "bone": "right foot", "attachment": "right-foot" },
{ "name": "right lower leg", "bone": "right lower leg", "attachment": "right-lower-leg" },
{ "name": "right upper leg", "bone": "right upper leg", "attachment": "right-upper-leg" },
{ "name": "torso", "bone": "torso", "attachment": "torso" },
{ "name": "neck", "bone": "neck", "attachment": "neck" },
{ "name": "head", "bone": "head", "attachment": "head" },
{ "name": "eyes", "bone": "head", "attachment": "eyes" },
{ "name": "right shoulder", "bone": "right shoulder", "attachment": "right-shoulder" },
{ "name": "right arm", "bone": "right arm", "attachment": "right-arm" },
{ "name": "right hand", "bone": "right hand", "attachment": "right-hand" }
],
"skins": {
"default": {
"left shoulder": {
"left-shoulder": { "x": 23.74, "y": 0.11, "rotation": 62.01, "width": 34, "height": 53 }
},
"left arm": {
"left-arm": { "x": 15.11, "y": -0.44, "rotation": 33.84, "width": 35, "height": 29 }
},
"left hand": {
"left-hand": { "x": 0.75, "y": 1.86, "rotation": 31.14, "width": 35, "height": 38 }
},
"left foot": {
"left-foot": { "x": 24.35, "y": 8.88, "rotation": 3.32, "width": 65, "height": 30 }
},
"left lower leg": {
"left-lower-leg": { "x": 24.55, "y": -1.92, "rotation": 105.75, "width": 49, "height": 64 }
},
"left upper leg": {
"left-upper-leg": { "x": 26.12, "y": -1.85, "rotation": 89.09, "width": 33, "height": 67 }
},
"pelvis": {
"pelvis": { "x": -4.83, "y": 10.62, "width": 63, "height": 47 }
},
"right foot": {
"right-foot": { "x": 19.02, "y": 8.47, "rotation": 1.52, "width": 67, "height": 30 }
},
"right lower leg": {
"right-lower-leg": { "x": 23.28, "y": -2.59, "rotation": 111.83, "width": 51, "height": 64 }
},
"right upper leg": {
"right-upper-leg": { "x": 23.03, "y": 0.25, "rotation": 101.13, "width": 44, "height": 70 }
},
"torso": {
"torso": { "x": 44.57, "y": -7.08, "rotation": -94.95, "width": 68, "height": 92 }
},
"neck": {
"neck": { "x": 9.42, "y": -3.66, "rotation": -100.15, "width": 34, "height": 28 }
},
"head": {
"head": { "x": 53.94, "y": -5.75, "rotation": -86.9, "width": 121, "height": 132 }
},
"eyes": {
"eyes": { "x": 28.94, "y": -32.92, "rotation": -86.9, "width": 34, "height": 27 },
"eyes-closed": { "x": 28.77, "y": -32.86, "rotation": -86.9, "width": 34, "height": 27 }
},
"right shoulder": {
"right-shoulder": { "x": 25.86, "y": 0.03, "rotation": 134.44, "width": 52, "height": 51 }
},
"right arm": {
"right-arm": { "x": 18.34, "y": -2.64, "rotation": 94.32, "width": 21, "height": 45 }
},
"right hand": {
"right-hand": { "x": 6.82, "y": 1.25, "rotation": 91.96, "width": 32, "height": 32 }
}
}
},
"animations": {
"walk": {
"bones": {
"left upper leg": {
"rotate": [
{ "time": 0, "angle": -26.55 },
{ "time": 0.1333, "angle": -8.78 },
{ "time": 0.2666, "angle": 9.51 },
{ "time": 0.4, "angle": 30.74 },
{ "time": 0.5333, "angle": 25.33 },
{ "time": 0.6666, "angle": 26.11 },
{ "time": 0.8, "angle": -7.7 },
{ "time": 0.9333, "angle": -21.19 },
{ "time": 1.0666, "angle": -26.55 }
],
"translate": [
{ "time": 0, "x": -3, "y": -2.25 },
{ "time": 0.4, "x": -2.18, "y": -2.25 },
{ "time": 1.0666, "x": -3, "y": -2.25 }
]
},
"right upper leg": {
"rotate": [
{ "time": 0, "angle": 42.45 },
{ "time": 0.1333, "angle": 52.1 },
{ "time": 0.2666, "angle": 5.96 },
{ "time": 0.5333, "angle": -16.93 },
{ "time": 0.6666, "angle": 1.89 },
{
"time": 0.8,
"angle": 28.06,
"curve": [ 0.462, 0.11, 1, 1 ]
},
{
"time": 0.9333,
"angle": 58.68,
"curve": [ 0.5, 0.02, 1, 1 ]
},
{ "time": 1.0666, "angle": 42.45 }
],
"translate": [
{ "time": 0, "x": 8.11, "y": -2.36 },
{ "time": 0.1333, "x": 10.03, "y": -2.56 },
{ "time": 0.4, "x": 2.76, "y": -2.97 },
{ "time": 0.5333, "x": 2.76, "y": -2.81 },
{ "time": 0.9333, "x": 8.67, "y": -2.54 },
{ "time": 1.0666, "x": 8.11, "y": -2.36 }
]
},
"left lower leg": {
"rotate": [
{ "time": 0, "angle": -10.21 },
{ "time": 0.1333, "angle": -55.64 },
{ "time": 0.2666, "angle": -68.12 },
{ "time": 0.5333, "angle": 5.11 },
{ "time": 0.6666, "angle": -28.29 },
{ "time": 0.8, "angle": 4.08 },
{ "time": 0.9333, "angle": 3.53 },
{ "time": 1.0666, "angle": -10.21 }
]
},
"left foot": {
"rotate": [
{ "time": 0, "angle": -3.69 },
{ "time": 0.1333, "angle": -10.42 },
{ "time": 0.2666, "angle": -17.14 },
{ "time": 0.4, "angle": -2.83 },
{ "time": 0.5333, "angle": -3.87 },
{ "time": 0.6666, "angle": 2.78 },
{ "time": 0.8, "angle": 1.68 },
{ "time": 0.9333, "angle": -8.54 },
{ "time": 1.0666, "angle": -3.69 }
]
},
"right shoulder": {
"rotate": [
{
"time": 0,
"angle": 20.89,
"curve": [ 0.264, 0, 0.75, 1 ]
},
{
"time": 0.1333,
"angle": 3.72,
"curve": [ 0.272, 0, 0.841, 1 ]
},
{ "time": 0.6666, "angle": -278.28 },
{ "time": 1.0666, "angle": 20.89 }
],
"translate": [
{ "time": 0, "x": -7.84, "y": 7.19 },
{ "time": 0.1333, "x": -6.36, "y": 6.42 },
{ "time": 0.6666, "x": -11.07, "y": 5.25 },
{ "time": 1.0666, "x": -7.84, "y": 7.19 }
]
},
"right arm": {
"rotate": [
{
"time": 0,
"angle": -4.02,
"curve": [ 0.267, 0, 0.804, 0.99 ]
},
{
"time": 0.1333,
"angle": -13.99,
"curve": [ 0.341, 0, 1, 1 ]
},
{
"time": 0.6666,
"angle": 36.54,
"curve": [ 0.307, 0, 0.787, 0.99 ]
},
{ "time": 1.0666, "angle": -4.02 }
]
},
"right hand": {
"rotate": [
{ "time": 0, "angle": 22.92 },
{ "time": 0.4, "angle": -8.97 },
{ "time": 0.6666, "angle": 0.51 },
{ "time": 1.0666, "angle": 22.92 }
]
},
"left shoulder": {
"rotate": [
{ "time": 0, "angle": -1.47 },
{ "time": 0.1333, "angle": 13.6 },
{ "time": 0.6666, "angle": 280.74 },
{ "time": 1.0666, "angle": -1.47 }
],
"translate": [
{ "time": 0, "x": -1.76, "y": 0.56 },
{ "time": 0.6666, "x": -2.47, "y": 8.14 },
{ "time": 1.0666, "x": -1.76, "y": 0.56 }
]
},
"left hand": {
"rotate": [
{
"time": 0,
"angle": 11.58,
"curve": [ 0.169, 0.37, 0.632, 1.55 ]
},
{
"time": 0.1333,
"angle": 28.13,
"curve": [ 0.692, 0, 0.692, 0.99 ]
},
{
"time": 0.6666,
"angle": -27.42,
"curve": [ 0.117, 0.41, 0.738, 1.76 ]
},
{ "time": 0.8, "angle": -36.32 },
{ "time": 1.0666, "angle": 11.58 }
]
},
"left arm": {
"rotate": [
{ "time": 0, "angle": -8.27 },
{ "time": 0.1333, "angle": 18.43 },
{ "time": 0.6666, "angle": 0.88 },
{ "time": 1.0666, "angle": -8.27 }
]
},
"torso": {
"rotate": [
{ "time": 0, "angle": -10.28 },
{
"time": 0.1333,
"angle": -15.38,
"curve": [ 0.545, 0, 1, 1 ]
},
{
"time": 0.4,
"angle": -9.78,
"curve": [ 0.58, 0.17, 1, 1 ]
},
{ "time": 0.6666, "angle": -15.75 },
{ "time": 0.9333, "angle": -7.06 },
{ "time": 1.0666, "angle": -10.28 }
],
"translate": [
{ "time": 0, "x": -3.67, "y": 1.68 },
{ "time": 0.1333, "x": -3.67, "y": 0.68 },
{ "time": 0.4, "x": -3.67, "y": 1.97 },
{ "time": 0.6666, "x": -3.67, "y": -0.14 },
{ "time": 1.0666, "x": -3.67, "y": 1.68 }
]
},
"right foot": {
"rotate": [
{ "time": 0, "angle": -5.25 },
{ "time": 0.2666, "angle": -4.08 },
{ "time": 0.4, "angle": -6.45 },
{ "time": 0.5333, "angle": -5.39 },
{ "time": 0.8, "angle": -11.68 },
{ "time": 0.9333, "angle": 0.46 },
{ "time": 1.0666, "angle": -5.25 }
]
},
"right lower leg": {
"rotate": [
{ "time": 0, "angle": -3.39 },
{ "time": 0.1333, "angle": -45.53 },
{ "time": 0.2666, "angle": -2.59 },
{ "time": 0.5333, "angle": -19.53 },
{ "time": 0.6666, "angle": -64.8 },
{
"time": 0.8,
"angle": -82.56,
"curve": [ 0.557, 0.18, 1, 1 ]
},
{ "time": 1.0666, "angle": -3.39 }
]
},
"hip": {
"rotate": [
{ "time": 0, "angle": 0, "curve": "stepped" },
{ "time": 1.0666, "angle": 0 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0 },
{
"time": 0.1333,
"x": 0,
"y": -7.61,
"curve": [ 0.272, 0.86, 1, 1 ]
},
{ "time": 0.4, "x": 0, "y": 8.7 },
{ "time": 0.5333, "x": 0, "y": -0.41 },
{
"time": 0.6666,
"x": 0,
"y": -7.05,
"curve": [ 0.235, 0.89, 1, 1 ]
},
{ "time": 0.8, "x": 0, "y": 2.92 },
{ "time": 0.9333, "x": 0, "y": 6.78 },
{ "time": 1.0666, "x": 0, "y": 0 }
]
},
"neck": {
"rotate": [
{ "time": 0, "angle": 3.6 },
{ "time": 0.1333, "angle": 17.49 },
{ "time": 0.2666, "angle": 6.1 },
{ "time": 0.4, "angle": 3.45 },
{ "time": 0.5333, "angle": 5.17 },
{ "time": 0.6666, "angle": 18.36 },
{ "time": 0.8, "angle": 6.09 },
{ "time": 0.9333, "angle": 2.28 },
{ "time": 1.0666, "angle": 3.6 }
]
},
"head": {
"rotate": [
{
"time": 0,
"angle": 3.6,
"curve": [ 0, 0, 0.704, 1.61 ]
},
{ "time": 0.1666, "angle": -0.2 },
{ "time": 0.2666, "angle": 6.1 },
{ "time": 0.4, "angle": 3.45 },
{
"time": 0.5333,
"angle": 5.17,
"curve": [ 0, 0, 0.704, 1.61 ]
},
{ "time": 0.7, "angle": 1.1 },
{ "time": 0.8, "angle": 6.09 },
{ "time": 0.9333, "angle": 2.28 },
{ "time": 1.0666, "angle": 3.6 }
]
}
}
},
"jump": {
"bones": {
"hip": {
"rotate": [
{ "time": 0, "angle": 0, "curve": "stepped" },
{ "time": 0.9333, "angle": 0, "curve": "stepped" },
{ "time": 1.3666, "angle": 0 }
],
"translate": [
{ "time": 0, "x": -11.57, "y": -3 },
{ "time": 0.2333, "x": -16.2, "y": -19.43 },
{
"time": 0.3333,
"x": 7.66,
"y": -8.48,
"curve": [ 0.057, 0.06, 0.712, 1 ]
},
{ "time": 0.3666, "x": 15.38, "y": 5.01 },
{ "time": 0.4666, "x": -7.84, "y": 57.22 },
{
"time": 0.6,
"x": -10.81,
"y": 96.34,
"curve": [ 0.241, 0, 1, 1 ]
},
{ "time": 0.7333, "x": -7.01, "y": 54.7 },
{ "time": 0.8, "x": -10.58, "y": 32.2 },
{ "time": 0.9333, "x": -31.99, "y": 0.45 },
{ "time": 1.0666, "x": -12.48, "y": -29.47 },
{ "time": 1.3666, "x": -11.57, "y": -3 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left upper leg": {
"rotate": [
{ "time": 0, "angle": 17.13 },
{ "time": 0.2333, "angle": 44.35 },
{ "time": 0.3333, "angle": 16.46 },
{ "time": 0.4, "angle": -9.88 },
{ "time": 0.4666, "angle": -11.42 },
{ "time": 0.5666, "angle": 23.46 },
{ "time": 0.7666, "angle": 71.82 },
{ "time": 0.9333, "angle": 65.53 },
{ "time": 1.0666, "angle": 51.01 },
{ "time": 1.3666, "angle": 17.13 }
],
"translate": [
{ "time": 0, "x": -3, "y": -2.25, "curve": "stepped" },
{ "time": 0.9333, "x": -3, "y": -2.25, "curve": "stepped" },
{ "time": 1.3666, "x": -3, "y": -2.25 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left lower leg": {
"rotate": [
{ "time": 0, "angle": -16.25 },
{ "time": 0.2333, "angle": -52.21 },
{ "time": 0.4, "angle": 15.04 },
{ "time": 0.4666, "angle": -8.95 },
{ "time": 0.5666, "angle": -39.53 },
{ "time": 0.7666, "angle": -27.27 },
{ "time": 0.9333, "angle": -3.52 },
{ "time": 1.0666, "angle": -61.92 },
{ "time": 1.3666, "angle": -16.25 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left foot": {
"rotate": [
{ "time": 0, "angle": 0.33 },
{ "time": 0.2333, "angle": 6.2 },
{ "time": 0.3333, "angle": 14.73 },
{ "time": 0.4, "angle": -15.54 },
{ "time": 0.4333, "angle": -21.2 },
{ "time": 0.5666, "angle": -7.55 },
{ "time": 0.7666, "angle": -0.67 },
{ "time": 0.9333, "angle": -0.58 },
{ "time": 1.0666, "angle": 14.64 },
{ "time": 1.3666, "angle": 0.33 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right upper leg": {
"rotate": [
{ "time": 0, "angle": 25.97 },
{ "time": 0.2333, "angle": 46.43 },
{ "time": 0.3333, "angle": 22.61 },
{ "time": 0.4, "angle": 2.13 },
{
"time": 0.4666,
"angle": 0.04,
"curve": [ 0, 0, 0.637, 0.98 ]
},
{ "time": 0.6, "angle": 65.55 },
{ "time": 0.7666, "angle": 64.93 },
{ "time": 0.9333, "angle": 41.08 },
{ "time": 1.0666, "angle": 66.25 },
{ "time": 1.3666, "angle": 25.97 }
],
"translate": [
{ "time": 0, "x": 5.74, "y": 0.61 },
{ "time": 0.2333, "x": 4.79, "y": 1.79 },
{ "time": 0.3333, "x": 6.05, "y": -4.55 },
{ "time": 0.9333, "x": 4.79, "y": 1.79, "curve": "stepped" },
{ "time": 1.0666, "x": 4.79, "y": 1.79 },
{ "time": 1.3666, "x": 5.74, "y": 0.61 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right lower leg": {
"rotate": [
{ "time": 0, "angle": -27.46 },
{ "time": 0.2333, "angle": -64.03 },
{ "time": 0.4, "angle": -48.36 },
{ "time": 0.5666, "angle": -76.86 },
{ "time": 0.7666, "angle": -26.89 },
{ "time": 0.9, "angle": -18.97 },
{ "time": 0.9333, "angle": -14.18 },
{ "time": 1.0666, "angle": -80.45 },
{ "time": 1.3666, "angle": -27.46 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right foot": {
"rotate": [
{ "time": 0, "angle": 1.08 },
{ "time": 0.2333, "angle": 16.02 },
{ "time": 0.3, "angle": 12.94 },
{ "time": 0.3333, "angle": 15.16 },
{ "time": 0.4, "angle": -14.7 },
{ "time": 0.4333, "angle": -12.85 },
{ "time": 0.4666, "angle": -19.18 },
{ "time": 0.5666, "angle": -15.82 },
{ "time": 0.6, "angle": -3.59 },
{ "time": 0.7666, "angle": -3.56 },
{ "time": 0.9333, "angle": 1.86 },
{ "time": 1.0666, "angle": 16.02 },
{ "time": 1.3666, "angle": 1.08 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"torso": {
"rotate": [
{ "time": 0, "angle": -13.35 },
{ "time": 0.2333, "angle": -48.95 },
{ "time": 0.4333, "angle": -35.77 },
{ "time": 0.6, "angle": -4.59 },
{ "time": 0.7666, "angle": 14.61 },
{ "time": 0.9333, "angle": 15.74 },
{ "time": 1.0666, "angle": -32.44 },
{ "time": 1.3666, "angle": -13.35 }
],
"translate": [
{ "time": 0, "x": -3.67, "y": 1.68, "curve": "stepped" },
{ "time": 0.9333, "x": -3.67, "y": 1.68, "curve": "stepped" },
{ "time": 1.3666, "x": -3.67, "y": 1.68 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"neck": {
"rotate": [
{ "time": 0, "angle": 12.78 },
{ "time": 0.2333, "angle": 16.46 },
{ "time": 0.4, "angle": 26.49 },
{ "time": 0.6, "angle": 15.51 },
{ "time": 0.7666, "angle": 1.34 },
{ "time": 0.9333, "angle": 2.35 },
{ "time": 1.0666, "angle": 6.08 },
{ "time": 1.3, "angle": 21.23 },
{ "time": 1.3666, "angle": 12.78 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"head": {
"rotate": [
{ "time": 0, "angle": 5.19 },
{ "time": 0.2333, "angle": 20.27 },
{ "time": 0.4, "angle": 15.27 },
{ "time": 0.6, "angle": -24.69 },
{ "time": 0.7666, "angle": -11.02 },
{ "time": 0.9333, "angle": -24.38 },
{ "time": 1.0666, "angle": 11.99 },
{ "time": 1.3, "angle": 4.86 },
{ "time": 1.3666, "angle": 5.19 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left shoulder": {
"rotate": [
{
"time": 0,
"angle": 0.05,
"curve": [ 0, 0, 0.62, 1 ]
},
{
"time": 0.2333,
"angle": 279.66,
"curve": [ 0.218, 0.67, 0.66, 0.99 ]
},
{
"time": 0.5,
"angle": 62.27,
"curve": [ 0.462, 0, 0.764, 0.58 ]
},
{ "time": 0.9333, "angle": 28.91 },
{ "time": 1.0666, "angle": -8.62 },
{ "time": 1.1666, "angle": -18.43 },
{ "time": 1.3666, "angle": 0.05 }
],
"translate": [
{ "time": 0, "x": -1.76, "y": 0.56, "curve": "stepped" },
{ "time": 0.9333, "x": -1.76, "y": 0.56, "curve": "stepped" },
{ "time": 1.3666, "x": -1.76, "y": 0.56 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left hand": {
"rotate": [
{ "time": 0, "angle": 11.58, "curve": "stepped" },
{ "time": 0.9333, "angle": 11.58, "curve": "stepped" },
{ "time": 1.3666, "angle": 11.58 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"left arm": {
"rotate": [
{ "time": 0, "angle": 0.51 },
{ "time": 0.4333, "angle": 12.82 },
{ "time": 0.6, "angle": 47.55 },
{ "time": 0.9333, "angle": 12.82 },
{ "time": 1.1666, "angle": -6.5 },
{ "time": 1.3666, "angle": 0.51 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right shoulder": {
"rotate": [
{
"time": 0,
"angle": 43.82,
"curve": [ 0, 0, 0.62, 1 ]
},
{
"time": 0.2333,
"angle": -8.74,
"curve": [ 0.304, 0.58, 0.709, 0.97 ]
},
{
"time": 0.5333,
"angle": -208.02,
"curve": [ 0.462, 0, 0.764, 0.58 ]
},
{ "time": 0.9333, "angle": -246.72 },
{ "time": 1.0666, "angle": -307.13 },
{ "time": 1.1666, "angle": 37.15 },
{ "time": 1.3666, "angle": 43.82 }
],
"translate": [
{ "time": 0, "x": -7.84, "y": 7.19, "curve": "stepped" },
{ "time": 0.9333, "x": -7.84, "y": 7.19, "curve": "stepped" },
{ "time": 1.3666, "x": -7.84, "y": 7.19 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right arm": {
"rotate": [
{ "time": 0, "angle": -4.02 },
{ "time": 0.6, "angle": 17.5 },
{ "time": 0.9333, "angle": -4.02 },
{ "time": 1.1666, "angle": -16.72 },
{ "time": 1.3666, "angle": -4.02 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"right hand": {
"rotate": [
{ "time": 0, "angle": 22.92, "curve": "stepped" },
{ "time": 0.9333, "angle": 22.92, "curve": "stepped" },
{ "time": 1.3666, "angle": 22.92 }
],
"translate": [
{ "time": 0, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 0.9333, "x": 0, "y": 0, "curve": "stepped" },
{ "time": 1.3666, "x": 0, "y": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 0.9333, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
},
"root": {
"rotate": [
{ "time": 0, "angle": 0 },
{ "time": 0.4333, "angle": -14.52 },
{ "time": 0.8, "angle": 9.86 },
{ "time": 1.3666, "angle": 0 }
],
"scale": [
{ "time": 0, "x": 1, "y": 1, "curve": "stepped" },
{ "time": 1.3666, "x": 1, "y": 1 }
]
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flexLibProperties includeAllClasses="true" useMultiPlatformConfig="false" version="3">
<includeClasses>
<classEntry path="spine.atlas.Atlas"/>
<classEntry path="spine.atlas.TextureLoader"/>
<classEntry path="spine.flash.SingleTextureLoader"/>
<classEntry path="spine.attachments.AtlasAttachmentLoader"/>
<classEntry path="spine.flash.SkeletonAnimationSprite"/>
</includeClasses>
<includeResources/>
<namespaceManifests/>
</flexLibProperties>

View File

@ -0,0 +1,6 @@
/* This CSS stylesheet defines styles used by required elements in a flex application page that supports browser history */
#ie_historyFrame { width: 0px; height: 0px; display:none }
#firefox_anchorDiv { width: 0px; height: 0px; display:none }
#safari_formDiv { width: 0px; height: 0px; display:none }
#safari_rememberDiv { width: 0px; height: 0px; display:none }

View File

@ -0,0 +1,678 @@
BrowserHistoryUtils = {
addEvent: function(elm, evType, fn, useCapture) {
useCapture = useCapture || false;
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
}
BrowserHistory = (function() {
// type of browser
var browser = {
ie: false,
ie8: false,
firefox: false,
safari: false,
opera: false,
version: -1
};
// Default app state URL to use when no fragment ID present
var defaultHash = '';
// Last-known app state URL
var currentHref = document.location.href;
// Initial URL (used only by IE)
var initialHref = document.location.href;
// Initial URL (used only by IE)
var initialHash = document.location.hash;
// History frame source URL prefix (used only by IE)
var historyFrameSourcePrefix = 'history/historyFrame.html?';
// History maintenance (used only by Safari)
var currentHistoryLength = -1;
// Flag to denote the existence of onhashchange
var browserHasHashChange = false;
var historyHash = [];
var initialState = createState(initialHref, initialHref + '#' + initialHash, initialHash);
var backStack = [];
var forwardStack = [];
var currentObjectId = null;
//UserAgent detection
var useragent = navigator.userAgent.toLowerCase();
if (useragent.indexOf("opera") != -1) {
browser.opera = true;
} else if (useragent.indexOf("msie") != -1) {
browser.ie = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('msie') + 4));
if (browser.version == 8)
{
browser.ie = false;
browser.ie8 = true;
}
} else if (useragent.indexOf("safari") != -1) {
browser.safari = true;
browser.version = parseFloat(useragent.substring(useragent.indexOf('safari') + 7));
} else if (useragent.indexOf("gecko") != -1) {
browser.firefox = true;
}
if (browser.ie == true && browser.version == 7) {
window["_ie_firstload"] = false;
}
function hashChangeHandler()
{
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
// Accessor functions for obtaining specific elements of the page.
function getHistoryFrame()
{
return document.getElementById('ie_historyFrame');
}
function getFormElement()
{
return document.getElementById('safari_formDiv');
}
function getRememberElement()
{
return document.getElementById("safari_remember_field");
}
// Get the Flash player object for performing ExternalInterface callbacks.
// Updated for changes to SWFObject2.
function getPlayer(id) {
var i;
if (id && document.getElementById(id)) {
var r = document.getElementById(id);
if (typeof r.SetVariable != "undefined") {
return r;
}
else {
var o = r.getElementsByTagName("object");
var e = r.getElementsByTagName("embed");
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
return o[i];
}
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
return e[i];
}
}
}
else {
var o = document.getElementsByTagName("object");
var e = document.getElementsByTagName("embed");
for (i = 0; i < e.length; i++) {
if (typeof e[i].browserURLChange != "undefined")
{
return e[i];
}
}
for (i = 0; i < o.length; i++) {
if (typeof o[i].browserURLChange != "undefined")
{
return o[i];
}
}
}
return undefined;
}
function getPlayers() {
var i;
var players = [];
if (players.length == 0) {
var tmp = document.getElementsByTagName('object');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
if (players.length == 0 || players[0].object == null) {
var tmp = document.getElementsByTagName('embed');
for (i = 0; i < tmp.length; i++)
{
if (typeof tmp[i].browserURLChange != "undefined")
players.push(tmp[i]);
}
}
return players;
}
function getIframeHash() {
var doc = getHistoryFrame().contentWindow.document;
var hash = String(doc.location.search);
if (hash.length == 1 && hash.charAt(0) == "?") {
hash = "";
}
else if (hash.length >= 2 && hash.charAt(0) == "?") {
hash = hash.substring(1);
}
return hash;
}
/* Get the current location hash excluding the '#' symbol. */
function getHash() {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
var idx = document.location.href.indexOf('#');
return (idx >= 0) ? document.location.href.substr(idx+1) : '';
}
/* Get the current location hash excluding the '#' symbol. */
function setHash(hash) {
// It would be nice if we could use document.location.hash here,
// but it's faulty sometimes.
if (hash == '') hash = '#'
document.location.hash = hash;
}
function createState(baseUrl, newUrl, flexAppUrl) {
return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };
}
/* Add a history entry to the browser.
* baseUrl: the portion of the location prior to the '#'
* newUrl: the entire new URL, including '#' and following fragment
* flexAppUrl: the portion of the location following the '#' only
*/
function addHistoryEntry(baseUrl, newUrl, flexAppUrl) {
//delete all the history entries
forwardStack = [];
if (browser.ie) {
//Check to see if we are being asked to do a navigate for the first
//history entry, and if so ignore, because it's coming from the creation
//of the history iframe
if (flexAppUrl == defaultHash && document.location.href == initialHref && window['_ie_firstload']) {
currentHref = initialHref;
return;
}
if ((!flexAppUrl || flexAppUrl == defaultHash) && window['_ie_firstload']) {
newUrl = baseUrl + '#' + defaultHash;
flexAppUrl = defaultHash;
} else {
// for IE, tell the history frame to go somewhere without a '#'
// in order to get this entry into the browser history.
getHistoryFrame().src = historyFrameSourcePrefix + flexAppUrl;
}
setHash(flexAppUrl);
} else {
//ADR
if (backStack.length == 0 && initialState.flexAppUrl == flexAppUrl) {
initialState = createState(baseUrl, newUrl, flexAppUrl);
} else if(backStack.length > 0 && backStack[backStack.length - 1].flexAppUrl == flexAppUrl) {
backStack[backStack.length - 1] = createState(baseUrl, newUrl, flexAppUrl);
}
if (browser.safari && !browserHasHashChange) {
// for Safari, submit a form whose action points to the desired URL
if (browser.version <= 419.3) {
var file = window.location.pathname.toString();
file = file.substring(file.lastIndexOf("/")+1);
getFormElement().innerHTML = '<form name="historyForm" action="'+file+'#' + flexAppUrl + '" method="GET"></form>';
//get the current elements and add them to the form
var qs = window.location.search.substring(1);
var qs_arr = qs.split("&");
for (var i = 0; i < qs_arr.length; i++) {
var tmp = qs_arr[i].split("=");
var elem = document.createElement("input");
elem.type = "hidden";
elem.name = tmp[0];
elem.value = tmp[1];
document.forms.historyForm.appendChild(elem);
}
document.forms.historyForm.submit();
} else {
top.location.hash = flexAppUrl;
}
// We also have to maintain the history by hand for Safari
historyHash[history.length] = flexAppUrl;
_storeStates();
} else {
// Otherwise, just tell the browser to go there
setHash(flexAppUrl);
}
}
backStack.push(createState(baseUrl, newUrl, flexAppUrl));
}
function _storeStates() {
if (browser.safari) {
getRememberElement().value = historyHash.join(",");
}
}
function handleBackButton() {
//The "current" page is always at the top of the history stack.
var current = backStack.pop();
if (!current) { return; }
var last = backStack[backStack.length - 1];
if (!last && backStack.length == 0){
last = initialState;
}
forwardStack.push(current);
}
function handleForwardButton() {
//summary: private method. Do not call this directly.
var last = forwardStack.pop();
if (!last) { return; }
backStack.push(last);
}
function handleArbitraryUrl() {
//delete all the history entries
forwardStack = [];
}
/* Called periodically to poll to see if we need to detect navigation that has occurred */
function checkForUrlChange() {
if (browser.ie) {
if (currentHref != document.location.href && currentHref + '#' != document.location.href) {
//This occurs when the user has navigated to a specific URL
//within the app, and didn't use browser back/forward
//IE seems to have a bug where it stops updating the URL it
//shows the end-user at this point, but programatically it
//appears to be correct. Do a full app reload to get around
//this issue.
if (browser.version < 7) {
currentHref = document.location.href;
document.location.reload();
} else {
if (getHash() != getIframeHash()) {
// this.iframe.src = this.blankURL + hash;
var sourceToSet = historyFrameSourcePrefix + getHash();
getHistoryFrame().src = sourceToSet;
currentHref = document.location.href;
}
}
}
}
if (browser.safari && !browserHasHashChange) {
// For Safari, we have to check to see if history.length changed.
if (currentHistoryLength >= 0 && history.length != currentHistoryLength) {
//alert("did change: " + history.length + ", " + historyHash.length + "|" + historyHash[history.length] + "|>" + historyHash.join("|"));
var flexAppUrl = getHash();
if (browser.version < 528.16 /* Anything earlier than Safari 4.0 */)
{
// If it did change and we're running Safari 3.x or earlier,
// then we have to look the old state up in our hand-maintained
// array since document.location.hash won't have changed,
// then call back into BrowserManager.
currentHistoryLength = history.length;
flexAppUrl = historyHash[currentHistoryLength];
}
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
_storeStates();
}
}
if (browser.firefox && !browserHasHashChange) {
if (currentHref != document.location.href) {
var bsl = backStack.length;
var urlActions = {
back: false,
forward: false,
set: false
}
if ((window.location.hash == initialHash || window.location.href == initialHref) && (bsl == 1)) {
urlActions.back = true;
// FIXME: could this ever be a forward button?
// we can't clear it because we still need to check for forwards. Ugg.
// clearInterval(this.locationTimer);
handleBackButton();
}
// first check to see if we could have gone forward. We always halt on
// a no-hash item.
if (forwardStack.length > 0) {
if (forwardStack[forwardStack.length-1].flexAppUrl == getHash()) {
urlActions.forward = true;
handleForwardButton();
}
}
// ok, that didn't work, try someplace back in the history stack
if ((bsl >= 2) && (backStack[bsl - 2])) {
if (backStack[bsl - 2].flexAppUrl == getHash()) {
urlActions.back = true;
handleBackButton();
}
}
if (!urlActions.back && !urlActions.forward) {
var foundInStacks = {
back: -1,
forward: -1
}
for (var i = 0; i < backStack.length; i++) {
if (backStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.back = i;
}
}
for (var i = 0; i < forwardStack.length; i++) {
if (forwardStack[i].flexAppUrl == getHash() && i != (bsl - 2)) {
arbitraryUrl = true;
foundInStacks.forward = i;
}
}
handleArbitraryUrl();
}
// Firefox changed; do a callback into BrowserManager to tell it.
currentHref = document.location.href;
var flexAppUrl = getHash();
//ADR: to fix multiple
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
pl[i].browserURLChange(flexAppUrl);
}
} else {
getPlayer().browserURLChange(flexAppUrl);
}
}
}
}
var _initialize = function () {
browserHasHashChange = ("onhashchange" in document.body);
if (browser.ie)
{
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
var iframe_location = (new String(s.src)).replace("history.js", "historyFrame.html");
}
}
historyFrameSourcePrefix = iframe_location + "?";
var src = historyFrameSourcePrefix;
var iframe = document.createElement("iframe");
iframe.id = 'ie_historyFrame';
iframe.name = 'ie_historyFrame';
iframe.src = 'javascript:false;';
try {
document.body.appendChild(iframe);
} catch(e) {
setTimeout(function() {
document.body.appendChild(iframe);
}, 0);
}
}
if (browser.safari && !browserHasHashChange)
{
var rememberDiv = document.createElement("div");
rememberDiv.id = 'safari_rememberDiv';
document.body.appendChild(rememberDiv);
rememberDiv.innerHTML = '<input type="text" id="safari_remember_field" style="width: 500px;">';
var formDiv = document.createElement("div");
formDiv.id = 'safari_formDiv';
document.body.appendChild(formDiv);
var reloader_content = document.createElement('div');
reloader_content.id = 'safarireloader';
var scripts = document.getElementsByTagName('script');
for (var i = 0, s; s = scripts[i]; i++) {
if (s.src.indexOf("history.js") > -1) {
html = (new String(s.src)).replace(".js", ".html");
}
}
reloader_content.innerHTML = '<iframe id="safarireloader-iframe" src="about:blank" frameborder="no" scrolling="no"></iframe>';
document.body.appendChild(reloader_content);
reloader_content.style.position = 'absolute';
reloader_content.style.left = reloader_content.style.top = '-9999px';
iframe = reloader_content.getElementsByTagName('iframe')[0];
if (document.getElementById("safari_remember_field").value != "" ) {
historyHash = document.getElementById("safari_remember_field").value.split(",");
}
}
if (browserHasHashChange)
document.body.onhashchange = hashChangeHandler;
}
return {
historyHash: historyHash,
backStack: function() { return backStack; },
forwardStack: function() { return forwardStack },
getPlayer: getPlayer,
initialize: function(src) {
_initialize(src);
},
setURL: function(url) {
document.location.href = url;
},
getURL: function() {
return document.location.href;
},
getTitle: function() {
return document.title;
},
setTitle: function(title) {
try {
backStack[backStack.length - 1].title = title;
} catch(e) { }
//if on safari, set the title to be the empty string.
if (browser.safari) {
if (title == "") {
try {
var tmp = window.location.href.toString();
title = tmp.substring((tmp.lastIndexOf("/")+1), tmp.lastIndexOf("#"));
} catch(e) {
title = "";
}
}
}
document.title = title;
},
setDefaultURL: function(def)
{
defaultHash = def;
def = getHash();
//trailing ? is important else an extra frame gets added to the history
//when navigating back to the first page. Alternatively could check
//in history frame navigation to compare # and ?.
if (browser.ie)
{
window['_ie_firstload'] = true;
var sourceToSet = historyFrameSourcePrefix + def;
var func = function() {
getHistoryFrame().src = sourceToSet;
window.location.replace("#" + def);
setInterval(checkForUrlChange, 50);
}
try {
func();
} catch(e) {
window.setTimeout(function() { func(); }, 0);
}
}
if (browser.safari)
{
currentHistoryLength = history.length;
if (historyHash.length == 0) {
historyHash[currentHistoryLength] = def;
var newloc = "#" + def;
window.location.replace(newloc);
} else {
//alert(historyHash[historyHash.length-1]);
}
setInterval(checkForUrlChange, 50);
}
if (browser.firefox || browser.opera)
{
var reg = new RegExp("#" + def + "$");
if (window.location.toString().match(reg)) {
} else {
var newloc ="#" + def;
window.location.replace(newloc);
}
setInterval(checkForUrlChange, 50);
}
},
/* Set the current browser URL; called from inside BrowserManager to propagate
* the application state out to the container.
*/
setBrowserURL: function(flexAppUrl, objectId) {
if (browser.ie && typeof objectId != "undefined") {
currentObjectId = objectId;
}
//fromIframe = fromIframe || false;
//fromFlex = fromFlex || false;
//alert("setBrowserURL: " + flexAppUrl);
//flexAppUrl = (flexAppUrl == "") ? defaultHash : flexAppUrl ;
var pos = document.location.href.indexOf('#');
var baseUrl = pos != -1 ? document.location.href.substr(0, pos) : document.location.href;
var newUrl = baseUrl + '#' + flexAppUrl;
if (document.location.href != newUrl && document.location.href + '#' != newUrl) {
currentHref = newUrl;
addHistoryEntry(baseUrl, newUrl, flexAppUrl);
currentHistoryLength = history.length;
}
},
browserURLChange: function(flexAppUrl) {
var objectId = null;
if (browser.ie && currentObjectId != null) {
objectId = currentObjectId;
}
if (typeof BrowserHistory_multiple != "undefined" && BrowserHistory_multiple == true) {
var pl = getPlayers();
for (var i = 0; i < pl.length; i++) {
try {
pl[i].browserURLChange(flexAppUrl);
} catch(e) { }
}
} else {
try {
getPlayer(objectId).browserURLChange(flexAppUrl);
} catch(e) { }
}
currentObjectId = null;
},
getUserAgent: function() {
return navigator.userAgent;
},
getPlatform: function() {
return navigator.platform;
}
}
})();
// Initialization
// Automated unit testing and other diagnostics
function setURL(url)
{
document.location.href = url;
}
function backButton()
{
history.back();
}
function forwardButton()
{
history.forward();
}
function goForwardOrBackInHistory(step)
{
history.go(step);
}
//BrowserHistoryUtils.addEvent(window, "load", function() { BrowserHistory.initialize(); });
(function(i) {
var u =navigator.userAgent;var e=/*@cc_on!@*/false;
var st = setTimeout;
if(/webkit/i.test(u)){
st(function(){
var dr=document.readyState;
if(dr=="loaded"||dr=="complete"){i()}
else{st(arguments.callee,10);}},10);
} else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
document.addEventListener("DOMContentLoaded",i,false);
} else if(e){
(function(){
var t=document.createElement('doc:rdy');
try{t.doScroll('left');
i();t=null;
}catch(e){st(arguments.callee,0);}})();
} else{
window.onload=i;
}
})( function() {BrowserHistory.initialize();} );

View File

@ -0,0 +1,29 @@
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</head>
<body>
<script>
function processUrl()
{
var pos = url.indexOf("?");
url = pos != -1 ? url.substr(pos + 1) : "";
if (!parent._ie_firstload) {
parent.BrowserHistory.setBrowserURL(url);
try {
parent.BrowserHistory.browserURLChange(url);
} catch(e) { }
} else {
parent._ie_firstload = false;
}
}
var url = document.location.href;
processUrl();
document.write(encodeURIComponent(url));
</script>
Hidden frame for Browser History support.
</body>
</html>

View File

@ -0,0 +1,108 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--
Smart developers always View Source.
This application was built using Adobe Flex, an open source framework
for building rich Internet applications that get delivered via the
Flash Player or to desktops via Adobe AIR.
Learn more about Flex at http://flex.org
// -->
<head>
<title>${title}</title>
<meta name="google" value="notranslate" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Include CSS to eliminate any default margins/padding and set the height of the html element and
the body element to 100%, because Firefox, or any Gecko based browser, interprets percentage as
the percentage of the height of its parent container, which has to be set explicitly. Fix for
Firefox 3.6 focus border issues. Initially, don't display flashContent div so it won't show
if JavaScript disabled.
-->
<style type="text/css" media="screen">
html, body { height:100%; }
body { margin:0; padding:0; overflow:auto; text-align:center;
background-color: ${bgcolor}; }
object:focus { outline:none; }
#flashContent { display:none; }
</style>
<!-- Enable Browser History by replacing useBrowserHistory tokens with two hyphens -->
<!-- BEGIN Browser History required section ${useBrowserHistory}>
<link rel="stylesheet" type="text/css" href="history/history.css" />
<script type="text/javascript" src="history/history.js"></script>
<!${useBrowserHistory} END Browser History required section -->
<script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "${version_major}.${version_minor}.${version_revision}";
// To use express install, set to playerProductInstall.swf, otherwise the empty string.
var xiSwfUrlStr = "${expressInstallSwf}";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "${bgcolor}";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "${application}";
attributes.name = "${application}";
attributes.align = "middle";
swfobject.embedSWF(
"${swf}.swf", "flashContent",
"${width}", "${height}",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</head>
<body>
<!-- SWFObject's dynamic embed method replaces this alternative HTML content with Flash content when enough
JavaScript and Flash plug-in support is available. The div is initially hidden so that it doesn't show
when JavaScript is disabled.
-->
<div id="flashContent">
<p>
To view this page ensure that Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is installed.
</p>
<script type="text/javascript">
var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://");
document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='"
+ pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" );
</script>
</div>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="${width}" height="${height}" id="${application}">
<param name="movie" value="${swf}.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="${swf}.swf" width="${width}" height="${height}">
<param name="quality" value="high" />
<param name="bgcolor" value="${bgcolor}" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<!--<![endif]-->
<!--[if gte IE 6]>-->
<p>
Either scripts and active content are not permitted to run or Adobe Flash Player version
${version_major}.${version_minor}.${version_revision} or greater is not installed.
</p>
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflashplayer">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</noscript>
</body>
</html>

View File

@ -0,0 +1,777 @@
/*! SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function() {
var UNDEF = "undefined",
OBJECT = "object",
SHOCKWAVE_FLASH = "Shockwave Flash",
SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
FLASH_MIME_TYPE = "application/x-shockwave-flash",
EXPRESS_INSTALL_ID = "SWFObjectExprInst",
ON_READY_STATE_CHANGE = "onreadystatechange",
win = window,
doc = document,
nav = navigator,
plugin = false,
domLoadFnArr = [main],
regObjArr = [],
objIdArr = [],
listenersArr = [],
storedAltContent,
storedAltContentId,
storedCallbackFn,
storedCallbackObj,
isDomLoaded = false,
isExpressInstallActive = false,
dynamicStylesheet,
dynamicStylesheetMedia,
autoHideShow = true,
/* Centralized function for browser feature detection
- User agent string detection is only used when no good alternative is possible
- Is executed directly for optimal performance
*/
ua = function() {
var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
u = nav.userAgent.toLowerCase(),
p = nav.platform.toLowerCase(),
windows = p ? /win/.test(p) : /win/.test(u),
mac = p ? /mac/.test(p) : /mac/.test(u),
webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit
ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html
playerVersion = [0,0,0],
d = null;
if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
d = nav.plugins[SHOCKWAVE_FLASH].description;
if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+
plugin = true;
ie = false; // cascaded feature detection for Internet Explorer
d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;
}
}
else if (typeof win.ActiveXObject != UNDEF) {
try {
var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);
if (a) { // a will return null when ActiveX is disabled
d = a.GetVariable("$version");
if (d) {
ie = true; // cascaded feature detection for Internet Explorer
d = d.split(" ")[1].split(",");
playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
}
catch(e) {}
}
return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };
}(),
/* Cross-browser onDomLoad
- Will fire an event as soon as the DOM of a web page is loaded
- Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/
- Regular onload serves as fallback
*/
onDomLoad = function() {
if (!ua.w3) { return; }
if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically
callDomLoadFunctions();
}
if (!isDomLoaded) {
if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);
}
if (ua.ie && ua.win) {
doc.attachEvent(ON_READY_STATE_CHANGE, function() {
if (doc.readyState == "complete") {
doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);
callDomLoadFunctions();
}
});
if (win == top) { // if not inside an iframe
(function(){
if (isDomLoaded) { return; }
try {
doc.documentElement.doScroll("left");
}
catch(e) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
}
if (ua.wk) {
(function(){
if (isDomLoaded) { return; }
if (!/loaded|complete/.test(doc.readyState)) {
setTimeout(arguments.callee, 0);
return;
}
callDomLoadFunctions();
})();
}
addLoadEvent(callDomLoadFunctions);
}
}();
function callDomLoadFunctions() {
if (isDomLoaded) { return; }
try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early
var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));
t.parentNode.removeChild(t);
}
catch (e) { return; }
isDomLoaded = true;
var dl = domLoadFnArr.length;
for (var i = 0; i < dl; i++) {
domLoadFnArr[i]();
}
}
function addDomLoadEvent(fn) {
if (isDomLoaded) {
fn();
}
else {
domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+
}
}
/* Cross-browser onload
- Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/
- Will fire an event as soon as a web page including all of its assets are loaded
*/
function addLoadEvent(fn) {
if (typeof win.addEventListener != UNDEF) {
win.addEventListener("load", fn, false);
}
else if (typeof doc.addEventListener != UNDEF) {
doc.addEventListener("load", fn, false);
}
else if (typeof win.attachEvent != UNDEF) {
addListener(win, "onload", fn);
}
else if (typeof win.onload == "function") {
var fnOld = win.onload;
win.onload = function() {
fnOld();
fn();
};
}
else {
win.onload = fn;
}
}
/* Main function
- Will preferably execute onDomLoad, otherwise onload (as a fallback)
*/
function main() {
if (plugin) {
testPlayerVersion();
}
else {
matchVersions();
}
}
/* Detect the Flash Player version for non-Internet Explorer browsers
- Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:
a. Both release and build numbers can be detected
b. Avoid wrong descriptions by corrupt installers provided by Adobe
c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports
- Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available
*/
function testPlayerVersion() {
var b = doc.getElementsByTagName("body")[0];
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
var t = b.appendChild(o);
if (t) {
var counter = 0;
(function(){
if (typeof t.GetVariable != UNDEF) {
var d = t.GetVariable("$version");
if (d) {
d = d.split(" ")[1].split(",");
ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
}
}
else if (counter < 10) {
counter++;
setTimeout(arguments.callee, 10);
return;
}
b.removeChild(o);
t = null;
matchVersions();
})();
}
else {
matchVersions();
}
}
/* Perform Flash Player and SWF version matching; static publishing only
*/
function matchVersions() {
var rl = regObjArr.length;
if (rl > 0) {
for (var i = 0; i < rl; i++) { // for each registered object element
var id = regObjArr[i].id;
var cb = regObjArr[i].callbackFn;
var cbObj = {success:false, id:id};
if (ua.pv[0] > 0) {
var obj = getElementById(id);
if (obj) {
if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!
setVisibility(id, true);
if (cb) {
cbObj.success = true;
cbObj.ref = getObjectById(id);
cb(cbObj);
}
}
else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported
var att = {};
att.data = regObjArr[i].expressInstall;
att.width = obj.getAttribute("width") || "0";
att.height = obj.getAttribute("height") || "0";
if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }
if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }
// parse HTML object param element's name-value pairs
var par = {};
var p = obj.getElementsByTagName("param");
var pl = p.length;
for (var j = 0; j < pl; j++) {
if (p[j].getAttribute("name").toLowerCase() != "movie") {
par[p[j].getAttribute("name")] = p[j].getAttribute("value");
}
}
showExpressInstall(att, par, id, cb);
}
else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF
displayAltContent(obj);
if (cb) { cb(cbObj); }
}
}
}
else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)
setVisibility(id, true);
if (cb) {
var o = getObjectById(id); // test whether there is an HTML object element or not
if (o && typeof o.SetVariable != UNDEF) {
cbObj.success = true;
cbObj.ref = o;
}
cb(cbObj);
}
}
}
}
}
function getObjectById(objectIdStr) {
var r = null;
var o = getElementById(objectIdStr);
if (o && o.nodeName == "OBJECT") {
if (typeof o.SetVariable != UNDEF) {
r = o;
}
else {
var n = o.getElementsByTagName(OBJECT)[0];
if (n) {
r = n;
}
}
}
return r;
}
/* Requirements for Adobe Express Install
- only one instance can be active at a time
- fp 6.0.65 or higher
- Win/Mac OS only
- no Webkit engines older than version 312
*/
function canExpressInstall() {
return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);
}
/* Show the Adobe Express Install dialog
- Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75
*/
function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {
isExpressInstallActive = true;
storedCallbackFn = callbackFn || null;
storedCallbackObj = {success:false, id:replaceElemIdStr};
var obj = getElementById(replaceElemIdStr);
if (obj) {
if (obj.nodeName == "OBJECT") { // static publishing
storedAltContent = abstractAltContent(obj);
storedAltContentId = null;
}
else { // dynamic publishing
storedAltContent = obj;
storedAltContentId = replaceElemIdStr;
}
att.id = EXPRESS_INSTALL_ID;
if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }
if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }
doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",
fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + fv;
}
else {
par.flashvars = fv;
}
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
if (ua.ie && ua.win && obj.readyState != 4) {
var newObj = createElement("div");
replaceElemIdStr += "SWFObjectNew";
newObj.setAttribute("id", replaceElemIdStr);
obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
createSWF(att, par, replaceElemIdStr);
}
}
/* Functions to abstract and display alternative content
*/
function displayAltContent(obj) {
if (ua.ie && ua.win && obj.readyState != 4) {
// IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,
// because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work
var el = createElement("div");
obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content
el.parentNode.replaceChild(abstractAltContent(obj), el);
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
obj.parentNode.removeChild(obj);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.replaceChild(abstractAltContent(obj), obj);
}
}
function abstractAltContent(obj) {
var ac = createElement("div");
if (ua.win && ua.ie) {
ac.innerHTML = obj.innerHTML;
}
else {
var nestedObj = obj.getElementsByTagName(OBJECT)[0];
if (nestedObj) {
var c = nestedObj.childNodes;
if (c) {
var cl = c.length;
for (var i = 0; i < cl; i++) {
if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
ac.appendChild(c[i].cloneNode(true));
}
}
}
}
}
return ac;
}
/* Cross-browser dynamic SWF creation
*/
function createSWF(attObj, parObj, id) {
var r, el = getElementById(id);
if (ua.wk && ua.wk < 312) { return r; }
if (el) {
if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
attObj.id = id;
}
if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML
var att = "";
for (var i in attObj) {
if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries
if (i.toLowerCase() == "data") {
parObj.movie = attObj[i];
}
else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
att += ' class="' + attObj[i] + '"';
}
else if (i.toLowerCase() != "classid") {
att += ' ' + i + '="' + attObj[i] + '"';
}
}
}
var par = "";
for (var j in parObj) {
if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries
par += '<param name="' + j + '" value="' + parObj[j] + '" />';
}
}
el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';
objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)
r = getElementById(attObj.id);
}
else { // well-behaving browsers
var o = createElement(OBJECT);
o.setAttribute("type", FLASH_MIME_TYPE);
for (var m in attObj) {
if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries
if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
o.setAttribute("class", attObj[m]);
}
else if (m.toLowerCase() != "classid") { // filter out IE specific attribute
o.setAttribute(m, attObj[m]);
}
}
}
for (var n in parObj) {
if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element
createObjParam(o, n, parObj[n]);
}
}
el.parentNode.replaceChild(o, el);
r = o;
}
}
return r;
}
function createObjParam(el, pName, pValue) {
var p = createElement("param");
p.setAttribute("name", pName);
p.setAttribute("value", pValue);
el.appendChild(p);
}
/* Cross-browser SWF removal
- Especially needed to safely and completely remove a SWF in Internet Explorer
*/
function removeSWF(id) {
var obj = getElementById(id);
if (obj && obj.nodeName == "OBJECT") {
if (ua.ie && ua.win) {
obj.style.display = "none";
(function(){
if (obj.readyState == 4) {
removeObjectInIE(id);
}
else {
setTimeout(arguments.callee, 10);
}
})();
}
else {
obj.parentNode.removeChild(obj);
}
}
}
function removeObjectInIE(id) {
var obj = getElementById(id);
if (obj) {
for (var i in obj) {
if (typeof obj[i] == "function") {
obj[i] = null;
}
}
obj.parentNode.removeChild(obj);
}
}
/* Functions to optimize JavaScript compression
*/
function getElementById(id) {
var el = null;
try {
el = doc.getElementById(id);
}
catch (e) {}
return el;
}
function createElement(el) {
return doc.createElement(el);
}
/* Updated attachEvent function for Internet Explorer
- Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks
*/
function addListener(target, eventType, fn) {
target.attachEvent(eventType, fn);
listenersArr[listenersArr.length] = [target, eventType, fn];
}
/* Flash Player and SWF content version matching
*/
function hasPlayerVersion(rv) {
var pv = ua.pv, v = rv.split(".");
v[0] = parseInt(v[0], 10);
v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"
v[2] = parseInt(v[2], 10) || 0;
return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;
}
/* Cross-browser dynamic CSS creation
- Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php
*/
function createCSS(sel, decl, media, newStyle) {
if (ua.ie && ua.mac) { return; }
var h = doc.getElementsByTagName("head")[0];
if (!h) { return; } // to also support badly authored HTML pages that lack a head element
var m = (media && typeof media == "string") ? media : "screen";
if (newStyle) {
dynamicStylesheet = null;
dynamicStylesheetMedia = null;
}
if (!dynamicStylesheet || dynamicStylesheetMedia != m) {
// create dynamic stylesheet + get a global reference to it
var s = createElement("style");
s.setAttribute("type", "text/css");
s.setAttribute("media", m);
dynamicStylesheet = h.appendChild(s);
if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {
dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];
}
dynamicStylesheetMedia = m;
}
// add style rule
if (ua.ie && ua.win) {
if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {
dynamicStylesheet.addRule(sel, decl);
}
}
else {
if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {
dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));
}
}
}
function setVisibility(id, isVisible) {
if (!autoHideShow) { return; }
var v = isVisible ? "visible" : "hidden";
if (isDomLoaded && getElementById(id)) {
getElementById(id).style.visibility = v;
}
else {
createCSS("#" + id, "visibility:" + v);
}
}
/* Filter to avoid XSS attacks
*/
function urlEncodeIfNecessary(s) {
var regex = /[\\\"<>\.;]/;
var hasBadChars = regex.exec(s) != null;
return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
}
/* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)
*/
var cleanup = function() {
if (ua.ie && ua.win) {
window.attachEvent("onunload", function() {
// remove listeners to avoid memory leaks
var ll = listenersArr.length;
for (var i = 0; i < ll; i++) {
listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);
}
// cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect
var il = objIdArr.length;
for (var j = 0; j < il; j++) {
removeSWF(objIdArr[j]);
}
// cleanup library's main closures to avoid memory leaks
for (var k in ua) {
ua[k] = null;
}
ua = null;
for (var l in swfobject) {
swfobject[l] = null;
}
swfobject = null;
});
}
}();
return {
/* Public API
- Reference: http://code.google.com/p/swfobject/wiki/documentation
*/
registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {
if (ua.w3 && objectIdStr && swfVersionStr) {
var regObj = {};
regObj.id = objectIdStr;
regObj.swfVersion = swfVersionStr;
regObj.expressInstall = xiSwfUrlStr;
regObj.callbackFn = callbackFn;
regObjArr[regObjArr.length] = regObj;
setVisibility(objectIdStr, false);
}
else if (callbackFn) {
callbackFn({success:false, id:objectIdStr});
}
},
getObjectById: function(objectIdStr) {
if (ua.w3) {
return getObjectById(objectIdStr);
}
},
embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {
var callbackObj = {success:false, id:replaceElemIdStr};
if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {
setVisibility(replaceElemIdStr, false);
addDomLoadEvent(function() {
widthStr += ""; // auto-convert to string
heightStr += "";
var att = {};
if (attObj && typeof attObj === OBJECT) {
for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs
att[i] = attObj[i];
}
}
att.data = swfUrlStr;
att.width = widthStr;
att.height = heightStr;
var par = {};
if (parObj && typeof parObj === OBJECT) {
for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs
par[j] = parObj[j];
}
}
if (flashvarsObj && typeof flashvarsObj === OBJECT) {
for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs
if (typeof par.flashvars != UNDEF) {
par.flashvars += "&" + k + "=" + flashvarsObj[k];
}
else {
par.flashvars = k + "=" + flashvarsObj[k];
}
}
}
if (hasPlayerVersion(swfVersionStr)) { // create SWF
var obj = createSWF(att, par, replaceElemIdStr);
if (att.id == replaceElemIdStr) {
setVisibility(replaceElemIdStr, true);
}
callbackObj.success = true;
callbackObj.ref = obj;
}
else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install
att.data = xiSwfUrlStr;
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
return;
}
else { // show alternative content
setVisibility(replaceElemIdStr, true);
}
if (callbackFn) { callbackFn(callbackObj); }
});
}
else if (callbackFn) { callbackFn(callbackObj); }
},
switchOffAutoHideShow: function() {
autoHideShow = false;
},
ua: ua,
getFlashPlayerVersion: function() {
return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };
},
hasFlashPlayerVersion: hasPlayerVersion,
createSWF: function(attObj, parObj, replaceElemIdStr) {
if (ua.w3) {
return createSWF(attObj, parObj, replaceElemIdStr);
}
else {
return undefined;
}
},
showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {
if (ua.w3 && canExpressInstall()) {
showExpressInstall(att, par, replaceElemIdStr, callbackFn);
}
},
removeSWF: function(objElemIdStr) {
if (ua.w3) {
removeSWF(objElemIdStr);
}
},
createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {
if (ua.w3) {
createCSS(selStr, declStr, mediaStr, newStyleBoolean);
}
},
addDomLoadEvent: addDomLoadEvent,
addLoadEvent: addLoadEvent,
getQueryParamValue: function(param) {
var q = doc.location.search || doc.location.hash;
if (q) {
if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark
if (param == null) {
return urlEncodeIfNecessary(q);
}
var pairs = q.split("&");
for (var i = 0; i < pairs.length; i++) {
if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));
}
}
}
return "";
},
// For internal usage only
expressInstallCallback: function() {
if (isExpressInstallActive) {
var obj = getElementById(EXPRESS_INSTALL_ID);
if (obj && storedAltContent) {
obj.parentNode.replaceChild(storedAltContent, obj);
if (storedAltContentId) {
setVisibility(storedAltContentId, true);
if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }
}
if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }
}
isExpressInstallActive = false;
}
}
};
}();

View File

@ -1,4 +1,6 @@
package spine {
import flash.utils.ByteArray;
import spine.animation.Animation;
import spine.animation.AttachmentTimeline;
import spine.animation.ColorTimeline;
@ -26,9 +28,18 @@ public class SkeletonJson {
this.attachmentLoader = attachmentLoader;
}
public function readSkeletonData (json:String, name:String) : SkeletonData {
if (json == null)
throw new ArgumentError("json cannot be null.");
/** @param object A String or ByteArray. */
public function readSkeletonData (object:*, name:String = null) : SkeletonData {
if (object == null)
throw new ArgumentError("object cannot be null.");
var json:String;
if (object is String)
json = String(object);
else if (object is ByteArray)
json = object.readUTFBytes(object.length);
else
throw new ArgumentError("object must be a String or ByteArray.");
var skeletonData:SkeletonData = new SkeletonData();
skeletonData.name = name;

View File

@ -10,7 +10,6 @@ public class AttachmentTimeline implements Timeline {
public function AttachmentTimeline (frameCount:int) {
_frameCount = frameCount;
frames.length = frameCount;
attachmentNames = new String[frameCount];
attachmentNames.length = frameCount;
}
@ -35,7 +34,7 @@ public class AttachmentTimeline implements Timeline {
frameIndex = Animation.binarySearch(frames, time, 1) - 1;
var attachmentName:String = attachmentNames[frameIndex];
skeleton.slots[slotIndex].setAttachment(attachmentName == null ? null : skeleton.getAttachmentForSlotIndex(slotIndex, attachmentName));
skeleton.slots[slotIndex].attachment = attachmentName == null ? null : skeleton.getAttachmentForSlotIndex(slotIndex, attachmentName);
}
}

View File

@ -0,0 +1,178 @@
package spine.atlas {
import flash.utils.ByteArray;
public class Atlas {
private var pages:Vector.<AtlasPage> = new Vector.<AtlasPage>();
private var regions:Vector.<AtlasRegion> = new Vector.<AtlasRegion>();
private var textureLoader:TextureLoader;
/** @param object A String or ByteArray. */
public function Atlas (object:*, textureLoader:TextureLoader) {
if (!object)
return;
if (object is String)
load(String(object), textureLoader);
else if (object is ByteArray)
load(object.readUTFBytes(object.length), textureLoader);
else
throw new ArgumentError("object must be a TextureAtlas or AttachmentLoader.");
}
protected function load (atlasText:String, textureLoader:TextureLoader) : void {
if (textureLoader == null)
throw new ArgumentError("textureLoader cannot be null.");
this.textureLoader = textureLoader;
var reader:Reader = new Reader(atlasText);
var tuple:Array = new Array();
tuple.length = 4;
var page:AtlasPage = null;
while (true) {
var line:String = reader.readLine();
if (line == null)
break;
line = reader.trim(line);
if (line.length == 0)
page = null;
else if (!page) {
page = new AtlasPage();
page.name = line;
page.format = Format.fromString(reader.readValue());
reader.readTuple(tuple);
page.minFilter = TextureFilter.fromString(tuple[0]);
page.magFilter = TextureFilter.fromString(tuple[1]);
var direction:String = reader.readValue();
page.uWrap = TextureWrap.clampToEdge;
page.vWrap = TextureWrap.clampToEdge;
if (direction == "x")
page.uWrap = TextureWrap.repeat;
else if (direction == "y")
page.vWrap = TextureWrap.repeat;
else if (direction == "xy")
page.uWrap = page.vWrap = TextureWrap.repeat;
textureLoader.load(page, line);
pages.push(page);
} else {
var region:AtlasRegion = new AtlasRegion();
region.name = line;
region.page = page;
region.rotate = reader.readValue() == "true";
reader.readTuple(tuple);
var x:int = parseInt(tuple[0]);
var y:int = parseInt(tuple[1]);
reader.readTuple(tuple);
var width:int = parseInt(tuple[0]);
var height:int = parseInt(tuple[1]);
region.u = x / page.width;
region.v = y / page.height;
if (region.rotate) {
region.u2 = (x + height) / page.width;
region.v2 = (y + width) / page.height;
} else {
region.u2 = (x + width) / page.width;
region.v2 = (y + height) / page.height;
}
region.x = x;
region.y = y;
region.width = Math.abs(width);
region.height = Math.abs(height);
if (reader.readTuple(tuple) == 4) { // split is optional
region.splits = new Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));
if (reader.readTuple(tuple) == 4) { // pad is optional, but only present with splits
region.pads = Vector.<int>(parseInt(tuple[0]), parseInt(tuple[1]), parseInt(tuple[2]), parseInt(tuple[3]));
reader.readTuple(tuple);
}
}
region.originalWidth = parseInt(tuple[0]);
region.originalHeight = parseInt(tuple[1]);
reader.readTuple(tuple);
region.offsetX = parseInt(tuple[0]);
region.offsetY = parseInt(tuple[1]);
region.index = parseInt(reader.readValue());
regions.push(region);
}
}
}
/** Returns the first region found with the specified name. This method uses string comparison to find the region, so the result
* should be cached rather than calling this method multiple times.
* @return The region, or null. */
public function findRegion (name:String) : AtlasRegion {
for (var i:int = 0, n:int = regions.length; i < n; i++)
if (regions[i].name == name)
return regions[i];
return null;
}
public function dispose () : void {
for (var i:int = 0, n:int = pages.length; i < n; i++)
textureLoader.unload(pages[i].rendererObject);
}
}
}
class Reader {
private var lines:Array;
private var index:int;
public function Reader (text:String) {
lines = text.split(/\r\n|\r|\n/);
}
public function trim (value:String) : String {
return value.replace(/^\s+|\s+$/gs, "");
}
public function readLine () : String {
if (index >= lines.length)
return null;
return lines[index++];
}
public function readValue () : String {
var line:String = readLine();
var colon:int = line.indexOf(":");
if (colon == -1)
throw new Error("Invalid line: " + line);
return trim(line.substring(colon + 1));
}
/** Returns the number of tuple values read (2 or 4). */
public function readTuple (tuple:Array) : int {
var line:String = readLine();
var colon:int = line.indexOf(":");
if (colon == -1)
throw new Error("Invalid line: " + line);
var i:int = 0, lastMatch:int = colon + 1;
for (; i < 3; i++) {
var comma:int = line.indexOf(",", lastMatch);
if (comma == -1) {
if (i == 0)
throw new Error("Invalid line: " + line);
break;
}
tuple[i] = trim(line.substr(lastMatch, comma - lastMatch));
lastMatch = comma + 1;
}
tuple[i] = trim(line.substring(lastMatch));
return i + 1;
}
}

View File

@ -7,7 +7,7 @@ public class AtlasPage {
public var magFilter:TextureFilter;
public var uWrap:TextureWrap;
public var vWrap:TextureWrap;
public var texture:Object;
public var rendererObject:Object;
public var width:int;
public var height:int;
}

View File

@ -16,6 +16,26 @@ public class Format {
this.ordinal = ordinal;
this.name = name;
}
static public function fromString (name:String) : Format {
switch (name.toLowerCase()) {
case "alpha":
return alpha;
case "intensity":
return intensity;
case "luminanceAlpha":
return luminanceAlpha;
case "rgb565":
return rgb565;
case "rgba4444":
return rgba4444;
case "rgb888":
return rgb888;
case "rgba8888":
return rgba8888;
}
throw new ArgumentError("Unknown format: " + name);
}
}
}

View File

@ -16,6 +16,26 @@ public class TextureFilter {
this.ordinal = ordinal;
this.name = name;
}
static public function fromString (name:String) : TextureFilter {
switch (name.toLowerCase()) {
case "nearest":
return nearest;
case "linear":
return linear;
case "mipMap":
return mipMap;
case "mipMapNearestNearest":
return mipMapNearestNearest;
case "mipMapLinearNearest":
return mipMapLinearNearest;
case "mipMapNearestLinear":
return mipMapNearestLinear;
case "mipMapLinearLinear":
return mipMapLinearLinear;
}
throw new ArgumentError("Unknown texture filter: " + name);
}
}
}

View File

@ -0,0 +1,8 @@
package spine.atlas {
public interface TextureLoader {
function load (page:AtlasPage, path:String) : void;
function unload (texture:Object) : void;
}
}

View File

@ -12,6 +12,18 @@ public class TextureWrap {
this.ordinal = ordinal;
this.name = name;
}
static public function fromString (name:String) : TextureWrap {
switch (name.toLowerCase()) {
case "mirroredRepeat":
return mirroredRepeat;
case "clampToEdge":
return clampToEdge;
case "repeat":
return repeat;
}
throw new ArgumentError("Unknown texture wrap: " + name);
}
}
}

View File

@ -0,0 +1,36 @@
package spine.attachments {
import spine.Skin;
import spine.atlas.Atlas;
import spine.atlas.AtlasRegion;
public class AtlasAttachmentLoader implements AttachmentLoader {
private var atlas:Atlas;
public function AtlasAttachmentLoader (atlas:Atlas) {
if (atlas == null)
throw new ArgumentError("atlas cannot be null.");
this.atlas = atlas;
}
public function newAttachment (skin:Skin, type:AttachmentType, name:String) : Attachment {
switch (type) {
case AttachmentType.region:
var region:AtlasRegion = atlas.findRegion(name);
if (region == null)
throw new Error("Region not found in atlas: " + name + " (" + type + ")");
var attachment:RegionAttachment = new RegionAttachment(name);
attachment.rendererObject = region;
attachment.setUVs(region.u, region.v, region.u2, region.v2, region.rotate);
attachment.regionOffsetX = region.offsetX;
attachment.regionOffsetY = region.offsetY;
attachment.regionWidth = region.width;
attachment.regionHeight = region.height;
attachment.regionOriginalWidth = region.originalWidth;
attachment.regionOriginalHeight = region.originalHeight;
return attachment;
}
throw new Error("Unknown attachment type: " + type);
}
}
}

View File

@ -1,7 +1,7 @@
package spine.attachments {
import spine.Bone;
public class RegionAttachment extends Attachment {
public dynamic class RegionAttachment extends Attachment {
public const X1:int = 0;
public const Y1:int = 1;
public const X2:int = 2;
@ -19,7 +19,7 @@ public class RegionAttachment extends Attachment {
public var width:Number;
public var height:Number;
public var texture:Object;
public var rendererObject:Object;
public var regionOffsetX:Number; // Pixels stripped from the bottom left, unrotated.
public var regionOffsetY:Number;
public var regionWidth:Number; // Unrotated, stripped size.

View File

@ -0,0 +1,32 @@
package spine.flash {
import flash.display.Bitmap;
import flash.display.BitmapData;
import spine.atlas.AtlasPage;
import spine.atlas.TextureLoader;
public class SingleTextureLoader implements TextureLoader {
private var pageBitmapData:BitmapData;
/** @param object A Bitmap or BitmapData. */
public function SingleTextureLoader (object:*) {
if (object is BitmapData)
pageBitmapData = BitmapData(object);
else if (object is Bitmap)
pageBitmapData = Bitmap(object).bitmapData;
else
throw new ArgumentError("object must be a Bitmap or BitmapData.");
}
public function load (page:AtlasPage, path:String) : void {
page.rendererObject = pageBitmapData;
page.width = pageBitmapData.width;
page.height = pageBitmapData.height;
}
public function unload (texture:Object) : void {
BitmapData(texture).dispose();
}
}
}

View File

@ -0,0 +1,62 @@
package spine.flash {
import spine.AnimationState;
import spine.AnimationStateData;
import spine.SkeletonData;
public class SkeletonAnimationSprite extends SkeletonSprite {
public var states:Vector.<AnimationState> = new Vector.<AnimationState>();
public function SkeletonAnimationSprite (skeletonData:SkeletonData) {
super(skeletonData);
addAnimationState();
}
override public function advanceTime (time:Number) : void {
for each (var state:AnimationState in states) {
state.update(time);
state.apply(skeleton);
}
skeleton.updateWorldTransform();
super.advanceTime(time);
}
public function addAnimationState (stateData:AnimationStateData = null) : void {
if (!stateData)
stateData = new AnimationStateData(skeleton.data);
states.push(new AnimationState(stateData));
}
public function setAnimationStateData (stateData:AnimationStateData, stateIndex:int = 0) : void {
if (stateIndex < 0 || stateIndex >= states.length)
throw new ArgumentError("stateIndex out of range.");
if (!stateData)
throw new ArgumentError("stateData cannot be null.");
states[stateIndex] = new AnimationState(stateData);
}
public function setMix (fromAnimation:String, toAnimation:String, duration:Number, stateIndex:int = 0) : void {
if (stateIndex < 0 || stateIndex >= states.length)
throw new ArgumentError("stateIndex out of range.");
states[stateIndex].data.setMixByName(fromAnimation, toAnimation, duration);
}
public function setAnimation (name:String, loop:Boolean, stateIndex:int = 0) : void {
if (stateIndex < 0 || stateIndex >= states.length)
throw new ArgumentError("stateIndex out of range.");
states[stateIndex].setAnimationByName(name, loop);
}
public function addAnimation (name:String, loop:Boolean, delay:Number = 0, stateIndex:int = 0) : void {
if (stateIndex < 0 || stateIndex >= states.length)
throw new ArgumentError("stateIndex out of range.");
states[stateIndex].addAnimationByName(name, loop, delay);
}
public function clearAnimation (stateIndex:int = 0) : void {
if (stateIndex < 0 || stateIndex >= states.length)
throw new ArgumentError("stateIndex out of range.");
states[stateIndex].clearAnimation();
}
}
}

View File

@ -0,0 +1,89 @@
package spine.flash {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.utils.getTimer;
import spine.Bone;
import spine.Skeleton;
import spine.SkeletonData;
import spine.Slot;
import spine.atlas.AtlasRegion;
import spine.attachments.RegionAttachment;
public class SkeletonSprite extends Sprite {
static private var tempPoint:Point = new Point();
static private var tempMatrix:Matrix = new Matrix();
private var _skeleton:Skeleton;
public var timeScale:Number = 1;
private var lastTime:int;
public function SkeletonSprite (skeletonData:SkeletonData) {
Bone.yDown = true;
_skeleton = new Skeleton(skeletonData);
_skeleton.updateWorldTransform();
addEventListener(Event.ENTER_FRAME, enterFrame);
}
private function enterFrame (event:Event) : void {
var time:int = getTimer();
advanceTime((time - lastTime) / 1000);
lastTime = time;
}
public function advanceTime (delta:Number) : void {
_skeleton.update(delta * timeScale);
removeChildren();
var drawOrder:Vector.<Slot> = skeleton.drawOrder;
for (var i:int = 0, n:int = drawOrder.length; i < n; i++) {
var slot:Slot = drawOrder[i];
var regionAttachment:RegionAttachment = slot.attachment as RegionAttachment;
if (regionAttachment != null) {
var wrapper:Sprite = regionAttachment["wrapper"];
var region:AtlasRegion = AtlasRegion(regionAttachment.rendererObject);
if (!wrapper) {
var bitmapData:BitmapData = region.page.rendererObject as BitmapData;
var regionData:BitmapData = new BitmapData(region.width, region.height);
regionData.copyPixels(bitmapData, //
new Rectangle(region.x, region.y, region.width, region.height), //
new Point());
var bitmap:Bitmap = new Bitmap(regionData);
bitmap.smoothing = true;
bitmap.x = -regionAttachment.width / 2; // Registration point.
bitmap.y = -regionAttachment.height / 2;
wrapper = new Sprite();
wrapper.addChild(bitmap);
regionAttachment["wrapper"] = wrapper;
}
var bone:Bone = slot.bone;
var x:Number = regionAttachment.x + region.offsetX;
var y:Number = regionAttachment.y + region.offsetY;
wrapper.x = bone.worldX + x * bone.m00 + y * bone.m01;
wrapper.y = bone.worldY + x * bone.m10 + y * bone.m11;
wrapper.rotation = -(bone.worldRotation + regionAttachment.rotation);
wrapper.scaleX = bone.worldScaleX + regionAttachment.scaleX - 1;
wrapper.scaleY = bone.worldScaleY + regionAttachment.scaleY - 1;
addChild(wrapper);
}
}
}
public function get skeleton () : Skeleton {
return _skeleton;
}
}
}

View File

@ -199,7 +199,7 @@ public class Animation {
static private final int FRAME_VALUE = 1;
private int boneIndex;
private final float[] frames; // time, value, ...
private final float[] frames; // time, angle, ...
public RotateTimeline (int frameCount) {
super(frameCount);
@ -268,7 +268,7 @@ public class Animation {
static final int FRAME_Y = 2;
int boneIndex;
final float[] frames; // time, value, value, ...
final float[] frames; // time, x, y, ...
public TranslateTimeline (int frameCount) {
super(frameCount);