Hi,
I am working on a project in which i am planning to display a video as one of my final project for my video art elective. I want to make it interactive by adding a mouse trail on top of it so that viewers can leave a mark temporarily on it… the mouse trail’s example is in the link below. http://www.inflexions.org/intothemidst.html
i have a code which i tried to fiddle with but i cudnt find a way around…
Can someone please guide me with the project…
Regards
Moonis
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
{
stage.addEventListener(MouseEvent.MOUSE_MOVE, startTrailer);
}
private function startTrailer(e:MouseEvent):void
{
/* Create a new LightBall object */
lightBall = new LightBall();
/* Position */
lightBall.x = mouseX + Math.random() * lightBall.width;
lightBall.y = mouseY - Math.random() * lightBall.height;
/* Add to Stage */
addChild(lightBall);
/* Add Listener to Animate function */
lightBall.addEventListener(Event.ENTER_FRAME, animate);
}
/* Animate function */
private function animate(e:Event):void
{
/* Alpha */
e.target.alpha -= 0.03;
/* If lightBall is no longer visible, remove it */
if (e.target.alpha <= 0.03)
{
e.target.removeEventListener(Event.ENTER_FRAME, animate);
removeChild(e.target as Sprite);
}
/* Y Position */
e.target.y += 0.9;
}
}