Thursday, 9 May 2013

Actionscript 3 Button

This code is for a button in actionscript 3 that follows a score. When the score is greater than 10 it will loop posting 'true'.


import flash.events.MouseEvent;
import flash.events.Event;

var score = 0;
square.addEventListener(MouseEvent.CLICK,pressed);

function pressed(e:MouseEvent)
{
score +=  1;
trace(score);
}

stage.addEventListener(Event.ENTER_FRAME,loop);

function loop(e:Event)
{

if (score>10)
{

trace('true');
}

}