First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
Search tutorials
Author: Flash Junkie | Website: http://www.flashkit.com

Frame 2 VI

'm' counts from the leftmost character in the link text all the way to the right... MINUS the length of the search string...

text='Microsoft's Online Web Site'
user input='online'
Searches from 'M' through to the 'b' on the word 'Web'.

After that point, there's no way the search string could match so we save ourselves precious calculations by stopping searching that link text at that point.

Set Variable: "m" = 0&
Loop While (m<=(Length(text)-Length(findit)))
    Set Variable: "m" = m+1
    If (Substring (text,m,Length(findit)) eq findit)
However, as soon as we have a match we stop checking that link. (In the case of the above sample, that would happen after only 13 comparisons...) Since we have a match, we can now add this link to the new list. (We cleared the list to prepare for the new list already... that happens in the next frame, where we check for user input... so we can now start duplicating new buttons again... exactly the same code as the previous frame...)
Set Variable: "p" = p+1
Set Variable: "dup" = "button"&p
Duplicate Movie Clip ("button", dup, p)
Set Property (dup, Y Position) = p*/:button_spacing
Set Property (dup, X Position) = /:indent
Set Variable: dup&":linkname" = Eval("/:text"&n)
Set Variable: dup&":link" = Eval("/:link"&n)
Set Property (dup&"/over", Visibility) = false
End If
Once all the loop checking is done, we update the amount of found links. Since the variable 'p' was ONLY increased if we foud a match, 'p' is the amount of links found in the list matching the user's input.
    Set Variable: "../../../:active_links" = p&" link(s) in list."
    Set Variable: "/:active_links" = p
    If (p    
» Level Advanced

Added: 2000-05-01
Rating: 9 Votes: 113
(10 being the highest)
» Author
Flashjunkie is a self-professed obsessive addict of life. Due to the highly artistic nature required of an Art Director for an Ad agency, he took up Flash to add some math to his diet
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.