-
[RESOLVED] AS3 Slide-show Not Progressing
So the situation is this... I have a slide-show on one frame. There is a movieclip that loads the pictures, a back and a next button, and a movie clip that has a text field in it.
The code looks like this...
Actionscript Code:
stop(); cexitbt.addEventListener(MouseEvent.MOUSE_DOWN,gotoCMainframe); //button that exits the screen
var counter:Number; //current picture number var totalphotos:Number; //total pictures var photoloader:MovieClip; //loader var photolocation:URLRequest; //directory var mytext:MovieClip;
this.counter =1; this.totalphotos =10; this.myLoader = new Loader(); this.photolocation = new URLRequest("images/image" + this.counter + ".jpg"); this.myLoader.load(this.photolocation); this.photoloader.addChild(this.myLoader); return;
forwardbt.addEventListener(MouseEvent.MOUSE_DOWN,nextpic); //next button function nextpic(event:MouseEvent):void { if(this.counter != this.totalphotos) { var loc1:*; var loc2:*=((loc1 = this).counter + 1); loc1.counter = loc2; } else { this.counter =1; } this.myLoader.load(new URLRequest("images/image" + this.counter + ".jpg")); this.photoloader.addChild(this.myLoader); this.mytext.gotoAndStop(this.counter); return; }
backbt.addEventListener(MouseEvent.MOUSE_DOWN,lastpic); //previous button function lastpic(event:MouseEvent):void { if(this.counter !=1) { var loc1:*; var loc2:*=((loc1 = this).counter - 1); loc1.counter = loc2; } else { this.counter = this.totalphotos; } this.myLoader.load(new URLRequest("images/image" + this.counter + ".jpg")); this.photoloader.addChild(this.myLoader); this.mytext.gotoAndStop(this.counter); return;
}
The first pic loads up fine, but then the buttons don't DO anything. Neither the text field or the slide-show will progress any further. I typed the code by hand (had to decompile an old .swf of mine from a flash class long ago that I had lost the .fla to, and you know how those free decompilers don't let you just grab the script ) so there may be a typo I'm missing, but I can't find anything. Any help at all would be appreciated.
Last edited by Rajada; 03-10-2010 at 02:41 AM.
-
Resolved, I didn't put the 'this' before the listeners for the buttons.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|