Comunidad de diseño web y desarrollo en internet online

código para dar brillo a mc

Citar            
MensajeEscrito el 24 Oct 2009 06:36 pm
Estimados, estoy necesitando que con el siguiente código, el grillo_mc logre alterar los valores del brillo. El punto es que al final del código (las últimas lineas desde el Enterframe, no logro encontrar la manera de escribirlo para que surta efecto. ¿Serían tan amables de indicarme precisamente cómo debo hacerlo?

Gracias de antemano.

Código :

import flash.filters.ColorMatrixFilter;
import mx.transitions.Tween;

function brillo(prop, oldVal, newVal, clip) {
   var brillo_array:Array = [1, 0, 0, 0, newVal, 0, 1, 0, 0, newVal, 0, 0, 1, 0, newVal, 0, 0, 0, 1, 0];
   clip.filters = [new ColorMatrixFilter(brillo_array)];
}

function darbrillo(clip, ini, fin) {
   clip.watch("brillo",brillo,clip);
   var easing:Object = new Tween(clip, "brillo", Strong.easeOut, ini, fin, .5, true);
}


onEnterFrame = function () {
   if (mc.hitTest(sombramayor_mc)) {
      darbrillo(grillo_mc,0,100); //aquí es donde creo que falla.

      }

Por incubo

53 de clabLevel



 

firefox
Citar            
MensajeEscrito el 27 Oct 2009 01:11 am
y si solo lo ocupas asi?

import flash.filters.ColorMatrixFilter;
import mx.transitions.Tween;

function brillo(prop, oldVal, newVal, clip) {
var brillo_array:Array = [1, 0, 0, 0, newVal, 0, 1, 0, 0, newVal, 0, 0, 1, 0, newVal, 0, 0, 0, 1, 0];
clip.filters = [new ColorMatrixFilter(brillo_array)];
}

function darbrillo(clip, ini, fin) {
clip.watch("brillo",brillo,clip);
var easing:Object = new Tween(clip_mc, "brillo", Strong.easeOut, ini, fin, .5, true);
}
darbrillo(clip_mc,0,100);

Por Gatoman

1 de clabLevel



 

firefox
Citar            
MensajeEscrito el 27 Oct 2009 10:15 pm
es que tiene que alterar su brillo cuando coliciona con el otro mc. por lo tanto Ese código no está completo.

Por incubo

53 de clabLevel



 

firefox
Citar            
MensajeEscrito el 31 Oct 2009 05:33 am
ya encontré el error.
donde dice:

if (mc.hitTest(sombramayor_mc)) {
darbrillo(grillo_mc,0,100); //aquí es donde creo que falla.

}

debería decir if (grillo_mc.hitTest(sombramayor_mc)) {

Por incubo

53 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.