First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing! | Flash Jobs
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...

SAMPLE:
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!

Comments

  • 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: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.