开发者

Navigating the timeline

开发者 https://www.devze.com 2023-02-03 21:33 出处:网络
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 an

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


  1. Framelabels are Strings, so it should be "introstop" and so forth.
  2. currentFrameLabel returns the actual name of the current frame's frame label, not the current frame number. So you can't do currentFrameLabel+1.
  3. 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. ;)
  4. frameLabels really don't go anywhere, the MovieClip does. ;) Use this.gotoAndStop("introstop"); or simply gotoAndStop("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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号