Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function initXML() {
- var _URL:URLRequest = new URLRequest("../xml/portfolio.xml");
- infoXML.load(_URL);
- infoXML.dataFormat = URLLoaderDataFormat.TEXT;
- infoXML.addEventListener(Event.COMPLETE, xmlLoaded);
- }//end function
- public function xmlLoaded(evt:Event):void{
- ImageXml = new Array();
- _XML = new XML(evt.target.data);
- var lista:XMLList = _XML.file;
- total = lista.length() -1;
- for(var i:Number = 0; i < lista.length();i++){
- var obj: Object = new Object();
- obj = lista[i].@path;
- ImageXml.push(obj);
- }//end for
- addImage();
- }// end function
- public function addImage():void {
- imgAtual = ImageXml[nextImage];
- image = new MovieClip;
- with(image){
- x = posX;
- useHandCursor = true;
- mouseChildren = false;
- buttonMode = true;
- }
- loadImage = new Loader();
- loadImage.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
- loadImage.load(new URLRequest(ImageXml[nextImage]));
- addChild(image);
- recebeImg.addChild(image);
- //TERIA QUE EXISTIR UM FOR, ALGO QUE FICASSE PEGANDO A IMAGEM ATUAL AO RECEBER O CLIQUE.
- //this.addEventListener(MouseEvent.CLICK, clicaImage, false, 0 , false);
- //var clicaImage:Function = function(evt:MouseEvent){atual(imgAtual)};
- }
- public function onComplete(evt:Event):void {
- image.addChild(loadImage);
- proxImage();
- }//end function
- public function proxImage() {
- if(nextImage >= total){
- nextImage = 0;
- posX = 0;
- }//end if
- else{
- nextImage += 1;
- posX += 500;
- addImage();
- }//end else
- }//end function
Add Comment
Please, Sign In to add comment