A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11303 Flash Movies | 7 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: Nitin Tikhe
» Title: Cart
» Description: This Animation Tut is a fun and useful for kids below 15 years. Watch the Flag, Doors, Stick and Horse movements.
» More by Nitin Tikhe


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

Featured Site

» Posted in the Flash Kit Links section
» Title: Banana Swimwear
» Description: This is a banana swim wear interactive catalog we designed and animated in Flash


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

» Make flash video player for broadcasting live streaming video / TV on website
» How to convert the project file of Flash Demo Builder 2.0 into FLV file
» FLV to PSP for Mac - How to convert YouTube video to PSP on mac
» How to Convert FLV to MP4 for Playback on iPod
» how to download and convert youtube video to AVI with Leawo Free FLV converter
» Flash Multi-player Game Tutorial - TicTacToe
» How to make Flash elearning tutorials with screen recorder?
» Fader API:Slideshow with MovieClips on stage
» How to convert MS PPT file into an FLV File
» Unknown Tag: Title10
Random Tutorial | Add Site

Network Design Manager
The Computer Merchant, Ltd
US-VA-Hampton

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.06 Votes: 68
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