ExploreNew.js
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var Common = require('Common');
var Network = require('Network');
var TVFocus = require('TVFocus');
var FocusInfo = require('FocusInfo');
var TVCanvas = require('TVCanvas');
var TVScrollParameter = require('TVScrollParameter');
var ListView = require('ListView');
var ListCell = require('ListCell');
var xmlToJSON=require('xmlToJSON');
cc.Class({
extends: TVCanvas,
properties: {
},
onLoad: function () {
this._super();
var self=this;
//动态加载背景图,需指定类型(需要拼接图片),指定尺寸(目前使用的是7280*720)
cc.loader.loadRes("game/explore_plus", cc.Texture2D, function (err, texture) {
self.node.getChildByName("Bg_long").getComponent(cc.Sprite).spriteFrame = new cc.SpriteFrame(texture);
});
cc.loader.loadRes("config/explore_config",function(err,str){
cc.log("源xml--------------->"+str);
// var result=xmlToJSON.parseString(str);
var x2js = new xmlToJSON();
var result=x2js.xml_str2json(str);
cc.log("解析后xml------------>"+JSON.stringify(result));
cc.log("解析后xml------------>"+result.root.explore[0]["_choice2"]);
// cc.log("解析后xml------------>"+result.root[0].explore[0]["_attr"].name["_value"]);
})
},
update:function(){
// cc.log("背景图片-----------------》"+this.node.getChildByName("Bg_long").x);
},
});