EDIT: I changed the code. I implemented it in the last code block (third), being the first two originals.
I have a gaia website, in one of its pages there should be a background particle effect. taken from http://blog.soulwire.co.uk/flash/actionscript-3/as3-alphabet-particles
But when importing and trying to use it I only get errors and I do not know what direction should I go to to create it:
PAGE01: Page which intends to use the effect:
import com.gaiaframework.templates.AbstractPage;
import com.gaiaframework.events;
import com.gaiaframework.debug;
import com.gaiaframework.api;
import flash.display.*;
import flash.events.*;
import com.greensock.TweenMax;
public class ClubPage extends AbstractPage
{
public var ButtonInicio:MovieClip;
public var NavArray:Array;
public function ClubPage()
{
super();
alpha = 0;
ButtonInicio.branch = Pages.HOME;
NavArray = [ButtonInicio];
for each (var button:MovieClip in NavArray)
{
button.buttonMode = true;
button.mouseChildren = false;
button.addEventListener(MouseEvent.CLICK, onClick, false,0,true);
}
}
override public function transitionIn():void
{
super.transitionIn();
TweenMax.to(this, 0.3, {alpha:1, onComplete:transitionInComplete});
}
override public function transitionOut():void
{
super.transitionOut();
TweenMax.to(this, 0.3, {alpha:0, onComplete:transitionOutComplete});
for each (var button:MovieClip in NavArray)
{
button.removeEventListener(MouseEvent.CLICK, onClick);
}
}
private function onClick(e:MouseEvent):void
{
Gaia.api.goto(e.target.branch);
}
}
PAGE 02: And as you can see in the particle effect source code of the above link, I'm trying to implement this code on PAGE01 :
import com.soulwire.physics.ParticleEmitter;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.MovieClip;
public class Club extends Sprite
{
/*
========================================================
| Private Variables | Data Type
========================================================
*/
private var emitter:ParticleEmitter;
/*
========================================================
| Constructor
========================================================
*/
public function Club()
{
stage.align = 'TL';
stage.scaleMode = 'noScale';
emitter = new ParticleEmitter(stage,false,'TestParticle',20,8,[2,4],[10,100],5,0,0,'wander');
emitter.x = stage.stageWidth / 2;
emitter.y = stage.stageHeight / 2;
addChild( emitter );
emitter.init();
}
}
I've tried copypaste and trying to adapt but nothing works, I have spent 2 days but nothing comes to my mind on what possible errors there are. If anybody knows gaia, as3, and knows how he would implement this please guide me through. Thanks
EDIT: This is my implementation, I keep getting null references errors: TypeError: Error #1009: Cannot access a property or method of a null object reference. at com.soulwire.physics::ParticleEmitter() at com.pages::ClubPage() Cannot display source code at this location.
import com.soulwire.physics.ParticleEmitter;
public class ClubPage extends AbstractPage
{
var emitter:ParticleEmitter;
public function ClubPage()
{
super();
alpha = 0;
emitter = new ParticleEmitter(stage,false,'TestParticle',20,8,[2,4],[10,100],5,0,0,'wander');
this.addChild( emitter );
emitter.x = stage.stageWidth / 2;
emitter.y = stage.stageHeight / 2;
emitter.init();
}