Search tutorials
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 |
| » 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. |
| Download (96 kb) |
| » Forums |
| More help? Search our boards for quick answers! |
-
You must have javascript enabled in order to post comments.


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