home *** CD-ROM | disk | FTP | other *** search
- function JugarPartida_Result(inserccion_puntos)
- {
- trace(inserccion_puntos);
- if(inserccion_puntos == 1)
- {
- mensaje = "Tu primera partida ha estao de lujo, t atreves a continuar???";
- }
- else if(inserccion_puntos == 2)
- {
- mensaje = "Neng, hemos bajao el ritmo...y así no acumulas puntos. Tómate un Dan\'UP, pilla energía y a x todas!!!";
- }
- else if(inserccion_puntos == 3)
- {
- mensaje = "Guay, ya tienes + puntos... continúa así y nos fundes el ránking!!!";
- }
- else if(inserccion_puntos == -11 || inserccion_puntos == -12)
- {
- mensaje = "Hay un error y no se carga el juego, prueba otra vez q ya se arregla.";
- }
- }
- stop();
- removeMovieClip("ball1");
- removeMovieClip("ball2");
- removeMovieClip("ball3");
- removeMovieClip("ball4");
- finalscore = score;
- _global.RsDataProviderClass = function()
- {
- this.init();
- };
- RsDataProviderClass.prototype.init = function()
- {
- this.items = new Array();
- this.uniqueID = 0;
- this.views = new Array();
- };
- RsDataProviderClass.prototype.addView = function(viewRef)
- {
- this.views.push(viewRef);
- var eventObj = {event:"updateAll"};
- viewRef.modelChanged(eventObj);
- };
- RsDataProviderClass.prototype.addItemAt = function(index, value)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- if(index < 0)
- {
- return undefined;
- }
- if(index < this.getLength())
- {
- this.items.splice(index,0,"tmp");
- }
- this.items[index] = new Object();
- if(typeof value == "object")
- {
- this.items[index] = value;
- }
- this.items[index].__ID__ = this.uniqueID++;
- var eventObj = {event:"addRows",firstRow:index,lastRow:index};
- this.updateViews(eventObj);
- };
- RsDataProviderClass.prototype.addItem = function(value)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- this.addItemAt(this.getLength(),value);
- };
- RsDataProviderClass.prototype.removeItemAt = function(index)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- if(index < 0 || index >= this.getLength())
- {
- return undefined;
- }
- var tmpItm = this.items[index];
- this.items.splice(index,1);
- var eventObj = {event:"deleteRows",firstRow:index,lastRow:index};
- this.updateViews(eventObj);
- return tmpItm;
- };
- RsDataProviderClass.prototype.removeAll = function()
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- this.items = new Array();
- this.updateViews({event:"deleteRows",firstRow:0,lastRow:this.getLength() - 1});
- };
- RsDataProviderClass.prototype.replaceItemAt = function(index, itemObj)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- if(index < 0 || index >= this.getLength())
- {
- return undefined;
- }
- var tmpID = this.getItemID(index);
- this.items[index] = itemObj;
- this.items[index].__ID__ = tmpID;
- this.updateViews({event:"updateRows",firstRow:index,lastRow:index});
- };
- RsDataProviderClass.prototype.getLength = function()
- {
- return this.items.length;
- };
- RsDataProviderClass.prototype.getItemAt = function(index)
- {
- return this.items[index];
- };
- RsDataProviderClass.prototype.getItemID = function(index)
- {
- return this.items[index].__ID__;
- };
- RsDataProviderClass.prototype.sortItemsBy = function(fieldName, order)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- this.items.sortOn(fieldName);
- if(order == "DESC")
- {
- this.items.reverse();
- }
- this.updateViews({event:"sort",fieldName:fieldName,order:order});
- };
- RsDataProviderClass.prototype.updateViews = function(eventObj)
- {
- var vlen = this.views.length;
- var i = 0;
- while(i < vlen)
- {
- this.views[i].modelChanged(eventObj);
- i++;
- }
- };
- _global.RecordSet = function(columnNames)
- {
- if(this.mTitles != null)
- {
- this.views = new Array();
- return undefined;
- }
- this.init();
- if(this.serverInfo == null)
- {
- this.mTitles = columnNames;
- return undefined;
- }
- if(this.serverInfo.version != 1)
- {
- NetServices.trace("RecordSet","warning",100,"Received incompatible recordset version from server");
- return undefined;
- }
- this.mTitles = this.serverInfo.columnNames;
- this.mRecordsAvailable = 0;
- this.setData(this.serverInfo.cursor != null ? this.serverInfo.cursor - 1 : 0,this.serverInfo.initialData);
- if(this.serverInfo.initialData.length != this.serverInfo.totalCount)
- {
- this.mRecordSetId = this.serverInfo.id;
- if(this.mRecordSetId != null)
- {
- this.serviceName = this.serverInfo.serviceName != null ? this.serverInfo.serviceName : "RecordSet";
- this.mTotalCount = this.serverInfo.totalCount;
- this.mDeliveryMode = "ondemand";
- this.mAllNotified = false;
- this.mOutstandingRecordCount = 0;
- }
- else
- {
- NetServices.trace("RecordSet","warning",102,"Missing some records, but there\'s no recordset id");
- }
- }
- this.serverInfo = null;
- };
- RecordSet.prototype = new RsDataProviderClass();
- Object.registerClass("RecordSet",RecordSet);
- RecordSet.prototype._setParentService = function(service)
- {
- this.gateway_conn = service.nc;
- };
- RecordSet.prototype.getRecordSetService = function()
- {
- if(this.mRecordSetService == null)
- {
- if(this.gateway_conn == null)
- {
- this.gateway_conn = NetServices.createGatewayConnection();
- }
- else if(_global.netDebugInstance != undefined)
- {
- this.gateway_conn = this.gateway_conn.clone();
- }
- if(_global.netDebugInstance != undefined)
- {
- this.gateway_conn.setupRecordset();
- this.gateway_conn.setDebugId("RecordSet " + this.mRecordSetId);
- }
- this.mRecordSetService = this.gateway_conn.getService(this.serviceName,this);
- if(this.mRecordSetService == null)
- {
- NetServices.trace("RecordSet","warning",101,"Failed to create recordset service");
- this.mRecordSetService = 0;
- }
- }
- return this.mRecordSetService;
- };
- RecordSet.prototype.getColumnNames = function()
- {
- return this.mTitles;
- };
- RecordSet.prototype.getLength = function()
- {
- if(this.mRecordSetID != null)
- {
- return this.mTotalCount;
- }
- return this.items.length;
- };
- RecordSet.prototype.getItemAt = function(index)
- {
- if(index < 0 || index >= this.getLength())
- {
- NetServices.trace("RecordSet","warning",104,"getItemAt(" + index + ") index out of range");
- return null;
- }
- if(this.mRecordSetId == null)
- {
- return this.items[index];
- }
- this.requestRecord(index);
- var result = this.items[index];
- if(result == 1)
- {
- return "in progress";
- }
- return result;
- };
- RecordSet.prototype.setField = function(index, fieldName, value)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- if(index < 0 || index >= this.getLength())
- {
- return undefined;
- }
- this.items[index][fieldName] = value;
- this.updateViews({event:"updateRows",firstRow:index,lastRow:index});
- };
- RecordSet.prototype.filter = function(filterFunction, context)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- var result = new RecordSet(this.mTitles);
- var rcount = this.getLength();
- var i = 0;
- while(i < rcount)
- {
- var item = this.getItemAt(i);
- if(item != null && item != 1 && filterFunction(item,context))
- {
- result.addItem(item);
- }
- i++;
- }
- return result;
- };
- RecordSet.prototype.sort = function(compareFunc)
- {
- if(!this.checkLocal())
- {
- return undefined;
- }
- this.items.sort(compareFunc);
- this.updateViews({event:"sort"});
- };
- RecordSet.prototype.isLocal = function()
- {
- return this.mRecordSetID == null;
- };
- RecordSet.prototype.isFullyPopulated = function()
- {
- return this.isLocal();
- };
- RecordSet.prototype.getNumberAvailable = function()
- {
- if(this.isLocal())
- {
- return this.getLength();
- }
- return this.mRecordsAvailable;
- };
- RecordSet.prototype.setDeliveryMode = function(mode, pagesize, numPrefetchPages)
- {
- this.mDeliveryMode = mode;
- this.stopFetchAll();
- if(mode == "ondemand")
- {
- return undefined;
- }
- if(pagesize == null)
- {
- pagesize = this.views[0].getRowCount();
- if(pagesize == null)
- {
- pagesize = 25;
- }
- }
- if(mode == "page")
- {
- if(numPrefetchPages == null)
- {
- numPrefetchPages = 0;
- }
- this.mPageSize = pagesize;
- this.mNumPrefetchPages = numPrefetchPages;
- }
- else if(mode == "fetchall")
- {
- this.stopFetchAll();
- this.startFetchAll(pagesize);
- }
- else
- {
- NetServices.trace("RecordSet","warning",107,"SetDeliveryMode: unknown mode string");
- }
- };
- RecordSet.prototype.getRecords_Result = function(info)
- {
- this.setData(info.Cursor - 1,info.Page);
- this.mOutstandingRecordCount -= info.Page.length;
- this.updateViews({event:"updateRows",firstRow:info.Cursor - 1,lastRow:info.Cursor - 1 + info.Page.length - 1});
- if(this.mRecordsAvailable == this.mTotalCount && !this.mAllNotified)
- {
- this.updateViews({event:"allRows"});
- this.mRecordSetService.release();
- this.mAllNotified = true;
- this.mRecordSetID = null;
- this.mRecordSetService = null;
- }
- };
- RecordSet.prototype.release_Result = function()
- {
- };
- RecordSet.prototype.arrayToObject = function(anArray)
- {
- if(this.mTitles == null)
- {
- NetServices.trace("RecordSet","warning",105,"getItem: titles are not available");
- return null;
- }
- var result = new Object();
- var alen = anArray.length;
- var i = 0;
- while(i < alen)
- {
- var title = this.mTitles[i];
- if(title == null)
- {
- title = "column" + i + 1;
- }
- result[title] = anArray[i];
- i++;
- }
- return result;
- };
- RecordSet.prototype.setData = function(start, dataArray)
- {
- var datalen = dataArray.length;
- var i = 0;
- while(i < datalen)
- {
- var index = i + start;
- var rec = this.items[index];
- if(rec != null && rec != 1)
- {
- NetServices.trace("RecordSet","warning",106,"Already got record # " + recordIndex);
- }
- else
- {
- this.mRecordsAvailable += 1;
- }
- this.items[index] = this.arrayToObject(dataArray[i]);
- this.items[index].__ID__ = this.uniqueID++;
- i++;
- }
- };
- RecordSet.prototype.requestOneRecord = function(index)
- {
- if(this.items[index] == null)
- {
- this.getRecordSetService().getRecords(this.mRecordSetId,index + 1,1);
- this.mOutstandingRecordCount++;
- this.items[index] = 1;
- this.updateViews({event:"fetchRows",firstRow:index,lastRow:index});
- }
- };
- RecordSet.prototype.requestRecord = function(index)
- {
- if(this.mDeliveryMode != "page")
- {
- this.requestOneRecord(index);
- return undefined;
- }
- var firstIndex = int(index / this.mPageSize) * this.mPageSize;
- var lastIndex = firstIndex + this.mPageSize * (this.mNumPrefetchPages + 1) - 1;
- this.requestRecordRange(firstIndex,lastIndex);
- };
- RecordSet.prototype.requestRecordRange = function(index, lastIndex)
- {
- var highestRequested = -1;
- if(index < 0)
- {
- index = 0;
- }
- if(lastIndex >= this.getLength())
- {
- lastIndex = this.getLength() - 1;
- }
- while(index <= lastIndex)
- {
- while(index <= lastIndex && this.items[index] != null)
- {
- index++;
- }
- var first = index;
- while(index <= lastIndex && this.items[index] == null)
- {
- this.mOutstandingRecordCount++;
- this.items[index] = 1;
- index++;
- }
- var last = index - 1;
- if(first <= last)
- {
- this.getRecordSetService().getRecords(this.mRecordSetId,first + 1,last - first + 1);
- highestRequested = last;
- this.updateViews({event:"fetchRows",firstRow:first,lastRow:last});
- }
- }
- return highestRequested;
- };
- RecordSet.prototype.startFetchAll = function(pagesize)
- {
- this.mDataFetcher.disable();
- this.mDataFetcher = new RsDataFetcher(this,pagesize);
- };
- RecordSet.prototype.stopFetchAll = function()
- {
- this.mDataFetcher.disable();
- this.mDataFetcher = null;
- };
- RecordSet.prototype.checkLocal = function()
- {
- if(this.isLocal())
- {
- return true;
- }
- NetServices.trace("RecordSet","warning",108,"Operation not allowed on partial recordset");
- return false;
- };
- _global.RsDataFetcher = function(recordSet, increment)
- {
- this.mRecordSet = recordSet;
- this.mRecordSet.addView(this);
- this.mIncrement = increment;
- this.mNextRecord = 0;
- this.mEnabled = true;
- this.doNext();
- };
- RsDataFetcher.prototype.disable = function()
- {
- this.mEnabled = false;
- this.mRecordSet.removeView(this);
- };
- RsDataFetcher.prototype.doNext = function()
- {
- if(!this.mEnabled)
- {
- return undefined;
- }
- while(true)
- {
- if(this.mNextRecord >= this.mRecordSet.getLength())
- {
- return undefined;
- }
- this.mHighestRequested = this.mRecordSet.requestRecordRange(this.mNextRecord,this.mNextRecord + this.mIncrement - 1);
- this.mNextRecord += this.mIncrement;
- if(this.mHighestRequested > 0)
- {
- return undefined;
- }
- }
- };
- RsDataFetcher.prototype.modelChanged = function(eventObj)
- {
- if(eventObj.event == "updateRows" && eventObj.firstRow <= this.mHighestRequested && eventObj.lastRow >= this.mHighestRequested)
- {
- this.doNext();
- }
- if(eventObj.event == "allRows")
- {
- this.disable();
- }
- };
- _global.NetServiceProxyResponder = function(service, methodName)
- {
- this.service = service;
- this.methodName = methodName;
- };
- NetServiceProxyResponder.prototype.onResult = function(result)
- {
- var client = this.service.client;
- result._setParentService(this.service);
- var func = this.methodName + "_Result";
- if(typeof client[func] == "function")
- {
- client[func](result);
- }
- else if(typeof client.onResult == "function")
- {
- client.onResult(result);
- }
- else
- {
- NetServices.trace("NetServices","info",1,func + " was received from server: " + result);
- }
- };
- NetServiceProxyResponder.prototype.onStatus = function(result)
- {
- var client = this.service.client;
- var func = this.methodName + "_Status";
- if(typeof client[func] == "function")
- {
- client[func](result);
- }
- else if(typeof client.onStatus == "function")
- {
- client.onStatus(result);
- }
- else if(typeof _root.onStatus == "function")
- {
- _root.onStatus(result);
- }
- else if(typeof _global.System.onStatus == "function")
- {
- _global.System.onStatus(result);
- }
- else
- {
- NetServices.trace("NetServices","info",2,func + " was received from server: " + result["class"] + " " + result.description);
- }
- };
- _global.NetServiceProxy = function(nc, serviceName, client)
- {
- if(nc != null)
- {
- this.nc = nc;
- this.serviceName = serviceName;
- this.client = client;
- }
- };
- NetServiceProxy.prototype._setParentService = function(service)
- {
- this.nc = service.nc;
- this.client = service.client;
- };
- NetServiceProxy.prototype.__resolve = function(methodName)
- {
- var f = function()
- {
- if(this.client != null)
- {
- arguments.unshift(new NetServiceProxyResponder(this,methodName));
- }
- else if(typeof arguments[0].onResult != "function")
- {
- NetServices.trace("NetServices","warning",3,"There is no defaultResponder, but no responder was given in call to " + methodName);
- arguments.unshift(new NetServiceProxyResponder(this,methodName));
- }
- arguments.unshift(this.serviceName + "." + methodName);
- return this.nc.call.apply(this.nc,arguments);
- };
- return f;
- };
- Object.registerClass("NetServiceProxy",NetServiceProxy);
- NetConnection.prototype.getService = function(serviceName, client)
- {
- var result = new NetServiceProxy(this,serviceName,client);
- return result;
- };
- NetConnection.prototype.setCredentials = function(userid, password)
- {
- this.addHeader("Credentials",false,{userid:userid,password:password});
- };
- NetConnection.prototype.RequestPersistentHeader = function(info)
- {
- this.addHeader(info.name,info.mustUnderstand,info.data);
- };
- NetConnection.prototype.AppendToGatewayUrl = function(urlSuffix)
- {
- this.__urlSuffix = urlSuffix;
- if(this.__originalUrl == null)
- {
- this.__originalUrl = this.uri;
- }
- var u = this.__originalUrl + urlSuffix;
- this.connect(u);
- };
- NetConnection.prototype.ReplaceGatewayUrl = function(newUrl)
- {
- this.connect(newUrl);
- };
- NetConnection.prototype.clone = function()
- {
- var nc = new NetConnection();
- nc.connect(this.uri);
- return nc;
- };
- if(_global.NetServices == null)
- {
- _global.NetServices = new Object();
- NetServices.gatewayUrl = gatewayUrl;
- }
- NetServices.setDefaultGatewayUrl = function(url)
- {
- NetServices.defaultGatewayUrl = url;
- };
- NetServices.setGatewayUrl = function(url)
- {
- NetServices.gatewayUrl = url;
- };
- NetServices.createGatewayConnection = function(url)
- {
- if(url == undefined)
- {
- url = NetServices.gatewayUrl;
- if(url == undefined)
- {
- url = NetServices.defaultGatewayUrl;
- }
- }
- if(url == undefined)
- {
- NetServices.trace("NetServices","warning",4,"createGatewayConnection - gateway url is undefined");
- return null;
- }
- var nc = new NetConnection();
- nc.connect(url);
- return nc;
- };
- NetServices.getHostUrl = function()
- {
- if(!NetServices.isHttpUrl(_root._url))
- {
- return null;
- }
- var firstSlashPos = _root._url.indexOf("/",8);
- if(firstSlashPos < 0)
- {
- return null;
- }
- return _root._url.substring(0,firstSlashPos);
- };
- NetServices.isHttpUrl = function(url)
- {
- return url.indexOf("http://") == 0 || url.indexOf("https://") == 0;
- };
- NetServices.trace = function(who, severity, number, message)
- {
- var fullMessage = who + " " + severity + " " + number + ": " + message;
- trace(fullMessage);
- NetDebug.traceNetServices(who,severity,number,message);
- };
- NetServices.getVersion = function()
- {
- return 1;
- };
- _global.DataGlue = function(dataProvider)
- {
- this.dataProvider = dataProvider;
- };
- _global.DataGlue.bindFormatStrings = function(dataConsumer, dataProvider, labelString, dataString)
- {
- var proxy = new DataGlue(dataProvider);
- proxy.labelString = labelString;
- proxy.dataString = dataString;
- proxy.getItemAt = _global.DataGlue.getItemAt_FormatString;
- dataConsumer.setDataProvider(proxy);
- };
- _global.DataGlue.bindFormatFunction = function(dataConsumer, dataProvider, formatFunction)
- {
- var proxy = new DataGlue(dataProvider);
- proxy.formatFunction = formatFunction;
- proxy.getItemAt = _global.DataGlue.getItemAt_FormatFunction;
- dataConsumer.setDataProvider(proxy);
- };
- _global.DataGlue.prototype.addView = function(viewRef)
- {
- return this.dataProvider.addView(viewRef);
- };
- _global.DataGlue.prototype.getLength = function()
- {
- return this.dataProvider.getLength();
- };
- _global.DataGlue.prototype.format = function(formatString, record)
- {
- var tokens = formatString.split("#");
- var result = "";
- var tlen = tokens.length;
- var i = 0;
- while(i < tlen)
- {
- result += tokens[i];
- result += tokens[i + 1] != "" ? record[tokens[i + 1]] : "#";
- i += 2;
- }
- return result;
- };
- _global.DataGlue.getItemAt_FormatString = function(index)
- {
- var record = this.dataProvider.getItemAt(index);
- if(record == "in progress" || record == undefined)
- {
- return record;
- }
- return {label:this.format(this.labelString,record),data:(this.dataString != null ? this.format(this.dataString,record) : record)};
- };
- _global.DataGlue.getItemAt_FormatFunction = function(index)
- {
- var record = this.dataProvider.getItemAt(index);
- if(record == "in progress" || record == undefined)
- {
- return record;
- }
- return this.formatFunction(record);
- };
- _global.DataGlue.prototype.getItemID = function(index)
- {
- return this.dataProvider.getItemID(index);
- };
- _global.DataGlue.prototype.addItemAt = function(index, value)
- {
- return this.dataProvider.addItemAt(index,value);
- };
- _global.DataGlue.prototype.addItem = function(value)
- {
- return this.dataProvider.addItem(value);
- };
- _global.DataGlue.prototype.removeItemAt = function(index)
- {
- return this.dataProvider.removeItemAt(index);
- };
- _global.DataGlue.prototype.removeAll = function()
- {
- return this.dataProvider.removeAll();
- };
- _global.DataGlue.prototype.replaceItemAt = function(index, itemObj)
- {
- return this.dataProvider.replaceItemAt(index,itemObj);
- };
- _global.DataGlue.prototype.sortItemsBy = function(fieldName, order)
- {
- return this.dataProvider.sortItemsBy(fieldName,order);
- };
- if(inited == null)
- {
- inited = true;
- NetServices.setDefaultGatewayUrl("http://www.danup.es/flashservices/gateway");
- gateway_conn = NetServices.createGatewayConnection();
- CFC_Serv = gateway_conn.getService("cfc.juegos",this);
- }
- CFC_Serv.JugarPartida({usuario:_root.usuario,idJuego:1,puntos:finalscore});
-