0 Replies Latest reply on Aug 19, 2010 9:58 AM by leardas

    Flash Search Bar


      Hello, I am trying to create a search bar within flash which will generate links to frames within my flash project based off of given text. I have found a flash project online which does almost exactly what I need, but it only allows for searching a single word rarther than a full term or sentence. It also gives no error message when no word match is found. I am not very good at actionscript or I would be able to midify myself. Any help would be very helpful. Here is the code given:





      var testText0:String = "this is some test text one";

      var testText1:String = "this is some test text two";

      var testText2:String = "this is some test text three";

      var testText3:String = "this is some test text four";


      var textArr = new Array();

      textArr[0] = _level0.testText0;

      textArr[1] = _level0.testText1;

      textArr[2] = _level0.testText2;

      textArr[3] = _level0.testText3;


      function goPage(page){




      var keyword = new Array();

      _root.search.onRelease = function(){

      _root.linkText = "";


      for(j = 0; j < textArr.length; j++){

      _level0["count"+j] = 0;

      var p:Number = j+1;

      keyword = textArr[j].split(" ");

      for(i = 0; i < keyword.length; i++){

      if(keyword[i].charAt(keyword[i].length-1) == ","){

      l = keyword[i].lastIndexOf(",")-1;

      wordmatch = keyword[i].substring(0,(l+1));

      }else if(keyword[i].charAt(keyword[i].length-1) == "."){

      l = keyword[i].lastIndexOf(".")-1;

      wordmatch = keyword[i].substring(0,(l+1));

      }else if(keyword[i].charAt(keyword[i].length-1) == "?"){

      l = keyword[i].lastIndexOf("?")-1;

      wordmatch = keyword[i].substring(0,(l+1));


      wordmatch = keyword[i];


      if(_root.searchTxt.toLowerCase() == wordmatch.toLowerCase()){


      if(_level0["count"+j] <= 1){

      _root.linkText += ("<a href=\"asfunction:goPage,"+p+"\">page "+p+" contains the word <font color=\"#FF0000\"><B><I>"+wordmatch+"</I></B></font></a><br />");







      The original .fla file can be dowloaded here:

      http://www.flashkit.com/movies/Scripting/flash_si-Andrew_B-10884/index .php