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

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