import fl.controls.Button import fl.controls.Label //1. create the instances //(korvaa piirrettyjen buttonien instance-nimillä kohdat 1-3 ja komment them.Do it manually. U need eventlisteners.) var about_button:Button = new Button(); var story_button:Button = new Button(); var images_button:Button = new Button(); var photographs_button:Button = new Button(); var paintings_button:Button = new Button(); var installations_button:Button = new Button(); var name_label:Label = new Label(); //2. put them on the stage stage.addChild(about_button); stage.addChild(story_button); stage.addChild(images_button); stage.addChild(photographs_button); stage.addChild(paintings_button); stage.addChild(installations_button); stage.addChild(name_label); //3. move them to the right position about_button.move(20,100); story_button.move(20,150); images_button.move(20,200); photographs_button.move(20,250) paintings_button.move(20,300) installations_button.move(20,350) name_label.move(70,20); //4. create labels for them about_button.label="About"; story_button.label="Story"; images_button.label="Images"; photographs_button.label="Photographs"; paintings_button.label="Paintings"; installations_button.label="Installations"; name_label.text="Minna Alaluusua"; //5. add event listeners to the buttons about_button.addEventListener(MouseEvent.CLICK, loadAbout); story_button.addEventListener(MouseEvent.CLICK, loadStory); images_button.addEventListener(MouseEvent.CLICK, loadImages); //photographs_button.addEventListener(MouseEvent.CLICK, loadPhotograps); paintings_button.addEventListener(MouseEvent.CLICK, loadPaintings); installations_button.addEventListener(MouseEvent.CLICK, loadInstallations); //6. create loader and URLRequests var myLoader:Loader = new Loader(); stage.addChild(myLoader); myLoader.x=(800-550)/2; myLoader.y=100; var about_url:URLRequest = new URLRequest("about.swf"); var story_url:URLRequest = new URLRequest("story.swf"); var images_url:URLRequest = new URLRequest("image.jpg"); var paintings_url:URLRequest = new URLRequest("paintings.swf"); var installations_url:URLRequest = new URLRequest("installations.swf"); myLoader.load(about_url); //7. create functions to load the elements function loadAbout(e:MouseEvent):void{ myLoader.load(about_url); } function loadStory(e:MouseEvent):void{ myLoader.load(story_url); } function loadImages(e:MouseEvent):void{ myLoader.load(images_url); } function loadPaintings(e:MouseEvent):void{ myLoader.load(paintings_url); } function loadInstallations(e:MouseEvent):void{ myLoader.load(installations_url); }