home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / arkaice.swf / scripts / DefineSprite_43 / frame_23 / DoAction.as
Encoding:
Text File  |  2005-11-14  |  20.8 KB  |  784 lines

  1. function RankingJuegos_Result(ranking)
  2. {
  3.    trace(ranking.items[0].puntos);
  4.    this.total = ranking.getLength();
  5.    trace("TOTAL >> " + this.total);
  6.    Y = 0;
  7.    var z = 0;
  8.    while(z <= this.total - 1)
  9.    {
  10.       cargaranking.attachMovie("listado_datos","item" + z,z);
  11.       cargaranking["item" + z].num.text = z + 1 + ".";
  12.       cargaranking["item" + z].usuario.text = ranking.items[z].usuario;
  13.       cargaranking["item" + z].puntos.text = ranking.items[z].puntos;
  14.       cargaranking["item" + z]._y = y;
  15.       y += 17;
  16.       z++;
  17.    }
  18. }
  19. stop();
  20. _global.RsDataProviderClass = function()
  21. {
  22.    this.init();
  23. };
  24. RsDataProviderClass.prototype.init = function()
  25. {
  26.    this.items = new Array();
  27.    this.uniqueID = 0;
  28.    this.views = new Array();
  29. };
  30. RsDataProviderClass.prototype.addView = function(viewRef)
  31. {
  32.    this.views.push(viewRef);
  33.    var eventObj = {event:"updateAll"};
  34.    viewRef.modelChanged(eventObj);
  35. };
  36. RsDataProviderClass.prototype.addItemAt = function(index, value)
  37. {
  38.    if(!this.checkLocal())
  39.    {
  40.       return undefined;
  41.    }
  42.    if(index < 0)
  43.    {
  44.       return undefined;
  45.    }
  46.    if(index < this.getLength())
  47.    {
  48.       this.items.splice(index,0,"tmp");
  49.    }
  50.    this.items[index] = new Object();
  51.    if(typeof value == "object")
  52.    {
  53.       this.items[index] = value;
  54.    }
  55.    this.items[index].__ID__ = this.uniqueID++;
  56.    var eventObj = {event:"addRows",firstRow:index,lastRow:index};
  57.    this.updateViews(eventObj);
  58. };
  59. RsDataProviderClass.prototype.addItem = function(value)
  60. {
  61.    if(!this.checkLocal())
  62.    {
  63.       return undefined;
  64.    }
  65.    this.addItemAt(this.getLength(),value);
  66. };
  67. RsDataProviderClass.prototype.removeItemAt = function(index)
  68. {
  69.    if(!this.checkLocal())
  70.    {
  71.       return undefined;
  72.    }
  73.    if(index < 0 || index >= this.getLength())
  74.    {
  75.       return undefined;
  76.    }
  77.    var tmpItm = this.items[index];
  78.    this.items.splice(index,1);
  79.    var eventObj = {event:"deleteRows",firstRow:index,lastRow:index};
  80.    this.updateViews(eventObj);
  81.    return tmpItm;
  82. };
  83. RsDataProviderClass.prototype.removeAll = function()
  84. {
  85.    if(!this.checkLocal())
  86.    {
  87.       return undefined;
  88.    }
  89.    this.items = new Array();
  90.    this.updateViews({event:"deleteRows",firstRow:0,lastRow:this.getLength() - 1});
  91. };
  92. RsDataProviderClass.prototype.replaceItemAt = function(index, itemObj)
  93. {
  94.    if(!this.checkLocal())
  95.    {
  96.       return undefined;
  97.    }
  98.    if(index < 0 || index >= this.getLength())
  99.    {
  100.       return undefined;
  101.    }
  102.    var tmpID = this.getItemID(index);
  103.    this.items[index] = itemObj;
  104.    this.items[index].__ID__ = tmpID;
  105.    this.updateViews({event:"updateRows",firstRow:index,lastRow:index});
  106. };
  107. RsDataProviderClass.prototype.getLength = function()
  108. {
  109.    return this.items.length;
  110. };
  111. RsDataProviderClass.prototype.getItemAt = function(index)
  112. {
  113.    return this.items[index];
  114. };
  115. RsDataProviderClass.prototype.getItemID = function(index)
  116. {
  117.    return this.items[index].__ID__;
  118. };
  119. RsDataProviderClass.prototype.sortItemsBy = function(fieldName, order)
  120. {
  121.    if(!this.checkLocal())
  122.    {
  123.       return undefined;
  124.    }
  125.    this.items.sortOn(fieldName);
  126.    if(order == "DESC")
  127.    {
  128.       this.items.reverse();
  129.    }
  130.    this.updateViews({event:"sort",fieldName:fieldName,order:order});
  131. };
  132. RsDataProviderClass.prototype.updateViews = function(eventObj)
  133. {
  134.    var vlen = this.views.length;
  135.    var i = 0;
  136.    while(i < vlen)
  137.    {
  138.       this.views[i].modelChanged(eventObj);
  139.       i++;
  140.    }
  141. };
  142. _global.RecordSet = function(columnNames)
  143. {
  144.    if(this.mTitles != null)
  145.    {
  146.       this.views = new Array();
  147.       return undefined;
  148.    }
  149.    this.init();
  150.    if(this.serverInfo == null)
  151.    {
  152.       this.mTitles = columnNames;
  153.       return undefined;
  154.    }
  155.    if(this.serverInfo.version != 1)
  156.    {
  157.       NetServices.trace("RecordSet","warning",100,"Received incompatible recordset version from server");
  158.       return undefined;
  159.    }
  160.    this.mTitles = this.serverInfo.columnNames;
  161.    this.mRecordsAvailable = 0;
  162.    this.setData(this.serverInfo.cursor != null ? this.serverInfo.cursor - 1 : 0,this.serverInfo.initialData);
  163.    if(this.serverInfo.initialData.length != this.serverInfo.totalCount)
  164.    {
  165.       this.mRecordSetId = this.serverInfo.id;
  166.       if(this.mRecordSetId != null)
  167.       {
  168.          this.serviceName = this.serverInfo.serviceName != null ? this.serverInfo.serviceName : "RecordSet";
  169.          this.mTotalCount = this.serverInfo.totalCount;
  170.          this.mDeliveryMode = "ondemand";
  171.          this.mAllNotified = false;
  172.          this.mOutstandingRecordCount = 0;
  173.       }
  174.       else
  175.       {
  176.          NetServices.trace("RecordSet","warning",102,"Missing some records, but there\'s no recordset id");
  177.       }
  178.    }
  179.    this.serverInfo = null;
  180. };
  181. RecordSet.prototype = new RsDataProviderClass();
  182. Object.registerClass("RecordSet",RecordSet);
  183. RecordSet.prototype._setParentService = function(service)
  184. {
  185.    this.gateway_conn = service.nc;
  186. };
  187. RecordSet.prototype.getRecordSetService = function()
  188. {
  189.    if(this.mRecordSetService == null)
  190.    {
  191.       if(this.gateway_conn == null)
  192.       {
  193.          this.gateway_conn = NetServices.createGatewayConnection();
  194.       }
  195.       else if(_global.netDebugInstance != undefined)
  196.       {
  197.          this.gateway_conn = this.gateway_conn.clone();
  198.       }
  199.       if(_global.netDebugInstance != undefined)
  200.       {
  201.          this.gateway_conn.setupRecordset();
  202.          this.gateway_conn.setDebugId("RecordSet " + this.mRecordSetId);
  203.       }
  204.       this.mRecordSetService = this.gateway_conn.getService(this.serviceName,this);
  205.       if(this.mRecordSetService == null)
  206.       {
  207.          NetServices.trace("RecordSet","warning",101,"Failed to create recordset service");
  208.          this.mRecordSetService = 0;
  209.       }
  210.    }
  211.    return this.mRecordSetService;
  212. };
  213. RecordSet.prototype.getColumnNames = function()
  214. {
  215.    return this.mTitles;
  216. };
  217. RecordSet.prototype.getLength = function()
  218. {
  219.    if(this.mRecordSetID != null)
  220.    {
  221.       return this.mTotalCount;
  222.    }
  223.    return this.items.length;
  224. };
  225. RecordSet.prototype.getItemAt = function(index)
  226. {
  227.    if(index < 0 || index >= this.getLength())
  228.    {
  229.       NetServices.trace("RecordSet","warning",104,"getItemAt(" + index + ") index out of range");
  230.       return null;
  231.    }
  232.    if(this.mRecordSetId == null)
  233.    {
  234.       return this.items[index];
  235.    }
  236.    this.requestRecord(index);
  237.    var result = this.items[index];
  238.    if(result == 1)
  239.    {
  240.       return "in progress";
  241.    }
  242.    return result;
  243. };
  244. RecordSet.prototype.setField = function(index, fieldName, value)
  245. {
  246.    if(!this.checkLocal())
  247.    {
  248.       return undefined;
  249.    }
  250.    if(index < 0 || index >= this.getLength())
  251.    {
  252.       return undefined;
  253.    }
  254.    this.items[index][fieldName] = value;
  255.    this.updateViews({event:"updateRows",firstRow:index,lastRow:index});
  256. };
  257. RecordSet.prototype.filter = function(filterFunction, context)
  258. {
  259.    if(!this.checkLocal())
  260.    {
  261.       return undefined;
  262.    }
  263.    var result = new RecordSet(this.mTitles);
  264.    var rcount = this.getLength();
  265.    var i = 0;
  266.    while(i < rcount)
  267.    {
  268.       var item = this.getItemAt(i);
  269.       if(item != null && item != 1 && filterFunction(item,context))
  270.       {
  271.          result.addItem(item);
  272.       }
  273.       i++;
  274.    }
  275.    return result;
  276. };
  277. RecordSet.prototype.sort = function(compareFunc)
  278. {
  279.    if(!this.checkLocal())
  280.    {
  281.       return undefined;
  282.    }
  283.    this.items.sort(compareFunc);
  284.    this.updateViews({event:"sort"});
  285. };
  286. RecordSet.prototype.isLocal = function()
  287. {
  288.    return this.mRecordSetID == null;
  289. };
  290. RecordSet.prototype.isFullyPopulated = function()
  291. {
  292.    return this.isLocal();
  293. };
  294. RecordSet.prototype.getNumberAvailable = function()
  295. {
  296.    if(this.isLocal())
  297.    {
  298.       return this.getLength();
  299.    }
  300.    return this.mRecordsAvailable;
  301. };
  302. RecordSet.prototype.setDeliveryMode = function(mode, pagesize, numPrefetchPages)
  303. {
  304.    this.mDeliveryMode = mode;
  305.    this.stopFetchAll();
  306.    if(mode == "ondemand")
  307.    {
  308.       return undefined;
  309.    }
  310.    if(pagesize == null)
  311.    {
  312.       pagesize = this.views[0].getRowCount();
  313.       if(pagesize == null)
  314.       {
  315.          pagesize = 25;
  316.       }
  317.    }
  318.    if(mode == "page")
  319.    {
  320.       if(numPrefetchPages == null)
  321.       {
  322.          numPrefetchPages = 0;
  323.       }
  324.       this.mPageSize = pagesize;
  325.       this.mNumPrefetchPages = numPrefetchPages;
  326.    }
  327.    else if(mode == "fetchall")
  328.    {
  329.       this.stopFetchAll();
  330.       this.startFetchAll(pagesize);
  331.    }
  332.    else
  333.    {
  334.       NetServices.trace("RecordSet","warning",107,"SetDeliveryMode: unknown mode string");
  335.    }
  336. };
  337. RecordSet.prototype.getRecords_Result = function(info)
  338. {
  339.    this.setData(info.Cursor - 1,info.Page);
  340.    this.mOutstandingRecordCount -= info.Page.length;
  341.    this.updateViews({event:"updateRows",firstRow:info.Cursor - 1,lastRow:info.Cursor - 1 + info.Page.length - 1});
  342.    if(this.mRecordsAvailable == this.mTotalCount && !this.mAllNotified)
  343.    {
  344.       this.updateViews({event:"allRows"});
  345.       this.mRecordSetService.release();
  346.       this.mAllNotified = true;
  347.       this.mRecordSetID = null;
  348.       this.mRecordSetService = null;
  349.    }
  350. };
  351. RecordSet.prototype.release_Result = function()
  352. {
  353. };
  354. RecordSet.prototype.arrayToObject = function(anArray)
  355. {
  356.    if(this.mTitles == null)
  357.    {
  358.       NetServices.trace("RecordSet","warning",105,"getItem: titles are not available");
  359.       return null;
  360.    }
  361.    var result = new Object();
  362.    var alen = anArray.length;
  363.    var i = 0;
  364.    while(i < alen)
  365.    {
  366.       var title = this.mTitles[i];
  367.       if(title == null)
  368.       {
  369.          title = "column" + i + 1;
  370.       }
  371.       result[title] = anArray[i];
  372.       i++;
  373.    }
  374.    return result;
  375. };
  376. RecordSet.prototype.setData = function(start, dataArray)
  377. {
  378.    var datalen = dataArray.length;
  379.    var i = 0;
  380.    while(i < datalen)
  381.    {
  382.       var index = i + start;
  383.       var rec = this.items[index];
  384.       if(rec != null && rec != 1)
  385.       {
  386.          NetServices.trace("RecordSet","warning",106,"Already got record # " + recordIndex);
  387.       }
  388.       else
  389.       {
  390.          this.mRecordsAvailable += 1;
  391.       }
  392.       this.items[index] = this.arrayToObject(dataArray[i]);
  393.       this.items[index].__ID__ = this.uniqueID++;
  394.       i++;
  395.    }
  396. };
  397. RecordSet.prototype.requestOneRecord = function(index)
  398. {
  399.    if(this.items[index] == null)
  400.    {
  401.       this.getRecordSetService().getRecords(this.mRecordSetId,index + 1,1);
  402.       this.mOutstandingRecordCount++;
  403.       this.items[index] = 1;
  404.       this.updateViews({event:"fetchRows",firstRow:index,lastRow:index});
  405.    }
  406. };
  407. RecordSet.prototype.requestRecord = function(index)
  408. {
  409.    if(this.mDeliveryMode != "page")
  410.    {
  411.       this.requestOneRecord(index);
  412.       return undefined;
  413.    }
  414.    var firstIndex = int(index / this.mPageSize) * this.mPageSize;
  415.    var lastIndex = firstIndex + this.mPageSize * (this.mNumPrefetchPages + 1) - 1;
  416.    this.requestRecordRange(firstIndex,lastIndex);
  417. };
  418. RecordSet.prototype.requestRecordRange = function(index, lastIndex)
  419. {
  420.    var highestRequested = -1;
  421.    if(index < 0)
  422.    {
  423.       index = 0;
  424.    }
  425.    if(lastIndex >= this.getLength())
  426.    {
  427.       lastIndex = this.getLength() - 1;
  428.    }
  429.    while(index <= lastIndex)
  430.    {
  431.       while(index <= lastIndex && this.items[index] != null)
  432.       {
  433.          index++;
  434.       }
  435.       var first = index;
  436.       while(index <= lastIndex && this.items[index] == null)
  437.       {
  438.          this.mOutstandingRecordCount++;
  439.          this.items[index] = 1;
  440.          index++;
  441.       }
  442.       var last = index - 1;
  443.       if(first <= last)
  444.       {
  445.          this.getRecordSetService().getRecords(this.mRecordSetId,first + 1,last - first + 1);
  446.          highestRequested = last;
  447.          this.updateViews({event:"fetchRows",firstRow:first,lastRow:last});
  448.       }
  449.    }
  450.    return highestRequested;
  451. };
  452. RecordSet.prototype.startFetchAll = function(pagesize)
  453. {
  454.    this.mDataFetcher.disable();
  455.    this.mDataFetcher = new RsDataFetcher(this,pagesize);
  456. };
  457. RecordSet.prototype.stopFetchAll = function()
  458. {
  459.    this.mDataFetcher.disable();
  460.    this.mDataFetcher = null;
  461. };
  462. RecordSet.prototype.checkLocal = function()
  463. {
  464.    if(this.isLocal())
  465.    {
  466.       return true;
  467.    }
  468.    NetServices.trace("RecordSet","warning",108,"Operation not allowed on partial recordset");
  469.    return false;
  470. };
  471. _global.RsDataFetcher = function(recordSet, increment)
  472. {
  473.    this.mRecordSet = recordSet;
  474.    this.mRecordSet.addView(this);
  475.    this.mIncrement = increment;
  476.    this.mNextRecord = 0;
  477.    this.mEnabled = true;
  478.    this.doNext();
  479. };
  480. RsDataFetcher.prototype.disable = function()
  481. {
  482.    this.mEnabled = false;
  483.    this.mRecordSet.removeView(this);
  484. };
  485. RsDataFetcher.prototype.doNext = function()
  486. {
  487.    if(!this.mEnabled)
  488.    {
  489.       return undefined;
  490.    }
  491.    while(true)
  492.    {
  493.       if(this.mNextRecord >= this.mRecordSet.getLength())
  494.       {
  495.          return undefined;
  496.       }
  497.       this.mHighestRequested = this.mRecordSet.requestRecordRange(this.mNextRecord,this.mNextRecord + this.mIncrement - 1);
  498.       this.mNextRecord += this.mIncrement;
  499.       if(this.mHighestRequested > 0)
  500.       {
  501.          return undefined;
  502.       }
  503.    }
  504. };
  505. RsDataFetcher.prototype.modelChanged = function(eventObj)
  506. {
  507.    if(eventObj.event == "updateRows" && eventObj.firstRow <= this.mHighestRequested && eventObj.lastRow >= this.mHighestRequested)
  508.    {
  509.       this.doNext();
  510.    }
  511.    if(eventObj.event == "allRows")
  512.    {
  513.       this.disable();
  514.    }
  515. };
  516. _global.NetServiceProxyResponder = function(service, methodName)
  517. {
  518.    this.service = service;
  519.    this.methodName = methodName;
  520. };
  521. NetServiceProxyResponder.prototype.onResult = function(result)
  522. {
  523.    var client = this.service.client;
  524.    result._setParentService(this.service);
  525.    var func = this.methodName + "_Result";
  526.    if(typeof client[func] == "function")
  527.    {
  528.       client[func](result);
  529.    }
  530.    else if(typeof client.onResult == "function")
  531.    {
  532.       client.onResult(result);
  533.    }
  534.    else
  535.    {
  536.       NetServices.trace("NetServices","info",1,func + " was received from server: " + result);
  537.    }
  538. };
  539. NetServiceProxyResponder.prototype.onStatus = function(result)
  540. {
  541.    var client = this.service.client;
  542.    var func = this.methodName + "_Status";
  543.    if(typeof client[func] == "function")
  544.    {
  545.       client[func](result);
  546.    }
  547.    else if(typeof client.onStatus == "function")
  548.    {
  549.       client.onStatus(result);
  550.    }
  551.    else if(typeof _root.onStatus == "function")
  552.    {
  553.       _root.onStatus(result);
  554.    }
  555.    else if(typeof _global.System.onStatus == "function")
  556.    {
  557.       _global.System.onStatus(result);
  558.    }
  559.    else
  560.    {
  561.       NetServices.trace("NetServices","info",2,func + " was received from server: " + result["class"] + " " + result.description);
  562.    }
  563. };
  564. _global.NetServiceProxy = function(nc, serviceName, client)
  565. {
  566.    if(nc != null)
  567.    {
  568.       this.nc = nc;
  569.       this.serviceName = serviceName;
  570.       this.client = client;
  571.    }
  572. };
  573. NetServiceProxy.prototype._setParentService = function(service)
  574. {
  575.    this.nc = service.nc;
  576.    this.client = service.client;
  577. };
  578. NetServiceProxy.prototype.__resolve = function(methodName)
  579. {
  580.    var f = function()
  581.    {
  582.       if(this.client != null)
  583.       {
  584.          arguments.unshift(new NetServiceProxyResponder(this,methodName));
  585.       }
  586.       else if(typeof arguments[0].onResult != "function")
  587.       {
  588.          NetServices.trace("NetServices","warning",3,"There is no defaultResponder, but no responder was given in call to " + methodName);
  589.          arguments.unshift(new NetServiceProxyResponder(this,methodName));
  590.       }
  591.       arguments.unshift(this.serviceName + "." + methodName);
  592.       return this.nc.call.apply(this.nc,arguments);
  593.    };
  594.    return f;
  595. };
  596. Object.registerClass("NetServiceProxy",NetServiceProxy);
  597. NetConnection.prototype.getService = function(serviceName, client)
  598. {
  599.    var result = new NetServiceProxy(this,serviceName,client);
  600.    return result;
  601. };
  602. NetConnection.prototype.setCredentials = function(userid, password)
  603. {
  604.    this.addHeader("Credentials",false,{userid:userid,password:password});
  605. };
  606. NetConnection.prototype.RequestPersistentHeader = function(info)
  607. {
  608.    this.addHeader(info.name,info.mustUnderstand,info.data);
  609. };
  610. NetConnection.prototype.AppendToGatewayUrl = function(urlSuffix)
  611. {
  612.    this.__urlSuffix = urlSuffix;
  613.    if(this.__originalUrl == null)
  614.    {
  615.       this.__originalUrl = this.uri;
  616.    }
  617.    var u = this.__originalUrl + urlSuffix;
  618.    this.connect(u);
  619. };
  620. NetConnection.prototype.ReplaceGatewayUrl = function(newUrl)
  621. {
  622.    this.connect(newUrl);
  623. };
  624. NetConnection.prototype.clone = function()
  625. {
  626.    var nc = new NetConnection();
  627.    nc.connect(this.uri);
  628.    return nc;
  629. };
  630. if(_global.NetServices == null)
  631. {
  632.    _global.NetServices = new Object();
  633.    NetServices.gatewayUrl = gatewayUrl;
  634. }
  635. NetServices.setDefaultGatewayUrl = function(url)
  636. {
  637.    NetServices.defaultGatewayUrl = url;
  638. };
  639. NetServices.setGatewayUrl = function(url)
  640. {
  641.    NetServices.gatewayUrl = url;
  642. };
  643. NetServices.createGatewayConnection = function(url)
  644. {
  645.    if(url == undefined)
  646.    {
  647.       url = NetServices.gatewayUrl;
  648.       if(url == undefined)
  649.       {
  650.          url = NetServices.defaultGatewayUrl;
  651.       }
  652.    }
  653.    if(url == undefined)
  654.    {
  655.       NetServices.trace("NetServices","warning",4,"createGatewayConnection - gateway url is undefined");
  656.       return null;
  657.    }
  658.    var nc = new NetConnection();
  659.    nc.connect(url);
  660.    return nc;
  661. };
  662. NetServices.getHostUrl = function()
  663. {
  664.    if(!NetServices.isHttpUrl(_root._url))
  665.    {
  666.       return null;
  667.    }
  668.    var firstSlashPos = _root._url.indexOf("/",8);
  669.    if(firstSlashPos < 0)
  670.    {
  671.       return null;
  672.    }
  673.    return _root._url.substring(0,firstSlashPos);
  674. };
  675. NetServices.isHttpUrl = function(url)
  676. {
  677.    return url.indexOf("http://") == 0 || url.indexOf("https://") == 0;
  678. };
  679. NetServices.trace = function(who, severity, number, message)
  680. {
  681.    var fullMessage = who + " " + severity + " " + number + ": " + message;
  682.    trace(fullMessage);
  683.    NetDebug.traceNetServices(who,severity,number,message);
  684. };
  685. NetServices.getVersion = function()
  686. {
  687.    return 1;
  688. };
  689. _global.DataGlue = function(dataProvider)
  690. {
  691.    this.dataProvider = dataProvider;
  692. };
  693. _global.DataGlue.bindFormatStrings = function(dataConsumer, dataProvider, labelString, dataString)
  694. {
  695.    var proxy = new DataGlue(dataProvider);
  696.    proxy.labelString = labelString;
  697.    proxy.dataString = dataString;
  698.    proxy.getItemAt = _global.DataGlue.getItemAt_FormatString;
  699.    dataConsumer.setDataProvider(proxy);
  700. };
  701. _global.DataGlue.bindFormatFunction = function(dataConsumer, dataProvider, formatFunction)
  702. {
  703.    var proxy = new DataGlue(dataProvider);
  704.    proxy.formatFunction = formatFunction;
  705.    proxy.getItemAt = _global.DataGlue.getItemAt_FormatFunction;
  706.    dataConsumer.setDataProvider(proxy);
  707. };
  708. _global.DataGlue.prototype.addView = function(viewRef)
  709. {
  710.    return this.dataProvider.addView(viewRef);
  711. };
  712. _global.DataGlue.prototype.getLength = function()
  713. {
  714.    return this.dataProvider.getLength();
  715. };
  716. _global.DataGlue.prototype.format = function(formatString, record)
  717. {
  718.    var tokens = formatString.split("#");
  719.    var result = "";
  720.    var tlen = tokens.length;
  721.    var i = 0;
  722.    while(i < tlen)
  723.    {
  724.       result += tokens[i];
  725.       result += tokens[i + 1] != "" ? record[tokens[i + 1]] : "#";
  726.       i += 2;
  727.    }
  728.    return result;
  729. };
  730. _global.DataGlue.getItemAt_FormatString = function(index)
  731. {
  732.    var record = this.dataProvider.getItemAt(index);
  733.    if(record == "in progress" || record == undefined)
  734.    {
  735.       return record;
  736.    }
  737.    return {label:this.format(this.labelString,record),data:(this.dataString != null ? this.format(this.dataString,record) : record)};
  738. };
  739. _global.DataGlue.getItemAt_FormatFunction = function(index)
  740. {
  741.    var record = this.dataProvider.getItemAt(index);
  742.    if(record == "in progress" || record == undefined)
  743.    {
  744.       return record;
  745.    }
  746.    return this.formatFunction(record);
  747. };
  748. _global.DataGlue.prototype.getItemID = function(index)
  749. {
  750.    return this.dataProvider.getItemID(index);
  751. };
  752. _global.DataGlue.prototype.addItemAt = function(index, value)
  753. {
  754.    return this.dataProvider.addItemAt(index,value);
  755. };
  756. _global.DataGlue.prototype.addItem = function(value)
  757. {
  758.    return this.dataProvider.addItem(value);
  759. };
  760. _global.DataGlue.prototype.removeItemAt = function(index)
  761. {
  762.    return this.dataProvider.removeItemAt(index);
  763. };
  764. _global.DataGlue.prototype.removeAll = function()
  765. {
  766.    return this.dataProvider.removeAll();
  767. };
  768. _global.DataGlue.prototype.replaceItemAt = function(index, itemObj)
  769. {
  770.    return this.dataProvider.replaceItemAt(index,itemObj);
  771. };
  772. _global.DataGlue.prototype.sortItemsBy = function(fieldName, order)
  773. {
  774.    return this.dataProvider.sortItemsBy(fieldName,order);
  775. };
  776. if(inited == null)
  777. {
  778.    inited = true;
  779.    NetServices.setDefaultGatewayUrl("http://www.danup.es/flashservices/gateway");
  780.    gateway_conn = NetServices.createGatewayConnection();
  781.    CFC_Serv = gateway_conn.getService("cfc.juegos",this);
  782. }
  783. CFC_Serv.RankingJuegos({idjuego:1});
  784.