Tuesday, 21 June 2011

Script For Banner

I have made the script for my banner and placed it here. Alot of this is to tell the images what to do.

Key:
nyan = cat
af1 = face 1
af2 = face 2
af3 = face 3

With the first two lines I have made a scoring system which makes the score on the banner appear as 'Score 0'.

The next line is telling nyan what to do for the function.

With the next score lot it tells nyan when it is clicked, the score will add by one, also it is telling nyan to open a web page on the internet.

Next I have got another event listener to tell what the next lot to do which is af1, af2 and af3 to rotate.

The next two lines tell nyan to appear anywhere randomly within 0-160 on the X axis and 0-600 on the Y axis.

Finally the last three lines tell af1, af2 and af3 to rotate at a speed of 10fps.

__________________________________________________________________________________

var score:Number=0
scoreText.text="SCORE  "+String(score)


nyan.addEventListener(MouseEvent.CLICK, fl_ClickToHide_2);

function fl_ClickToHide_2(event:MouseEvent):void
{
score+=1
scoreText.text="SCORE  "+String(score)
trace("SCORE")
var request:URLRequest = new URLRequest("http://www.plymouthart.ac.uk/prospectus/Further-Education/BTEC-Level-3-Extended-Diploma-in-Interactive-Media-and-Games-Art/IMFE1A1112");
navigateToURL(request);

}
addEventListener(Event.ENTER_FRAME, RotateContinuously);

function RotateContinuously(event:Event)
{
nyan.x=Math.random()*160
nyan.y=Math.random()*600

af1.rotation += 10;
af2.rotation += 10;
af3.rotation += 10;
}

No comments:

Post a Comment