com.lookmum.view.ParticlePlayground
Particle playground class
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.startFountain()
function ParticlePlayground(target:MovieClip)Constructor function.
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.startFountain()
target | The target movieclip in which to create the particle fountain. |
static public PARTICLE_DEATH:Stringimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at x='+getParticleX(event.ref)+' '+ y='+getParticleY(event.ref))
}
static public PARTICLES_END:Stringimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.addEventListener(ParticlePlayground.PARTICLES_END,onParticlesEnd)
this.pPlayground.burst = true
this.pPlayground.burstLength = 10
this.pPlayground.startFountain()
function onParticlesEnd(event:Object):Void{
trace('all particles gone')
}
public width:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.width = 800
this.pPlayground.startFountain()
public height:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.height = 600
this.pPlayground.startFountain()
public x:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.x = 300
this.pPlayground.startFountain()
public y:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.y = 300
this.pPlayground.startFountain()
public xVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.x = 300
this.pPlayground.xVariation = 100
this.pPlayground.startFountain()
public yVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.y = 300
this.pPlayground.yVariation = 100
this.pPlayground.startFountain()
public distance:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.distance = 50
this.pPlayground.startFountain()
public distanceVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.distance = 50
this.pPlayground.distanceVariation = 20
this.pPlayground.startFountain()
public rate:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.rate = 3
this.pPlayground.startFountain()
public rateVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.rate = 3
this.pPlayground.rateVariation = 4
this.pPlayground.startFountain()
public frameGap:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.frameGap = 4
this.pPlayground.startFountain()
public frameGapVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.frameGap = 4
this.pPlayground.frameGapVariation = 4
this.pPlayground.startFountain()
public particleLimit:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.frameGap = 4
this.pPlayground.frameGapVariation = 4
this.pPlayground.startFountain()
public burst:Booleanimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.burst = true
this.pPlayground.burstLength = 10
this.pPlayground.startFountain()
public burstLength:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.burst = true
this.pPlayground.burstLength = 10
this.pPlayground.startFountain()
public particleSource:Stringimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.particleSource = 'myLibrarySymbol'
this.pPlayground.startFountain()
public scale:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.scale = 500
this.pPlayground.startFountain()
public scaleVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.scale = 500
this.pPlayground.scaleVariation = 500
this.pPlayground.startFountain()
public direction:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.direction = 45
this.pPlayground.startFountain()
public directionVariation:Numberpublic particleFilters:Array [Write Only]import com.lookmum.view.ParticlePlayground
import flash.filters.BlurFilter;
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
var blurX:Number = 3;
var blurY:Number = 3;
var quality:Number = 3;
var filter:BlurFilter = new BlurFilter(blurX, blurY, quality);
var filterArray:Array = new Array();
this.filterArray.push(this.filter);
this.pPlayground.particleFilters = filterArray;
this.pPlayground.startFountain()
public gravity:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.gravity = 1
this.pPlayground.startFountain()
public speed:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.speed = 4
this.pPlayground.startFountain()
public speedVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.speed = 4
this.pPlayground.speedVariation = 4
this.pPlayground.startFountain()
public acceleration:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.acceleration = 0.2
this.pPlayground.startFountain()
public accelerationVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.acceleration = 0.4
this.pPlayground.accelerationVariation = 0.2
this.pPlayground.startFountain()
public particleColour:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.particleColour = 0xFF0000
this.pPlayground.startFountain()
public alpha:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.alpha = 50
this.pPlayground.startFountain()
public alphaVariation:Numberimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.alpha = 50
this.pPlayground.alphaVariation = 50
this.pPlayground.startFountain()
public broadcastParticleDeath:Booleanimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at x='+getParticleX(event.ref)+' '+ y='+getParticleY(event.ref))
}
public killStoppedParticles:Booleanimport com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.acceleration = -0.1
this.pPlayground.killStoppedParticles = true
this.pPlayground.startFountain()
public function addEventListener(eventType:String, listener:Function)
Add a listener function to be notified of a specified event
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at x='+getParticleX(event.ref)+' '+ y='+getParticleY(event.ref))
}
Although not required, it is advised that you use this in conjunction with the macromedia delegate utility to keep your function scope in order.
import mx.utils.Delegate
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,Delegate.create(this,this.onParticleDeath))
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at x='+getParticleX(event.ref)+' '+ y='+getParticleY(event.ref))
}
eventType | The type of event to listen to |
listener | The function to call on event |
public function removeEventListener(eventType:String, listener:Function)
Remove a listener from being notified of a specified event
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.removeEventListener(ParticlePlayground.PARTICLE_DEATH,this.onParticleDeath)
eventType | The type of event no longer listen to |
listener | The object to no longer call on event |
public function startFountain(frame:Number):Voidstart the particle fountain. if frame is specified then simulate start after amount of frames (this can have serious performance problems if set too high)
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.startFountain()
frame | the number of frames to simulate having passed |
public function stopFountain(fast:Boolean):Voidstop the generation of particles. and erase all current particle if fast is true
this.pPlayground.stopFountain()
fast | deletes all existing particles immediately |
public function getParticleX(ref:Number):Number
gets the x coordinate of a specified particle. use with the PARTICLE_DEATH event to get particle references
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at x='+getParticleX(event.ref))
}
ref | a unique reference number of the particle |
the x coordinate of the particle
public function getParticleY(ref:Number):Number
gets the y coordinate of a specified particle. use with the PARTICLE_DEATH event to get particle references
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead at y='+getParticleY(event.ref))
}
ref | a unique reference number of the particle |
the y coordinate of the particle
public function getParticleScale(ref:Number):Number
gets the scale in percent of a specified particle. use with the PARTICLE_DEATH event to get particle references
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead with scale='+getParticleScale(event.ref))
}
ref | a unique reference number of the particle |
the scale of the particle
public function getParticleSpeed(ref:Number):Number
gets the speed in pixels per frame of a specified particle. use with the PARTICLE_DEATH event to get particle references
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead with speed='+getParticleSpeed(event.ref))
}
ref | a unique reference number of the particle |
the speed of the particle
public function getParticleDirection(ref:Number):Number
gets the direction in degrees of a specified particle. use with the PARTICLE_DEATH event to get particle references
import com.lookmum.view.ParticlePlayground
var pPlayground:ParticlePlayground = new ParticlePlayground(thisMc)
this.pPlayground.broadcastParticleDeath = true
this.pPlayground.addEventListener(ParticlePlayground.PARTICLE_DEATH,onParticleDeath)
this.pPlayground.startFountain()
function onParticleDeath(event:Object):Void{
trace('particle dead with direction='+getParticleDirection(event.ref))
}
ref | a unique reference number of the particle |
the direction of the particle