Wednesday, May 25, 2011

experiments in flash

to make a button that when you click on it it goes to a web page was easy. i made a button on the stage and then
use the code snip it called 'click to go to web page' then once you have to coding up you have to replace the web address they have to a web page you want it to go to

button.addEventListener(MouseEvent.CLICK, fl_ClickToGoToWebPage);

function fl_ClickToGoToWebPage(event:MouseEvent):void
{
navigateToURL(new URLRequest("http://my.deviantart.com/messages/"), "_blank");
}


in this one we made a motion guide by making a path on the stage with the pen tool and 
then made the path into a motion guide layer and tweened everything so it followed the path




fist we made put a circle on the stage and turned it into a movie clip then jumped inside of it and made a shape tween of it starting small and then getting bigger


then to make it into a game we added in this code

var score: Number =0
 scoreText.text="SCORE "+String(score)
target.addEventListener(MouseEvent.CLICK,hitTarget);

function hitTarget(event:MouseEvent):void
{   score+=1
    scoreText.text="SCORE "+String(score)
trace("SCORE")

}


once this code was put in it made a scoring system appear and you are now able to be told how many times you have clicked the circle   

No comments:

Post a Comment