Me pregunto si alguien sabe que hay qe modificar para que se ejecuten con la pelicula y no al hacer click. Gracias de antemano.
Código PHP:
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
//============DRAW ELEMENTS===========//
//Fireworks Frame-work
var fw_bit:BitmapData = new BitmapData(Stage.width, Stage.height, true);
var fw_mc:MovieClip = _root.createEmptyMovieClip("fw_mc", _root.getNextHighestDepth());
fw_mc.attachBitmap(fw_bit, this.getNextHighestDepth());
//
//Graphics Management
var baseMatrix = new flash.geom.Matrix();
var fade = new flash.geom.ColorTransform();
fade.alphaMultiplier = 0.9;
//
//Init
var fired:Boolean = false;
var floor:Number = 130;
var launch:Point = new Point(Stage.width/2, floor);
var gravity = .02;
var res = .97;
var max_fw = 4;
var particlecolor = 0xFFFFFFFF;
var particleglowcolor = 0xff0000;
var particles = new Array();
var glow = new GlowFilter(particleglowcolor, 5, 5, 5, 5);
var fw_num:Number = 0;
//
//===========SEQUENCE STATUS=============//
fw_mc.filters = [glow];
fw_mc.blendMode = "add";
//
onEnterFrame = function () {
if (fw_num<max_fw) {
fw_mc.onPress = function() {
fw_num++;
var mousepos = new Point(_xmouse, _ymouse);
var mouseangle = Math.atan2(mousepos.y-launch.y, mousepos.x-launch.x);
var mousepower = Point.distance(launch, mousepos)/45;
particles.unshift(createParticle(launch.x, floor, mouseangle, mousepower));
// if particles length is greater than maxparticles
// reduce the particles to be maxparticles
// since no movie clips are used to manage the
// particles, no movie clips have to be removed
if (particles.length>max_fw) {
particles.length = max_fw;
}
};
} else {
delete fw_mc.onPress;
}
fw_bit.colorTransform(fw_bit.rectangle, fade);
// for all particles in the array
for (i in particles) {
currparticle = particles[i];
// draw the particle at its current location
fw_bit.setPixel32(currparticle.x, currparticle.y, particlecolor);
// move it for the next frame
positionParticle(currparticle);
for (j in currparticle.fArr) {
makeExplode_move(currparticle.fArr[j]);
if(currparticle.fArr[j].det==true){
currparticle.fArr[j] = null;
}
}
if(currparticle.exploded == true){
currparticle.x = Stage.width*2;
currparticle.y = Stage.height*2;
}
}
};
function createParticle(x, y, angle, power) {
// create new object
var particle = new Object();
// assign position values
particle.x = x;
particle.y = y;
particle._initTime = getTimer();
particle.exploded = false;
particle.fArr = new Array();
// develop a random angle based on angle passed and the
// available spread defined earlier
angle = -angle;
// generate a random power value
power = -power/2+power+power;
// create vx and vy variables for
// movement using angle and power
particle.vx = Math.cos(angle)*power;
particle.vy = -Math.sin(angle)*power;
// return particle object
return particle;
}
//
function positionParticle(particle) {
var pTime:Number = Math.floor((getTimer()-particle._initTime)/1000);
// move based on vx and vy
particle.x += particle.vx;
particle.y += particle.vy;
// bounce if it hits the floor
if (particle.y>floor) {
makeExplode(particle);
fired = false;
}
// apply gravity to vy
particle.vy += gravity;
particle.vy *= res;
particle.vx *= res;
if (pTime>=2) {
if (particle.exploded == false) {
particle.fArr = makeExplode(particle, 100);
fw_num--;
particle.exploded = true;
}
}
}
//
function makeExplode(particle, num) {
var exArray = new Array();
for (i=0; i<num; i++) {
exArray[i] = makeExplode_frag(particle);
}
return exArray;
}
//
function makeExplode_frag(particle) {
var frag = new Object();
frag.det = false;
frag._initTime = getTimer();
frag._dieTime = 2000+random(2000);
frag.x = particle.x;
frag.y = particle.y;
angle = Math.random()*(2*Math.PI);
power = 1+Math.random()*5;
frag.vx = Math.cos(angle)*power;
frag.vy = -Math.sin(angle)*power;
return frag;
}
//
function makeExplode_move(frag) {
frag.fTime = Math.floor((getTimer()-frag._initTime));
frag.x += frag.vx;
frag.y += frag.vy;
// bounce if it hits the floor
// apply gravity to vy
frag.vy += gravity/2;
frag.vy *= res;
frag.vx *= res;
fw_bit.setPixel32(frag.x, frag.y, particlecolor);
if (frag.fTime>=frag._dieTime) {
if (frag.det == false) {
frag.det = true;
}
}
}