A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: AS3 Presentation Template - adding buttons for every slide

  1. #1
    Junior Member
    Join Date
    May 2013
    Posts
    1

    Exclamation AS3 Presentation Template - adding buttons for every slide

    I have a presentation made from the 'presentation template' in AS3. Currently, it has the nextframe and prevframe buttons on the main timeline Hierarchy = main timeline > movie clip > keyframes on frame 1, 2, 3, 4, with movie clips on each of those keyframes.

    They want a button for EVERY frame, so if they are at frame 40, they can easily click one button to get to frame 2. How do I do this? I've tried to add buttons, but they're not working correctly. I don't know what layer to put them on, etc. I've tried frame labels.. everything. Please help!

    Main timeline:
    Screen Shot 2013-05-14 at 9.59.12 AM.png

    Slides nested within layer "Slides MovieClip" (instance name= slides_mc):
    Screen Shot 2013-05-14 at 9.59.24 AM.png

    A sample of what's in one of the keyframes in the layer "Slides" - this is a movie with instance name slide1871
    Screen Shot 2013-05-14 at 9.59.38 AM.png

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518
    Make a movie clip and place it in the library, with a Linkage name of "Dot".

    On the main timeline, in the actions layer, add the following code.

    Code:
    var len = slides_mc.totalFrames;
    var offX = 20;
    
    for (var i = 0; i < len; i++){
            var dot = new Dot();
            dot.y = 550;
            dot.x = offX;
            offX = offX + dot.width + 4;
            dot.num = i + 1;
            dot.addEventListener(MouseEvent.CLICK, goDirect, false, 0, true);
            addChild(dot)
    }
    
    function goDirect(evt:MouseEvent){
            var num = evt.currentTarget.num;
            slides_mc.gotoAndStop(num);
                            if (transitionOn == true) {
                            fl_doTransition();
                    }
                    if (pageNumberOn == false) {
                            slideNumber_txt.text = "";
                    } else {
                            slideNumber_txt.text = String(slides_mc.currentFrame + "/" + slides_mc.totalFrames);
                    }
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center