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

Capturar movie con elementos y enviarlos como JPG

Estas en el tema de Capturar movie con elementos y enviarlos como JPG en el foro de Flash y Actionscript en Foros del Web. Hola a todos!!! He estado programando Flash en estos días pero me he encontrado con algo que no se si se pueda hacer. Estoy intentando ...
  #1 (permalink)  
Antiguo 09/11/2006, 16:43
Avatar de WinGFX  
Fecha de Ingreso: mayo-2006
Ubicación: Bogotá
Mensajes: 86
Antigüedad: 17 años, 11 meses
Puntos: 3
Exclamación Capturar movie con elementos y enviarlos como JPG

Hola a todos!!!


He estado programando Flash en estos días pero me he encontrado con algo que no se si se pueda hacer.

Estoy intentando hacer una captura de un MovieClip (teniendo en cuenta que tenemos otros simbolos, líneas y formas que lo conforman) para guardarlo a una imagen JPEG.

Ya tengo el script PHP que me permite crear y guardar la imagen.

El problema lo tengo es cuando Flash crea los píxeles que son enviados pero solo veo que me guarda un mapa de bit, no los objetos que mencioné....


Alguno sabe como resolverlo??

Por poco................ como tengo el AS que lo procesa? Aqui está:


Código PHP:
// Carga de el objeto a instanciar para la captura
import flash.display.BitmapData;
import flash.filters.DropShadowFilter
import flash
.filters.BlurFilter;
import flash.geom.Matrix;
import flash.filters.ColorMatrixFilter;
//Build color Matrix Filter
var matrix:Array = new Array();
matrix matrix.concat([10010]); // red
matrix matrix.concat([01000]); // green
matrix matrix.concat([00110]); // blue
matrix matrix.concat([00010]); // alpha
var filterCol:ColorMatrixFilter = new ColorMatrixFilter(matrix);
//
preloader._visible 0;
//
function outputClip(who){
 
//preloader visible 
 
_root.toda.p.gotoAndStop("guardar");
 
resultsImg.play();
 
resultsImg.preloader._visible 1;
 
//Here we will copy pixels data
 
var pixels:Array = new Array()
 
//Create a new BitmapData
 
var snap = new BitmapData(who._widthwho._height); 
 
snap.draw(who);
 var 
w:Number snap.widthtmp
 
var h:Number snap.height
 
//Build pixels array using an onEnterframe to avoid timeouts, capture a row per iteration, show a progressbar
 
var a:Number 0
 this
.onEnterFrame = function(){
  for(var 
b=0b<=hb++){
   
tmp snap.getPixel32(ab).toString(16)
   
pixels.push(tmp.substr(1))
  }
  
perc =  int((a*100)/w)
  
resultsImg.preloader.perc.text perc+" %"
  
resultsImg.preloader.barra._xscale perc     
  a
++
  if(
a>w){ //Finish capturing
   
resultsImg.preloader._visible false
   sendData
(pixelshw)
   
//free memory
   
snap.dispose()
   
delete this.onEnterFrame
  
}
 }
}
sendData = function(pixels:Array, h:Numberw:Number) {
 
//Create the LoadVars object and pass data to PHP script 
 
output = new LoadVars()
 
output.img pixels.toString() 
 
output.height 
 output
.width 
 
//The page (and this movie itself) should be in a server to work 
 
output.sendAndLoad("chargeImage.php"output"POST");
 
output.onLoad = function(ok) {
  if(
ok) {
   
hMsg this.msg;
   if(
hMsg == 'NoGD') {
    
getURL("javascript:alert('No se puede realizar la imagen, no se dispone de GD')");
   } else if(
hMsg == 'not_created') {
    
getURL("javascript:alert('No se pudo guardar la imagen')");
   } else if(
hMsg == 'created_saved') {
    
resultsImg.gotoAndPlay(31);
   }
  } else {
   
getURL("javascript:alert('No se puede establecer conexion')");
  }
 }
};

_root.toda.p.bguardar.onPress = function() { outputClip(_root.toda.p); };
stop(); 
__________________
"Si piensas en que harás mañana, mejor hazlo hoy!"

Consejos para las buenas preguntas
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 13:40.