Foros del Web » Creando para Internet » Flash y Actionscript »

Flash exe builder & flash

Estas en el tema de Flash exe builder & flash en el foro de Flash y Actionscript en Foros del Web. hola a todos alguien me podria explicar paso a paso este script que funciona con flash para ejecutar cmd en flash exe builder (programa para ...
  #1 (permalink)  
Antiguo 07/12/2007, 18:10
Avatar de d12c12g88  
Fecha de Ingreso: diciembre-2006
Mensajes: 142
Antigüedad: 17 años, 11 meses
Puntos: 1
Flash exe builder & flash

hola a todos

alguien me podria explicar paso a paso este script que funciona con flash para ejecutar cmd en flash exe builder (programa para personalizar proyectos exe de flash)
este código lo descargue de un ejemplo de la pagina del programa:

Código HTML:
var FEBRetVal = -3;		//return value from FEB stating that the operation is completed (-3:no command -2:command on execution)
//other return value
var retval=-2;		
var retdata="";

var commandArr:Array = new Array()	//save the next command if current command is not finished
var cid;
var cresp=-1; //response id for error response on FEB return value;
var tfolder="";
var tfile="photo.txt"

commandCall("GetAppDirectory", "retdata", "get application directory ...",0); //get application folder name
cid=setInterval(commandCheck,1000/18); //for command check, waiting for FEB return value

msg_mc._visible=false;
msg_mc._alpha=100;
stop();

function commandCall(pcom,ppar,pmsg,presp){	//run the fscommand or queue if another command still run
	if (FEBRetVal==-3){
		FEBRetVal=-2;
		if(presp==undefined) presp=-1;
		cresp=presp;
		fscommand(pcom,ppar);
		messageSet(pmsg);
	}else{
		var i=commandArr.length;
		commandArr[i]=new Object();
		commandArr[i].com=pcom;
		commandArr[i].par=ppar;
		commandArr[i].msg=pmsg;
		commandArr[i].resp=presp;
	}
}

function commandCheck(){	//interval function to check when fscommand run
	if (FEBRetVal>-2){
		commandResp();
		if(commandArr.length>0){
			var pcom=commandArr.shift();
			commandCall(pcom.com,pcom.par,pcom.msg,pcom.resp);
		}else{
			messageClear();
		}
	}
}

function commandResp(){		// response to run when a command executed
	var warn="";
	if (FEBRetVal==0){
		switch(cresp){
			case 1:
				var j=commandArr.length;
				for(var i=0; i<j; i++) commandArr.shift();
				warn="Failed to open";
				break;
			case 2:
				warn="Failed to save";
				break;
			case 3:
				warn="Failed to read";
				break;
			case 4:
				var j=commandArr.length;
				for(var i=0; i<j; i++) commandArr.shift();
				warn="File not found";
				break;
		}
		if(warn!="") commandCall("MessageBox", "0,Warning,"+warn+",3,retVal","",-1);
	}else if (FEBRetVal==1){
		switch(cresp){
			case 0 :
				tfolder=retdata;
				break;
			case 3 :
				loadBoard();
				break;
		}
	}
	FEBRetVal=-3;
	cresp=-1;
}

function messageSet(t){
	if(t!=""){
		msg_mc._visible=true;
		msg_mc.msg=t;
	}
}

function messageClear(){
	msg_mc._visible=false;
	msg_mc.msg="";
}

function saveFile(){
	var file=tfolder+"\\"+tfile ;
	commandCall("OpenFile",file+",w,0","Opening file...",1);
	var tval="0,"+drawdata+"EOF";
	if(tval.length>10000) {
		commandCall("MessageBox", "0,Warning,Data Exceeded... cannot save all data,3,retVal","",-1);
		tval=tval.slice(0,tval.lastIndexOf("|",9995))+"|EOF"
	}
	commandCall("WriteFile",tval,"Writing file...",2);
	commandCall("CloseFile","0","Closing file...",-1);
}

function loadFile(){
	var file=tfolder+"\\"+tfile;
	commandCall("IsFileExist",file+",retval","Checking file...",4);
	commandCall("OpenFile",file+",r,0","Opening file...",1);
	commandCall("ReadFile","0,9998,retdata","Reading file...",3);
	commandCall("CloseFile","0","Closing file...",-1);
}
Código HTML:
var color=0xffffff;
var chalk=0;
var thick=3;
var drawdata="";
pickChalk(chalk);

onMouseDown = function (){
	if(board_mc._xmouse>0){
		board_mc.moveTo(board_mc._xmouse, board_mc._ymouse);
		drawdata=drawdata+("s"+board_mc._xmouse+"_"+board_mc._ymouse+"|");
		onMouseMove = function (){ 
			drawdata+=(board_mc._xmouse+"_"+board_mc._ymouse+"|");
			board_mc.lineTo(board_mc._xmouse, board_mc._ymouse);
		}
	}
}

onMouseUp=function(){
	onMouseMove=null;
} 

function pickChalk(i){
	thick=3+i*1.75;
	board_mc.lineStyle(thick,color);
	drawdata+=("t"+thick+"|");
	chalk=i;
	pick_mc._x=28.5+i*29;
}

function loadBoard(){
	if (retdata!=""){
		var tn=retdata.indexOf("EOF");
		if(tn>-1) drawdata=retdata.slice(0,tn)
		else  drawdata=retdata;
		var temp=drawdata.split("|");
		var tc="";
		board_mc.clear();
		for(var i=0;i<temp.length-1;i++){
			tc=temp[i].charAt(0);
			if(tc=="t"){
				board_mc.lineStyle(Number(temp[i].slice(1)),color);
			}else if(tc=="s"){
				var temp2=temp[i].slice(1).split("_");
				trace(Number(temp2[0])+"<"+Number(temp2[1]));
				board_mc.moveTo(Number(temp2[0]),Number(temp2[1]));
			}else if(tc!=""){
				var temp2=temp[i].split("_");
				trace(">>"+Number(temp2[0])+"-"+Number(temp2[1]));
				board_mc.lineTo(Number(temp2[0]),Number(temp2[1]));
			}
		}
		pickChalk(chalk);
	}
}

function clearBoard(){
	board_mc.clear();
	drawdata="";
	pickChalk(chalk);
}
les agradecería la ayuda
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 00:14.