Skip to content

Commit

Permalink
Merge pull request cocos#640 from xunyi0/master
Browse files Browse the repository at this point in the history
修正 FAQ 加载 DragonBones 部分代码
  • Loading branch information
jareguo authored Oct 9, 2018
2 parents bcae6ad + c7786d4 commit 3405f20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions en/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ let dragonDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);
let image = 'http://localhost:7456/res/raw-assets/eee_tex-1529064342.png';
let ske = 'http://localhost:7456/res/raw-assets/eee_ske-1529065642.json';
let atlas = 'http://localhost:7456/res/raw-assets/eee_tex-1529065642.json';
cc.loader.load(image, () => {
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
let atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
atlas.texture = image;
atlas.texture = texture;

let asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = dragonBonesJson;

dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;

dragonDisplay.armatureName = 'eee';
dragonDisplay.playAnimation('eee', -1);
dragonDisplay.armatureName = 'box_anim';
dragonDisplay.playAnimation('box_anim', 0);
});
});
});
Expand Down
8 changes: 4 additions & 4 deletions zh/getting-started/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ let dragonDisplay = animNode.addComponent(dragonBones.ArmatureDisplay);
let image = 'http://localhost:7456/res/raw-assets/eee_tex-1529064342.png';
let ske = 'http://localhost:7456/res/raw-assets/eee_ske-1529065642.json';
let atlas = 'http://localhost:7456/res/raw-assets/eee_tex-1529065642.json';
cc.loader.load(image, () => {
cc.loader.load(image, (error, texture) => {
cc.loader.load({ url: atlas, type: 'txt' }, (error, atlasJson) => {
cc.loader.load({ url: ske, type: 'txt' }, (error, dragonBonesJson) => {
let atlas = new dragonBones.DragonBonesAtlasAsset();
atlas.atlasJson = atlasJson;
atlas.texture = image;
atlas.texture = texture;

let asset = new dragonBones.DragonBonesAsset();
asset.dragonBonesJson = dragonBonesJson;

dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;

dragonDisplay.armatureName = 'eee';
dragonDisplay.playAnimation('eee', -1);
dragonDisplay.armatureName = 'box_anim';
dragonDisplay.playAnimation('box_anim', 0);
});
});
});
Expand Down

0 comments on commit 3405f20

Please sign in to comment.