O.K, being a little new to this, I have hit a brick wall, I'm using AS3 in Flash CS5. All I want to do is have a tweened animation which stops at a frame and which has a clickable button to access another part of the maintime line. Also there 开发者_如何转开发will be a button on the animation to skip it. How does one set this up? Obviously you need a stop(); at the stop frame of the time line and an event listener and function for both buttons right? Any more help besides that. I have it set up like this;
totalSlides:Number = 60;
currentSlideNumber:Number = 1;
skipbutton.addEventListener(MouseEvent.CLICK,skipbuttonPress);
function skipbuttonPress(evt:MouseEvent):void{
currentframelabel = currentframelabel+1;
if(currentSlideNumber>=0){
currentframelabel = introstop;
}
framelabel.gotoAndStop(introstop);
}
and the frame it stops on is set up as follows
stop();
totalSlides:Number = 60;
currentSlideNumber:Number = 5;
click01.addEventListener(MouseEvent.CLICK,click01Press);
function click01Press( evt : MouseEvent ) : void {
currentSlideNumber = currentSlideNumber+1;
if (currentSlideNumber >= 0) {
currentSlideNumber = 25;
}
framelabel.gotoAndStop(mainpage);
}
As I need this for a project, any help would be greatly valued.
Many Thanks
- Framelabels are Strings, so it should be "introstop" and so forth.
- currentFrameLabel returns the actual name of the current frame's frame label, not the current frame number. So you can't do
currentFrameLabel+1
. - If you just want to skip a frame, do
gotoAndPlay (currentFrame+1);
, but is usually better not to use frame numbers, but labels. That way you can add or remove frames in between labels without having to reprogram everything. I assume you know how to set those. ;) - frameLabels really don't go anywhere, the MovieClip does. ;) Use
this.gotoAndStop("introstop");
or simplygotoAndStop("introstop");
Now for the set up. In the frame where your skip button appears, do this:
skipbutton.addEventListener(MouseEvent.CLICK,skipbuttonPress);
function skipbuttonPress(evt:MouseEvent):void{
gotoAndStop("introstop");
}
(unless you have any other use for the slideNumber count - you don't need it for skipping)
The frame with the stop();
at the end of the animation must have the label "introstop".
On that same "introstop" frame, you need your click01 button on the stage. Then do this:
stop();
click01.addEventListener(MouseEvent.CLICK,click01Press);
function click01Press( evt : MouseEvent ) : void {
gotoAndStop("mainpage");
}
Where "mainpage" must be the label on the frame you want to jump to after the intro.
精彩评论