import flash.display.Loader;
import flash.net.URLRequest;
import flash.events.MouseEvent;
import flash.display.DisplayObject;
for (var i=0; i<20; i++) {
// create a new loader object
var reneeLoader:Loader = new Loader();
// relative path to the image
var theURL:String = "giraffes/giraffe" + (i+1);
//var theLargeURL:URLRequest = new URLRequest (theURL + ".jpg")
var theThumbURL:URLRequest = new URLRequest(theURL + "_thumb.jpg")
reneeLoader.load(theThumbURL);
reneeLoader.name = "giraffes/giraffe" + (i+1);
if (i<=4){
reneeLoader.x = 10 + (i * 110);
reneeLoader.y = 20;
trace("Row One" + i)
} else if (i>4 && i<10){
var a:Number = i-5;
reneeLoader.x = 10 + (a * 110);
reneeLoader.y = 115;
trace("Next row" + i)
} else if (i>9 && i<15){
var b:Number = i-10;
reneeLoader.x = 10 + (b * 110);
reneeLoader.y = 215;
trace("Hello" + i)
} else {
var c:Number = i-15;
reneeLoader.x = 10 + (c * 110);
reneeLoader.y = 315;
trace("last ones" + i)
}
// adds the image to the stage
addChild(reneeLoader);
reneeLoader.addEventListener(MouseEvent.MOUSE_OVER, overImage);
function overImage(event:MouseEvent):void {
event.target.alpha = .8;
trace("fades")}
reneeLoader.addEventListener(MouseEvent.MOUSE_OUT, myMouseOut);
function myMouseOut(event:MouseEvent):void{
event.target.alpha = 1;
trace("please work")}
reneeLoader.addEventListener(MouseEvent.CLICK, clickyClicker);
function clickyClicker(event:MouseEvent):void{
trace("poooo")
var largeLoader:Loader = new Loader();
var giraffeRequest:URLRequest = new URLRequest((event.target.name) + ".jpg");
largeLoader.load(giraffeRequest);
largeLoader.x =30;
largeLoader.y = 20;
addChild(largeLoader);
// ****ISAIAH HELP HERE*****
var nameLoader:Loader = new Loader();
var fart2
nameLoader.load(fart2);
nameLoader.x=30;
nameLoader.y=50;
addChild(nameLoader);
//imageName_txt.text ="Bite me!"
/*largeLoader.createTextField("imageName_txt", 1, 10, 10, 150, 30);
imageName_txt.text = "Here's some text";*/
//imageName_txt.text = "jongggg";
/*var imageName:String = largeLoader.toString();
var pictName:String = imageName;
var pictName:URLRequest = new URLRequest(g + "_thumb.jpg")
//var pictURLReq:URLRequest = new URLRequest (imageName);
//largeLoader.load(pictURLReq);
trace (pictName);*/
// ****END OF HELP SECTION****
largeLoader.addEventListener(MouseEvent.CLICK, offClicker);
function offClicker(event:MouseEvent):void{
trace("off");
removeChild(largeLoader);
}
}
}
No comments:
Post a Comment