The original tutorial that I used for this assignment was "Create a Glowing Mouse Trailer in Flash". I chose this tutorial as it was adaptable so I could put my own spin on it. Its easy guidelines had me away in no time. The aim of the tutorial was to create a mouse trailer so whenever your mouse would hover over the stage it would disappear and a glowing trailer would follow the path that your mouse would take. When I was looking for tutorials online pretty much all the tutorials used balls of white to crate an almost sparkle effect. I adapted my chosen tutorial to create a heart trailer on a black background, with a theme of pink and black. The effect works by firstly creating your chosen variable, for me this was heart:
var heart:Heart;
This is then followed by a constructor function which hides the mouse cursor when hovering over the stage and also starts the trailer process:
public function MouseTrailer():void
{
Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE, startTrailer);
}
The following bit of code I had to change as it didn't work the first time I tried to play the effect. The tutorial had created a private function so after playing around with it I realise the function should not have been made private:
function startTrailer(e:MouseEvent):void
{
For the rest of the tutorial it focussed on duplicating the heart whenever the mouse was moved and creating it's chosen position:
heart = new Heart();
heart.x = mouseX + Math.random() * heart.width;
heart.y = mouseY - Math.random() * heart.height;
addChild(heart);
heart.addEventListener(Event.ENTER_FRAME, animate);
function animate(e:Event):void
{
e.target.alpha -= 0.05;
if (e.target.alpha <= 0)
{
e.target.removeEventListener(Event.ENTER_FRAME, animate);
removeChild(e.target as Sprite);
}
e.target.scaleX -= 0.1;
e.target.scaleY -= 0.1;
e.target.y += 3;
}
}
}
}
My Finished Tutorial:
What I found difficult/easy:
The thing I found most difficult was changing up the code to make my finished effect work. It took a lot of concentration and playing about with the as file. I also had to add other code such as right hand brackets. Creating the background stage for my effect was probably the easiest thing as well as choosing the colour scheme. I liked that I changed it up completely by creating my own heart image on photoshop beforehand as I didn't want to do the generic sparkle effect:
I learnt that the code in tutorials is not always right and adapting it to fit your own criteria can happen. I learnt how to hide the cursor from the stage and to create an ongoing effect and duplication of a movie clip. I also learnt that action script is not as difficult as it looks!
Dropbox Link!