• home
  • forum
  • my
  • kt
  • download
  • Get Labels in Flash using JavaScript

    Author: 2007-06-14 11:20:22 From:

    How to get a list of frame labels in your movie using some simple JavaScript!


    Step1: Setup your movie with some functions and variables.

    Action on frame 1
    fscommand("getLabels",0);
    labelArray = null;
    labelOn = 0;
    readArray = 0;
    function checkLabels() {
     if (labelArray != null) {
     if (readArray != 1) {
     readArray = 1
     labelArray = labelArray.split(",");
     }
     }
    }
    function nextLabel() {
     if (labelOn <(labelArray.length - 1)) {
     labelOn = labelOn + 1
     label = labelArray[labelOn];
     //fscommand("msg",label);
     gotoAndStop(label);
     }
    }
    function prevLabel() {
     if (labelOn> 0) {
     labelOn = labelOn - 1
     label = labelArray[labelOn];
     //fscommand("msg",label);
     gotoAndStop(label);
     }
    }
    

    '

    Step2: Add some buttons on the stage for use with navigation.

    // Previous Buttons Action
    on (release) {
    _root.prevLabel();
    }
    // Next Buttons Action
    on (release) {
    _root.nextLabel();
    }
    

    Step3: Draw a circle on the stage, then convert it to a movieclip.

    MovieCip is to hold out onClipEvent() action, replace with what you have in your own movies.
    // This action goes on the basic movieclip
    onClipEvent (enterFrame) {
     _root.checkLabels();
    }
    

    Step4: Add some Labels and movement in movie.

    Space Labels out a little so you can see the jump in frames.
    Add another shape, convert it to a mc, and animate it doing something on stage.

    Step5: Export your movie out. For use with tutorial, name it "getLabels.swf"

    Drop it in the same folder with the RunMe.html supplied in the .zip file and you
    should see how it works!. Look the the RunMe.html file at the javaScript that talks to
    the Flash FSCommand.
    

    » Level Intermediate

    Added: : 2003-05-19
    Rating: 2.50 Votes: 2
    Hits: 1981
    » Author
    3D, Scripting, Lingo
    » Download
    Download the files used in this tutorial.
    Download (28 kb)

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (21)
      Web Design (22)

    New

    Hot