PDA

View Full Version : SEARCH IN FLASH



livestyle
May 30th, 2005, 07:12 PM
Hi all,
I'd like to know, if it's possible to load by the button "search" an external swf.
For example: I' ve got 100 swf files which have names like 01.swf, 02.swf etc.
I want to find and load 46.swf., I will write number 46 to the textbox and I will
tell the button "search" to load this file. Is that possible?

fasterthanlight™
May 30th, 2005, 07:22 PM
on(release){
my_emptyMovieClip.load(searchField_txt+".swf");
}



Oh and cross posting is punishable by death.

livestyle
May 30th, 2005, 07:31 PM
I tried it, but it is not working to me.
Please, can you make some sample for me?
Thanks very much.

livestyle
May 30th, 2005, 08:10 PM
I have found mistake in your code. There was missing "loadMovie".
It's is workink now. Thank you very, very much!
I'd like to know, how to make this message (SEARCH RESULTS: "this name" not found) show up, when the wrong name of swf file is written.

fasterthanlight™
May 30th, 2005, 08:16 PM
well, you could either use loadMovie, or use the load class which is what i used.... of course, for my code to have worked you would have had to create an empty movieclip and place it on the stage where you want it... you could also do that with AS.

_root.createEmptyMovieClip("empty_mc", _root.getNextHighestDepth);
empty_mc._x = 10;
empty_mc._y = 10;
empty_mc.load(searchField_txt+".swf");

but whatever...

livestyle
May 30th, 2005, 08:27 PM
Yes, but it's not answer to my last question, is it?

livestyle
May 31st, 2005, 10:57 AM
I was waiting for the answer, but I didn't get any. I am trying it again then.
So I have got 100 swf files. I will put for example number 10 to the textfield and let to search. The mc with number 10 is loaded. That is alright. But if I put to the textfield for example number 245 - mc should be loaded with the error message "NOT FOUND", because it has to be a number not bigger than 100. Is possible to do it somehow?
Another question is, if the searched mc's are in different directories, how to add it to the code, which is mentioned above? Thanks for any help to everyone.

scotty
May 31st, 2005, 12:23 PM
var search;
search_btn.onRelease = function() {
search = input_txt.text;
searchAndFind(search);
};
function searchAndFind(item) {
if (item>0 && item<101) {
var checkItem = i+".swf";
holder.loadMovie(checkItem);
} else {
//your 'wrong' text here
}
}


scotty(-:

livestyle
May 31st, 2005, 12:45 PM
Somehow it doesn't work to me. Instead of loading mc, "undefined.swf" shows up.

scotty
May 31st, 2005, 12:57 PM
My bad

var checkItem =item+".swf";
will work

scotty(-:

livestyle
May 31st, 2005, 01:11 PM
Yes, now it's it working. That's great for me! Thank you very much!
Just one more little thing, would it be possible to change the numbers into the names?
For example SAMANTHA, NATALIA etc?
If not, at least into img001, img002 etc...

livestyle
May 31st, 2005, 02:57 PM
I have got one idea. Isn't it possible to load mc's with names by XML?

scotty
May 31st, 2005, 04:37 PM
Yep that's possible :)

scotty(-:

livestyle
May 31st, 2005, 05:01 PM
And don't you know, how to do it, please?

livestyle
June 2nd, 2005, 10:09 AM
Can somebody help me?