Advertisement
Advertisement
| 04.08.2008 at 02:57PM PDT, ID: 23306433 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: |
//timer/////////////////////////////////////////////
var autoRotate = 0;
var imageTimer:Timer = new Timer(5000);
imageTimer.addEventListener(TimerEvent.TIMER, readImages);
function readImages(event:TimerEvent):void{
if(autoRotate == 0){
imageTimer.start();
trace("fired");
top.alpha = 100;
img_holder.removeChildAt(0);
if(increment < total-1){
increment += 1;
} else {
increment = 0;
}
ImageLoad(LINKS[increment],img_holder,0,0);
imageNUMB.text = increment+1 + " of " + total;
}
}
//////////////////////////////////////////////////
//loader//////////////////////////////////////////
import flash.display.*;
import flash.events.*;
import flash.net.URLRequest;
import flash.net.URLVariables;
import fl.transitions.Tween;
import fl.transitions.easing.*;
var numOfImages = 90;
var imgNum = 0;
function ImageLoad(u:String,target,Ypos,Xpos){
var targetClip = target;
var positionY = Ypos;
var positionX = Xpos;
var _loader:Loader = new Loader();
var request:URLRequest = new URLRequest(u);
_loader.load(request);
targetClip.addChild(_loader);
//targetClip.y = positionY;
//targetClip.x = positionX;
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadProgress);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
}
function loadProgress(event:ProgressEvent):void {
var percentLoaded:Number = event.bytesLoaded/event.bytesTotal;
percentLoaded = Math.round(percentLoaded * 100);
if(percentLoaded > 20){
trace("firing");
preLoader.alpha = 100;
} else{
preLoader.alpha = 0;
}
}
function completeHandler(event):void {
trace("DONE");
preLoader.alpha = 0;
var myTween:Tween = new Tween(top, "alpha", Strong.easeOut, 1, 0, 1, true);
imageTimer.start();
}
////////////////////////////////////////////////////
//xml load//////////////////////////////////////////
var loader:URLLoader;
loader = new URLLoader();
var increment = 0;
var total = 0;
var i = 0;
var TITLES = [];
var COPYS = [];
var LINKS = [];
//ADD EVENT LISTENER, THIS LISTENS FOR WHEN XML IS LOADED
loader.addEventListener(Event.COMPLETE, xmlLoaded);
//DEFINES XML FILE THAT IS LOADED
var request:URLRequest = new URLRequest("com_daybreakgarbett.xml");
loader.load(request);
//FUNCTON CALLED ONE XML IS LOADED
function xmlLoaded(event:Event):void {
//DEFINE MY XML VARIABLE
var myXML:XML = new XML(loader.data);
total = myXML.children().length();
trace(total);
imageNUMB.text = "1 of " + total;
ImageLoad(myXML.children().LINK[0],img_holder,0,0);
for (i=0; i<total; i++) {
LINKS[i] = myXML.children().LINK.children()[i];
}
}
////////////////////////////////////////////////////
//gallery//////////////////////////////////////////
btn1.addEventListener(MouseEvent.MOUSE_DOWN, showimg1);
function showimg1(event:MouseEvent):void {
top.alpha = 100;
img_holder.removeChildAt(0);
ImageLoad(LINKS[0],img_holder,0,0);
imageNUMB.text = 1 + " of " + total;
}
btn2.addEventListener(MouseEvent.MOUSE_DOWN, showimg2);
function showimg2(event:MouseEvent):void {
top.alpha = 100;
img_holder.removeChildAt(0);
ImageLoad(LINKS[1],img_holder,0,0);
imageNUMB.text = 2 + " of " + total;
}
btn3.addEventListener(MouseEvent.MOUSE_DOWN, showimg3);
function showimg3(event:MouseEvent):void {
top.alpha = 100;
img_holder.removeChildAt(0);
ImageLoad(LINKS[2],img_holder,0,0);
imageNUMB.text = 3 + " of " + total;
}
btn4.addEventListener(MouseEvent.MOUSE_DOWN, showimg4);
function showimg4(event:MouseEvent):void {
top.alpha = 100;
img_holder.removeChildAt(0);
ImageLoad(LINKS[3],img_holder,0,0);
imageNUMB.text = 4 + " of " + total;
}
|