A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11336 Flash Movies | 2 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Surjit Dhami
» Title: Book
» Description: Book
» More by Surjit Dhami


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 5848 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: All-American Rejects
» Description: Get to know this great band by exploring their "practice room".


Random Links | Add your own Flash Related Links
Flash Tutorials 1277 Tutorials 7 New Tutorials Added!
What's New | Top100

» Create xml slideshow with free template
» How to Insert a Multilingual Subtitle Into Your Flash Video Studio
» How to Create Cool Halloween Slideshow
» Debugging flash using the Firebug console
» Create Flash Slideshow on Blogger
» FLASH TRICKS IN WEB ADVERTISING: FLASH BANNERS
» HTML Photo Gallery Tutorial
» Create your first flash site – PART 1
» How to Make a Flash Photo Gallery
» Unknown Tag: Title10
Random Tutorial | Add Site

Sr Instructional Designer D2L-Moodle,Clearance
WSI Nationwide, Inc.
US-NJ-Fort Monmouth

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Dynamic_Content

Categories XML-Based Searchable Database (part 3): list matches, preloader and more...
Author: Joachim Schnier | Website: http://www.cancerinform.net/ |

 
Page 7
«prev 1 2 3 4 5 6 7 8 9 10 11 next»

The Actionscript: part 4

Completing our search

We have now scripts, which will do the final job to complete our search. In this example we execute the function findSubgroup_1 (subGroup), which searches for blond or black models who speak a foreign language. After looping through the haircolor childnodes we ask by an if statement if count04>=0. This makes sure we include all nodes. Counting nodes in flash starts with 0, which we have to include as well. Then we ask if there are any nodes with the attribute "foreign", since these are the ones we are looking for disregarding others. Finally we want to make sure that there are no undefined nodes.

If there was success and there were nodes then we want to know the names and descriptions, which are held by the var modelName and modelDescription. Since our description of the model can be in a textfile or in the XML file itself as the first child of a node, we have to distinguish that by another if statement. Finally we want to show a list of the matches, which is done by the function for the listbox chooseModel(modelName,modelDescription);, which is explained below. We write actionscript such as this one for all the search categories. You can see another example following this one.

//now we have to access all the childnodes, here for those which contain the attribute name "foreign"
function findSubgroup_1 (subGroup) {
 for (var count04=0; count04 <= subGroup.childNodes.length; count04++) {
 myModel04 = subGroup.childNodes[count04];
 //"count04" will count all childnodes starting from 0.
 //only the nodes with a positive match will be listed.
 if(count04>=0 && myModel04.attributes.language == "foreign" && myModel04 != undefined){
 modelName = myModel04.attributes.name;//name attribute
 //the var modelDescription holds the nodeValue of the firstChild of each node
 modelDescription=myModel04.firstChild.nodeValue;
 //but when there is no nodeValue and therefore firstChild is undefined, then
 //this means we have an attribute "ID" and modelDescription will hold the
 //attribute ID, which is a text document.
 if (modelDescription == undefined){
 modelDescription=myModel04.attributes.ID;
 }//here we now execute the function for the listbox with the
 //two arguments "modelName", which holds the name of the models
 //and "modelDescription", which holds a nodeValue or the ID attribute.
 chooseModel(modelName,modelDescription);
 }
 }
}
//this is essentially the same as in the previous chapter, except we will list
//all childnodes of a particular parent node.
function findSubgroup_2 (subGroup) {
 for (var count04=0; count04 <= subGroup.childNodes.length; count04++) {
 myModel04 = subGroup.childNodes[count04];
 if(count04>=0 && myModel04 != undefined){
 modelName = myModel04.attributes.name;
 modelDescription=myModel04.firstChild.nodeValue;
 chooseModel(modelName,modelDescription);
 }
 }
}

«prev 1 2 3 4 5 6 7 8 9 10 11 next»

» Level Intermediate

Added: : 2002-09-17
Rating: 9.07 Votes: 69
Hits: 2038
» Author
The author is a basic scientist doing cancer research.
» Download
Download the files used in this tutorial.
Download (300 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments
 
   
 

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs