Hi,
You do not add the _sprite into the children list of the main movie.
Add it here.
public function Moodbox2() {
_sprite = new Sprite();
addChild(_sprite );
.....
On 4/10/07, ilteris kaplan <[EMAIL PROTECTED]> wrote:
Thanks Atila,
I am totally new to programming in as3 and I am trying to make sense :)
I though it would be a good idea to keep the mouseEvents on the main
class file along with everything but as you said I moved it from there
to particleManager and it solved my problem. thanks.
On 4/9/07, Rákos Attila <[EMAIL PROTECTED]> wrote:
>
> You didn't add _sprite to the display list, so how could it trigger
mouse
> events if it is not even visible? And on the other hand, _sprite is
> totally empty, it has no hit area where you can click and fire the
> MOUSE_DOWN event. Why don't you add event listener to the particle
> manager? Sorry if I miss something, but I don't understand exactly what
> are you going to do.
>
> Attila
>
> > Hello All,
> >
> > I am having a difficulty using mouseEvents in AS3.0 with Flex
> > Builder. When I test a basic example it works fine but my setup is
> > different. It is like this: I do have some circles which is
> > controlled by particleManager class. Basically Iam adding
> > particleManager with addChild method in order to render it on the
> > stage. Next I created _sprite in order to call mouseEvents on top of
> > it. And in the below code, I didn't do anything different, I just
> > added Listeners for mouseEvents. Do I have to do something special
> > with pm object? Should I be instantiating mouse Events on top of pm
> > object? Am I supposed to register pm objects with mouseEvents so that
> > they can be triggered? If so what's the right way to do it?
> >
> > I really appreciate any help.
> > best,
> > ilteris
> >
> >
> > /**
> > * saturday april 7.
> > * first iteration.
> > */
> > package {
> > import flash.display.Sprite;
> > import flash.events.Event;
> > import flash.events.TimerEvent;
> > import flash.utils.Timer;
> > import flash.events.MouseEvent;
> >
> > [SWF(backgroundColor="#1C1A14", width="400", height="180",
> > frameRate="61")]
> >
> >
> > public class Moodbox2 extends Sprite {
> > private var _timer:Timer;
> > public var pm:ParticleManager;
> > private var _sprite:Sprite;
> > public function Moodbox2() {
> > pm = new ParticleManager();
> > _sprite = new Sprite();
> > addChild(pm);
> >
> >
> > _sprite.addEventListener(MouseEvent.MOUSE_DOWN,
onMouseDown);
> > _sprite.addEventListener(MouseEvent.MOUSE_UP,
onMouseUp);
> >
> >
> > _timer = new Timer(3);
> > _timer.addEventListener("timer", onTimer);
> > _timer.start( );
> >
> >
> > }
> >
> > public function onTimer(event:TimerEvent):void {
> > pm.idle(0.4);
> > pm.draw();
> > // addChild(pm);
> > }
> >
> > private function onMouseDown(event:MouseEvent):void {
> > trace(pm.PRTS[0].pos.x);
> > // pm.PRTS[0].pos.setN(mouseX,mouseY);
> > _sprite.addEventListener(MouseEvent.MOUSE_MOVE,
onMouseMove);
> > }
> >
> > private function onMouseUp(event:MouseEvent):void {
> > _sprite.removeEventListener(MouseEvent.MOUSE_MOVE,
> > onMouseMove);
> > }
> >
> >
> > private function onMouseMove(event:MouseEvent):void {
> > trace("yes");
> > }
> >
> >
> > }
> > }
> >
> > _______________________________________________
> > [email protected]
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training
> > http://www.figleaf.com
> > http://training.figleaf.com
> >
>
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
--
愿平原上的风指引我们的方向。
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com