Jump to content


Search System In Flash


  • You cannot reply to this topic
6 replies to this topic

#1 Amrik

    Young Padawan

  • Members
  • Pip
  • 43 posts

Posted 28 February 2007 - 09:04 AM

Guys This is What I am trying to do
I want to make a Search System In Flash Like:
It Will Consist of 3 Keyframes

The First Keyframe I want it to have only this much
One Input Text Box Where You Will Type In The Member Number
One Search Button. After Typin in the member number (ex :- 0102), you press the Search Button AND (here is the part that is hard for me) It will search from a Text file outside the flash and then pop up the Information.
(a text file that will consist of something like this Member Number and The Points they have...This is all i want)

The Second Keyframe will show the information that you searched. I want it to Show Something Like This
Member No. : 0102
Points : 9 (and next to this point, i want two buttons: One is that when you press will increase one Point (9 --> 10) and the other to minus one point ( 9 ---> 8)
And the last button on this page i want is the "Back" button that when pressed will take you to Frame 1. (This button i can do, on(release){
gotoAndPlay(1);
}

The Third Keyframe Is If There is No Information About The Member No. You Searched A Static Text Stating "Invalid Member No. / Member Does not Exist") and a "Back" Button Taking You Back To Frame One Again


Is This All Possible?

Edited by Amrik, 28 February 2007 - 09:06 AM.


#2 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 01 March 2007 - 03:22 AM

This is all infact possible. I'm assuming you are getting the members names and such from a mySQL database? If so, how are you echoing them?

#3 Amrik

    Young Padawan

  • Members
  • Pip
  • 43 posts

Posted 01 March 2007 - 04:13 AM

Guys I Have Made Changes To The Plan Of The Search System I want to make which will probably be more easier
It goes like this... About the member no. I have around 80+ members and I am ready to make an XML or .TXT file for each
I want it to be this way. I want to make an input text box in which i will type in the Member no. (example :- 001) and when i press search it will search for the XML or .TXT file named 001 and show the information
Name :- SoRn
Member No. :- 001
Points :- 9
and i want 2 buttons
1. Open File ... i want this button to perform the action of opening the file you know when you double click to open a file? i want this button to do that action i want it to open the XML or .TXT file so that i can make changes to the information in it. (hope you guys understand :artist: )
2. Back ... Simply takes you back to the page where you came from

I hope now it is alot more easier for you guys...i can think of a way to search for the information but i cant think of the code to Open up the file :D
Thanks,
Anusorn

Edited by Amrik, 01 March 2007 - 04:29 AM.


#4 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 02 March 2007 - 12:36 AM

Well to do it with XML, then it's a lot easier than text files since with text files you need to do a lot of splitting and array shit, which isn't really worth it. With XML, you'd make it like:
<?xml version="1.0"?>
<members>
<user name="Member" points="0" num="1" />
<user name="Member" points="0" num="2" />
<user name="Member" points="0" num="3" />
<user name="Member" points="0" num="4" />
<user name="Member" points="0" num="5" />
</members>
With flash, you'd load your XML in:
var myXML:XML = new XML(); // Create new XML object
myXML.ignoreWhite = true; // Ignore the whitespace to prevent errors
myXML.onLoad = function(success:Boolean) {
		if(success) {
				// trace("XML has loaded");
		} else {
				// trace("XML has failed to load");
		}
}
myXML.load("xmlfile.xml");
Then you'd make an input text field, and call it's instance like "searchTxt", and make a submit button next to it, and call it "submitBtn". Then inside the if(success) statement, you'd put something like:
for(var i:Number = 0; i < myXML.firstChild.childNodes.length; i++) {
		submitBtn.num = i;
		submitBtn.onRelease = function() {
				if(searchTxt.text == myXML.firstChild.childNodes[this.num].attributes["num"]) {
						// trace(myXML.firstChild.childNodes[this.num].attributes["name"]+"\nPoints: "+myXML.firstChild.childNodes[this.num].attributes["points"]);
				}
		}
}

Edited by Ben, 02 March 2007 - 08:22 PM.


#5 Amrik

    Young Padawan

  • Members
  • Pip
  • 43 posts

Posted 02 March 2007 - 07:15 AM

Ben, Thank you for helping me
But for this code
for(var i:Number = 0; i < myXML.firstChild.childNodes.length; i++) {
		submitBtn.num = i;
		submitBtn.onRelease = function() {
				if(searchTxt.text == myXML.firstChild.childNodes[this.num].attributes["num"]) {
						// trace(myXML.firstChild.childNodes[this.num].attributes["name"]+"\nPoints: "+myXML.firstChild.childNodes[this.num].attributes["points"]);
		}
}

Where do i put it? you said if(success) you the if success one above?

#6 Pax

    P2L Jedi

  • Members
  • PipPipPip
  • 911 posts
  • Gender:Male
  • Location:Windsor, ON, Canada

Posted 02 March 2007 - 08:44 AM

var myXML:XML = new XML(); // Create new XML object
myXML.ignoreWhite = true; // Ignore the whitespace to prevent errors
myXML.onLoad = function(success:Boolean) {
		if(success) {
				// trace("XML has loaded");
		} else {
				// trace("XML has failed to load");
		}
}
myXML.load("xmlfile.xml");

inside that if(success) statement...where it says :

//trace("XML has loaded")";

dont remove any of the {'s or }'s and leave the else part of it in there too.

#7 Ben

    P2L Jedi Master

  • Publishing Betazoids
  • PipPipPipPip
  • 1,366 posts
  • Gender:Male
  • Location:VIC, Australia

Posted 02 March 2007 - 08:21 PM

Basically like this:
var myXML:XML = new XML(); // Create new XML object
myXML.ignoreWhite = true; // Ignore the whitespace to prevent errors
myXML.onLoad = function(success:Boolean) {
		if(success) {
				// trace("XML has loaded");
				for(var i:Number = 0; i < myXML.firstChild.childNodes.length; i++) {
						submitBtn.num = i;
						submitBtn.onRelease = function() {
								if(searchTxt.text == myXML.firstChild.childNodes[this.num].attributes["num"]) {
										// trace(myXML.firstChild.childNodes[this.num].attributes["name"]+"\nPoints: "+myXML.firstChild.childNodes[this.num].attributes["points"]);
								}
						}
				}
		} else {
				// trace("XML has failed to load");
		}
}
myXML.load("xmlfile.xml");






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users