A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: named anchors

  1. #1
    i know it was impossible with flash 5, without using javascript and the "TCurrentLabel" object, but i was hoping with the new named anchors in MX that this is possible.

    i want a flash movie that with a button inside of it that will move the main timeline forward or backward by one frame label (not frame number!). say i had a bunch of frames labeled "a,b,c,d,etc..." that are each 10 to 20 frames away from each other. and i wanted to be able to hit a next and back button inside of flash to navigate between them. how would i do this in MX? looking for something simple like:

    <b>currentLabel = _root.getNamedAnchor;<br>
    if (currentLabel.substring(5,6)=="A"){<br>

  2. #2
    Join Date
    Feb 2000
    In the Present Moment
    Are you saying that you were using javascript from a button within a movie to control that movie? yikes, not necessary

    a simple button:

    on (release){

    Next and Back functionality:

    This code on frame 1 - label "Aframe"

    stop(); // stops the timeline =p j/k
    myFrameList = ["Aframe", "Bframe", "Cframe", "Dframe", "Eframe"]; // make a list of possible frames
    function moveNext () {
    	      index++; // increase the index
    	      if (index>myFrameList.length-1) { // if I move past the last item
    		               // index=myFrameList.length-1; // Option 1: set to last frame in list, if not a cyclic list
    		               index = 0;	// Option 2: set to first frame in list, if cyclic
    function moveBack () {
    	       index--; // decrease the index
    	       if (index<0) {	// if I move back beyond the first item in list
    	      	          // index=0; // Option 1: set to first frame in list, if not cyclic
    		                index = myFrameList.length-1; // Option 2: set to last frame in list, if cyclic
    Then your next button should have this code:

    on (release){

    and your back button:

    on (release){

    Please note the two options in the functions. If you switch which ones are active you can either have the list dead end at both ends(non cyclic), dead end at one end (list wraps from one direction or the other), or doesn't end (list wraps from both directions).

    Named anchors are used by the browser Back and Forward buttons. It seems that the name anchors don't work as intended. Let's say I have 5 frames in a row that are named anchors. I click on a link in frame 1 that takes me to frame 5. You would think that hitting the back button on your browser would take you back to frame 1, but guess what, it don't (sic). It takes you back to frame 4, then 3, then 2, then 1. Somehow your whole anchor list gets put in the browser history.

    Anyhow, good luck with your project!

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