A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: User input : tell target

  1. #1
    Junior Member
    Join Date
    Apr 2001
    Posts
    27
    I have a text feild with variable name "userinput".When the user types in a keyword there,I want a movie clip to play.I got this right so far.
    But i have 100 such movie clips,how can i make a different mc play when the user types in different names.

    if else if action is not yielding the reqd result.

    I hope to make this an alternative to regular search options found on websites where yo ureference an enternal cfm or jsp file.

    Any ideas how this can be achieved...some sample code would really help.
    Tks.

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    on (release) {
    loadMovieNum ("movie"+Number(_root.userinput)+".swf", 1);
    }

    assuming "userinput" is directly on _root.

    If you name all your 100 movies as movie1.swf, movie2.swf, movie3.swf etc.. all the user has to do is enter a number in the userinput textfield and click on the submit button which bears the above code.
    gparis

  3. #3
    Senior Member RazoRmedia's Avatar
    Join Date
    Oct 2000
    Location
    UK
    Posts
    3,016
    Code:
    on (release) { 
    loadMovieNum (_root.userinput+".swf", 1); 
    }

  4. #4
    Senior Member
    Join Date
    Mar 2001
    Posts
    384
    Are you looking for multiple keywords for each movie?
    ...like a search field on a website?

  5. #5
    Junior Member
    Join Date
    Apr 2001
    Posts
    27
    Hi,

    I have 100 different movie clips in the same .swf...they are not different swfs...so i guess load movie cannot be used.

    Peter :Multiple keywords would be my next step...i wanted to get the first step working first...but yes...i want it to work like a search option in a website works.

    any possiblities ?
    Tks again.


  6. #6
    Senior Member
    Join Date
    Mar 2001
    Posts
    384
    ok... that's what I figured... here's what I'd do- have all of your 100's of movie clips inside one clip on your main stage. let's call it container:

    on your submit button:
    on (release){
    _root.novaluesreturned=true
    timeoutclip.play();
    for (name in container){
    if (name==_root.userinput){
    container[name].play();//or do whatever
    _root.novaluesreturned=false;
    break;
    }
    }
    }

    the timeoutclip should be an empty (or "searching...") clip that lasts ~10 seconds. at the end of the clip say "no matches found" or something like that. you'll need to play with the timing and format on this one.

    if you want to do multiple keywords for each you can make another movieclip an call it 'arrays' keep this clip full of arrays only, no other objects. name each array for the movie clip its keywords match.

    then, your for loop will look more like:

    for (name in arrays){
    for(i=0;i<=arrays[name].length;i++){
    if(arrays[name][i]==_root.userinput){
    _root.container[name].play();//or do whatever
    _root.novaluesreturned=false;
    break;
    }
    }
    }

    just a couple of ideas, they'll definitely need tuning.




  7. #7

    Cow Icon user input action script

    I am trying to develop a way where by a users input can determine the number of fields in a form e.g. the inputs the number 3 then the form would have 3 fields

    can you show me or point me in the direction of an example i can look at and manipulate?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center