Changing the way this mouse trail works-need fewer repeats


hello,

i found tutorial on line me create mouse trail.

everything works fine, trying play different options.

the 1 thing trying have fewer repeats, object using larger 1 in tutorial , looks crowded. so, trying figure out change code, fewer repeats occur. assume math random part, not sure.

does know in code below change option?

thanks

babs

 

/* mouse trailer */
/* developed carlos yanez */

 

package
{
    import flash.display.sprite;
    import flash.ui.mouse;
    import flash.events.mouseevent;
    import flash.events.event;

 

    public class mousetrailer extends sprite
    {
        /* light ball object */
       
        var lightball:lightball;
       
        /* constructor */

 

        public function mousetrailer():void
        {
            mouse.hide();
            stage.addeventlistener(mouseevent.mouse_move, starttrailer);
        }

 

        private function starttrailer(e:mouseevent):void
        {
            /* create new lightball object */

 

            lightball = new lightball();

 

            /* position */

 

            lightball.x = mousex + math.random() * lightball.width;
            lightball.y = mousey - math.random() * lightball.height;

 

            /* add stage */

 

            addchild(lightball);

 

            /* add listener animate function */

 

            lightball.addeventlistener(event.enter_frame, animate);
        }

 

        /* animate function */

 

        private function animate(e:event):void
        {
            /* alpha */

 

            e.target.alpha -= 0.05;

 

            /* if lightball no longer visible, remove */

 

            if (e.target.alpha <= 0)
            {
                e.target.removeeventlistener(event.enter_frame, animate);

 

                removechild(e.target sprite);
            }

 

            /* scale */

 

            e.target.scalex -= 0.1;
            e.target.scaley -= 0.1;

 

            /* y position */

 

            e.target.y += 1;
        }
    }
}

it appears utilize mouse_move event basis planting lightball instances, doubt can impose direct control.  may able introduce indirect control having counter of sorts use plant lightballs when particular value realized, skipping turn or more.



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Joomla site hacked, cant see front and - Joomla! Forum - community, help and support

Christian Home School Programs - Joomla! Forum - community, help and support

Trouble with PF_OutFlag_I_USE_AUDIO and PF_CHECKOUT_LAYER_AUDIO