Monday, March 1, 2010

Code

so i haven't posted anything in a while, that doesn't mean i haven't been doing things.
in Flash we've been working with action script. I'm going to post my code so far so i can reference it.


package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;

public class Main extends MovieClip
{
var pageOne:PageOne;
var pageTwo:PageTwo;

public function Main()
{
//trace( "hello world");
pageOne = new PageOne;
pageTwo = new PageTwo;
addChild(pageOne);

//ev list
pageOne.buttonOne.addEventListener(MouseEvent.CLICK, onButtonOneClick);
pageTwo.buttonReturn.addEventListener(MouseEvent.CLICK, onButtonReturnClick);

}
//ev handler
function onButtonOneClick(event:MouseEvent):void
{
removeChild(pageOne);
addChild(pageTwo);
}

function onButtonReturnClick(event:MouseEvent):void
{
removeChild(pageTwo);
addChild(pageOne);
}
}

}

No comments:

Post a Comment