The boomer is constructed from three files:
Boomer.fla -
http://www.l4dt.com/boomer.fla
Bommer.fla's document class,
PxlFountain.as(courtesy of
http://www.pxl.dk/flash/004.php)
-
http://www.l4dt.com/PxlFountain.as
GlowParticle.as -
http://www.l4dt.com/GlowParticle.as
Boomer.fla bares no actionscript, although I need to know how
to position him above the spawning sprites(something I'll need to
know for the Poster App as well).
________________________________________________________________________________
PxlFountain.as:
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import GlowParticle;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import boomer;
public class PxlFountain extends Sprite {
//Properties
private var _fountainTimer:Timer;
private var _timerInterval:Number;
private var _particleVelocity:Number;
//Constructor
public function PxlFountain(timerInt:Number = 150,
particleVel:Number = -2) {
//Set stage
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
//Set properties
_timerInterval = timerInt;
_particleVelocity = particleVel;
//Create timer
_fountainTimer = new Timer(_timerInterval, 80);
_fountainTimer.addEventListener(TimerEvent.TIMER,
spawnParticle);
_fountainTimer.start();
}
//Create a new glow particle with random velocity
private function spawnParticle(event:TimerEvent):void {
var randomParticleVelocity:Number = (_particleVelocity *
Math.random()) -2;
var particle:GlowParticle = new
GlowParticle(randomParticleVelocity);
addChild(particle);
}
}
}
__________________________________________________________
GlowParticle.as:
package
{
import flash.display.Sprite;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.display.Shape;
import flash.filters.GlowFilter;
public class GlowParticle extends Sprite {
//Properties
private var _particle:Shape;
private var _particleTimer:Timer;
private var _particleVelocity:Number;
private var _particleLifespan:Number;
private var _xPos:Number;
private var _yPos:Number;
private var _radius:Number;
private var _gravity:Number;
private var _vx:Number;
private var _vy:Number;
//Constructor
public function GlowParticle(particleVel:Number) {
//Set properties
_particle = new Shape();
_particleVelocity = particleVel;
_particleLifespan = 0;
_radius = 10 * Math.random();
_gravity = .7;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = particleVel;
//Set timer for movement and lifespan count
_particleTimer = new Timer(30);
_particleTimer.addEventListener(TimerEvent.TIMER,
moveParticle);
_particleTimer.start();
}
//Calculate vectors, set new position and call draw method.
Or respawn particle.
private function moveParticle(event:TimerEvent):void {
if(_particleLifespan < 300) {
_vy += _gravity;
_yPos += _vy;
_xPos += _vx;
_particleLifespan++;
drawParticle();
}
else{
respawnParticle();
}
}
//Draw the particle and set filter
private function drawParticle():void {
_particle.graphics.clear();
_particle.graphics.lineStyle(4, 0x455b00, 1);
_particle.graphics.drawCircle(_xPos,_yPos,_radius);
_particle.filters = [new GlowFilter(0x5d7c00,1,6,6,2,3)];
addChild(_particle);
}
//Respawn the particle
private function respawnParticle():void {
_particleLifespan = 0;
_xPos = 860;
_yPos = 60;
_vx = (Math.random() * 2 -2.4)*9;
_vy = _particleVelocity;
}
}
}
___________________________________________________________
The swf is being inserted into
Worpress 2.7 footer.php. My
Wordpress engine has 14 plugins installed and activated( I plan to
go in to each plugin's code along with Wordpress' and optimize it
soon). Is Wordpress a possible suspect for the slowness?
Boomer.fla's dimensions are 950 pixels in width and 625
pixels in height. I'd rather Boomer.fla only be 605x196 and set
noscale and 100%x100% in hopes of the sprites reaching the user's
whole screen, but they always cut off at the FLAs
dimensions.