24 Replies Latest reply on May 20, 2007 1:27 PM by Greg Dove

    card test

    mkbanister
      Hi all,
      I have been trying this for weeks now with no avail. I am not an advanced coder by any means and dont even know the best way....so many options.

      I have 5 cards...each with a different symbol i.e. cross, circle, square, triangle, spiral. The user will pick from their favorite symbol....to their least favorite. Right now I have the 5 cards with numbers below them....and input text boxes where they put in the number. After they make their choices a form letter comes up with their choices in the sentances. Here is where it gets difficult.....what I would like is for them to just click the card and it will store the information (which place its in)...here is the real tricky part.......each card has a different answer depending on what place they clicked it in. i.e. If they hit the circle card first (the favorite) the answer that would fill in the blank of the form letter would say "Happy" if they hit the circle card last (least favorite) it would fill in the blank of the form letter wth "sad", I have racked my brain on this....I am only going to use the 1st, 3rd and 5th places for the calculations.

      I just dont know ....variables, arrays...if then statements????? EEEEEK

      var1=square

      if mouse click one = square...... then Happy
      if mouse click three = square ....then Sad
      if mouse click five = square ......then Angry

      answer fills in the area in the form letter

      The fla is a meg...if anyone would like to see it please let me know your email and I will send it.

      HELP PLEASE....before i put myself in a straight jacket lol.

      Thanks in advance for any help
      M

        • 1. Re: card test
          Greg Dove Level 4
          It seems like you have 2 things you want to do:

          1. Record the sequence of clicks on the various cards
          2. Generate some text based on the sequence.

          Both are easy enough. But just a little clarification first:
          A. Recording the sequence of clicks is easy enough. Its a little more complicated if you want people to be able to change the sequence if they change their mind. But If you want to be able to do that as well then I'd suggest some sort of drag and drop with the cards. You could have five positions representing the most preferred to least preferred as drop targets. Do you need that, or is simply clicking sufficient?

          For the text display (report of happy or sad etc), I assume its generated after all the selections have been made...? (i.e. there is no feedback until its all done?)
          • 2. Re: card test
            nick mc Level 1
            I'm not quite sure what you want do, but one thought that springs to mind is possibly putting 5 arrays within a top array to get the information arranged as you need it?

            e.g. myArray = [ ["Happy", "Sad", "Angry"], ["Sad,"Happy","Angry"],[etc],[etc],[etc] ]

            You have 5 arrays within 'myArray', each one representing the 5 shapes: cross, circle, square, triangle, spiral.

            So if cross is the 3rd clicked, you look up myArray[0][2] to get the 3rd option in the 1st entry in myArray.

            Or if the circle is the 1st one clicked, you lookup myArray[1][0] to get the 1st option in the 2nd item in myArray.

            (Always remembering that arrays start at position '0')


            • 3. Re: card test
              kglad Adobe Community Professional & MVP
              make each symbol a movieclip (if it not already one). create one array for each symbol that will encode the "answer":

              circle.A=["happy","less happy","ok","sad","angry"];
              square.A=[etc...];
              etc.

              you can use an onMouseDown handler and hitTest to check if one of the symbol movieclips have been clicked. if it is, check if it's already been clicked and if not add a property to it indicating its choice number:
              • 4. Re: card test
                Greg Dove Level 4
                Assuming you have the cards as movieclips, named circle, triangle, cross etc.

                Then by putting this code in a frame where they all exist, the array sequence will be populated with the sequence.

                • 5. Re: card test
                  mkbanister Level 1
                  I had the cards drag and drop in the beginning..I love that idea. I dont think I want the people to change the choices since this is supposed to be based upon their first thoughts. The answer will come after they select all the symbols. I made each card a movie clip at one time..lol I tried many things...the more research i did the more confused I got lol. After reading all the replies so far I understand kglads better....I will get that to work first...do you think adding the drag and drop after would be to much changing of code?

                  Thank you so much for the replies,
                  I will let you know how it goes
                  I hope all of you will try this test when its done....it is actually a compassion test.
                  M
                  • 6. Re: card test
                    mkbanister Level 1
                    yikes...as i was replying i got gwd's lol.....i guess I will play with them and see lol

                    Thanks so much all
                    • 7. Re: card test
                      Greg Dove Level 4
                      Here's a slight amendment to mine which incorporates a little of kglad's ideas and nick mc's as well. Approaches all slightly different.
                      • 8. Re: card test
                        mkbanister Level 1
                        I am wondering if I should have the card turn into the back after they click on it.....should I make these buttons instead of movies?
                        • 9. Re: card test
                          Greg Dove Level 4
                          You can do that with movieclips too. Just make frame 2 the 'back' frame. Have a stop();
                          action on frame one. Once they're clicked, tell them to gotoAndStop(2);
                          • 10. Re: card test
                            mkbanister Level 1
                            Hi again lol,

                            I used GWD's code but I am having trouble getting the results in my form letter. Also there will be five more sets of different symbols...but i figure once I get one set figured out I should be able to do the rest (i hope lol).

                            I have created another scene for the result form letter. Scene 2
                            I created a dynamic text area
                            Here is the form letter:
                            formletter = "Your personal ethic...\r\r Witnessing your experience inwardly, you describe yourself as " add 1st click add " while struggling with " add 2nd click add " Though this may be in your awareness, the solution is not. It seems that " add l3 add " is more important to you than willing to admit. It is in this powerful and balancing principle that attention is needed. Honor its development and resolution will come.\r\r As you deal with life obstacles or challenges, there is an inner force that is best described as spiritual. Informing your soul, it is the energy of your emotions. Outside the editing of the Ego, it offers a truth that may not exist in your conscious life. It seems when you become stuck or blocked by life events, you go back and forth between " add c1 add " and " add c5 add " In the end, you are more likely to" add c3 add " than anything else. If unable to see the whole of your life with compassion, this approach may keep you from growing spiritually. You report having the most experience with " add c3 add " and " add e1 add ", each playing a debilitating role on your capacity to " add s1 add " and " add s1 add ". The Soul desires that you remember that feelings offer feedback about the quality of your thoughts. Screen your feelings separate from your thinking and life will improve.\r\r There is wisdom in this knowledge today. It presents here as the organizing quality of a life that seemed random. If you understand synchronicity, then this reading is more than a meaningful coincidence. Personal growth is not just about getting answers. More often than not, it is about asking better questions. One cannot be their own mirror. Reflect. Reflect.\r\r Warmly,\r The Soul ";
                            stop();

                            how do I put specific click answers into this letter. I keep getting undefined. Also I realized something since I am doing this different now.....I will need the first click, second click and third click answers, becuase the instructions say in this order: choose your favorit, choose your least favorite, then the rest in order.

                            Here is a link to what I have so far....of course the answer button wouldnt show up until all the sets are clicked...but so that you can see the form letter I put it on there now. http://www.work4media.com/ernie/cards/41105_tarot/HTML/cards.html

                            Thanks so much for all the help so far.
                            • 11. card test
                              Greg Dove Level 4
                              if you just want the first, second and third clicks, then change the line:

                              return [sequence[0],sequence[2],sequence[4]]

                              to

                              return [sequence[0],sequence[1],sequence[2]]

                              in terms of putting the results in the string, you can just concatenate (add) your string together using
                              +

                              e.g.
                              var MyAnswers = allICareAbout();

                              you describe yourself as " +decode[myAnswers[0]][0]+ " while struggling with "+
                              decode[myAnswers[1]][1] +" ... etc

                              What I don't know so much about is whether all the variables remain defined in terms of switching to another scene... I don't use scenes so don't know. Others could perhaps advise if there's any problems here.
                              • 12. Re: card test
                                mkbanister Level 1
                                Hi again,
                                I have been trying everything I can think of to no avail using your code. I even created a new fla and used it. I am not even getting a trace in the output box. I put in easy code i.e.
                                var myScore = 100;
                                trace (myScore);
                                and it showed the 100 in the trace...so I know the trace is working

                                WAAAAAAAAAAAAAAAAAAA my head is spinnin.

                                Please Please someone help me lol
                                • 13. Re: card test
                                  mkbanister Level 1
                                  ooh sorry here is how I did the movie. on frame one I put the code in:
                                  var cards:Array = ["cross", "circle", "square", "triangle", "spiral"]
                                  var decoder = {}
                                  decoder.circle = ["Self-reliant","being independent","self-reliance"];
                                  decoder.cross = ["connected to others","relating to others","relationships, with yourself and others"]
                                  decoder.square = ["responsible and reliable","stability","accountability"]
                                  decoder.triangle = ["goal-oriented","re-inventing yourself","any view of the future"]
                                  decoder.spiral = ["going through a transition","constant change","change"]
                                  var sequence:Array = [];

                                  for (var cardindex in cards) {
                                  this[cards[cardindex]].onPress = function() {
                                  sequence.push(this._name);
                                  delete this.onPress;
                                  // show progress
                                  trace(sequence)
                                  if (sequence.length == 5) {
                                  trace("all done, need to process the form content")
                                  trace("all I care about is : "+allICareAbout())
                                  trace("and that makes you : "+describeMeBasedOn(allICareAbout()));

                                  }
                                  }

                                  }

                                  function allICareAbout() {
                                  return [sequence[0],sequence[1],sequence[3]]

                                  }

                                  function describeMeBasedOn(myPriorities:Array) {
                                  var retString = ""
                                  for (var a=0;a<myPriorities.length;a++) {

                                  retString += (decoder[myPriorities[a]][a]+",")
                                  }
                                  return retString;
                                  }
                                  stop();


                                  on frame two I put:
                                  stop();
                                  MyAnswers = "Your personal ethic. Witnessing your experience inwardly, you describe yourself as " +decode[myAnswers[0]][0]+ " while struggling with " +decode[myAnswers[1]][1] + " Though this may be in your awareness, the solution is not. It seems that " +decode[myAnswers[0]][0]+ " is more important to you than willing to admit. It is in this powerful and balancing principle that attention is needed. Honor its development and resolution will come.\r\r As you deal with life obstacles or challenges, there is an inner force that is best described as spiritual. Informing your soul, it is the energy of your emotions. Outside the editing of the Ego, it offers a truth that may not exist in your conscious life. It seems when you become stuck or blocked by life events, you go back and forth between " +decode[myAnswers[0]][0]+ " and " +decode[myAnswers[0]][0]+ " In the end, you are more likely to" +decode[myAnswers[0]][0]+ " than anything else. If unable to see the whole of your life with compassion, this approach may keep you from growing spiritually. You report having the most experience with " +decode[myAnswers[0]][0]+ " and " +decode[myAnswers[0]][0]+ ", each playing a debilitating role on your capacity to " +decode[myAnswers[0]][0]+ " and " +decode[myAnswers[0]][0]+ ". The Soul desires that you remember that feelings offer feedback about the quality of your thoughts. Screen your feelings separate from your thinking and life will improve.\r\r There is wisdom in this knowledge today. It presents here as the organizing quality of a life that seemed random. If you understand synchronicity, then this reading is more than a meaningful coincidence. Personal growth is not just about getting answers. More often than not, it is about asking better questions. One cannot be their own mirror. Reflect. Reflect.\r\r Warmly, \rThe Soul ";

                                  I tried many different strings on frame two but to no avail

                                  Sorry for being so dah in the brain here.
                                  • 14. Re: card test
                                    Greg Dove Level 4
                                    Couple of things. One was a typo on my part, sorry.

                                    decode should be decoder

                                    and make sure you have

                                    myAnswers = AllICareAbout();

                                    I haven't used scenes since flash 5 or thereabouts, so I'm not sure if there's a problem with variables and functions continuing to exist if you change to a different scene. Others may know.
                                    • 15. Re: card test
                                      mkbanister Level 1
                                      Hi thanks for the help so far. I am not using scene anymore. I now have one scene and on frame one is the variable code you gave me.

                                      On frame two is where I have the form part
                                      stop();
                                      myAnswers = AllICareAbout(); "Your personal ethic. Witnessing your experience inwardly, you describe yourself as " +decoder[myAnswers[0]][0]+ " while struggling with " +decoder[myAnswers[1]][1]+ "

                                      I also tried:
                                      stop();
                                      myAnswers = AllICareAbout();
                                      my Answers= "Your personal ethic. Witnessing your experience inwardly, you describe yourself as " +decoder[myAnswers[0]][0]+ " while struggling with " +decoder[myAnswers[1]][1]+ "

                                      they both show a blank page with no writing. What I had above showed the text but had undefined where the variables go.

                                      EEEEK, I am so lost here.

                                      If I could I would just attach the dang fla lol
                                      • 16. Re: card test
                                        Greg Dove Level 4
                                        Sorry, I messed up a little bit there, sorry.

                                        Check this out.
                                        • 17. Re: card test
                                          Greg Dove Level 4
                                          nb, that was using the 1st, 3rd and 5th card selected.

                                          if you want to change it to the 1st,2nd, 3rd then change the line
                                          return [sequence[0],sequence[2],sequence[4]]

                                          to:
                                          return [sequence[0],sequence[1],sequence[2]]
                                          • 18. Re: card test
                                            mkbanister Level 1
                                            Okie...made the changes and here is what I get.
                                            http://www.work4media.com/ernie/cards/41105_tarot/HTML/cards.html

                                            this code makes the card turn over to the back.after they click on it......card movie clip code is:
                                            stop();
                                            onRelease = function() {gotoAndStop(2);}

                                            This button is what they click after the five cards to go to the answer....Go button code is:
                                            on (release) {
                                            gotoAndPlay(2);
                                            }

                                            frame 1 code is:
                                            //code on frame 1
                                            var cards:Array = ["cross", "circle", "square", "triangle", "spiral"]
                                            var decoder = {}
                                            decoder.circle = ["Self-reliant","being independent","self-reliance"];
                                            decoder.cross = ["connected to others","relating to others","relationships, with yourself and others"]
                                            decoder.square = ["responsible and reliable","stability","accountability"]
                                            decoder.triangle = ["goal-oriented","re-inventing yourself","any view of the future"]
                                            decoder.spiral = ["going through a transition","constant change","change"]
                                            var sequence:Array = [];

                                            for (var cardindex in cards) {
                                            this[cards[cardindex]].onPress = function() {
                                            sequence.push(this._name);
                                            delete this.onPress;
                                            // show progress
                                            trace(sequence)
                                            if (sequence.length == 5) {
                                            //trace("all done, need to process the form content")
                                            //trace("all I care about is : "+allICareAbout())
                                            gotoAndStop(2);
                                            }
                                            }

                                            }

                                            function allICareAbout() {
                                            return [sequence[0],sequence[2],sequence[4]]

                                            }
                                            stop();


                                            After they click the five cards they hit the go button which returns the form letter on frame two.......frame two code is this:
                                            myAnswers = AllICareAbout();
                                            output.text = "Your personal ethic. Witnessing your experience inwardly, you describe yourself as " +decoder[myAnswers[0]][0]+ " while struggling with " +decoder[myAnswers[1]][1]+ " Though this may be in your awareness, the solution is not. It seems that " +decoder[myAnswers[2]][2]+ " is more important to you than willing to admit. It is in this powerful and balancing principle that attention is needed. Honor its development and resolution will come.\r\r As you deal with life obstacles or challenges, there is an inner force that is best described as spiritual. Informing your soul, it is the energy of your emotions. Outside the editing of the Ego, it offers a truth that may not exist in your conscious life. It seems when you become stuck or blocked by life events, you go back and forth between " +decoder[myAnswers[3]][3]+ " and " +decoder[myAnswers[4]][4] +" In the end, you are more likely to" +decode[myAnswers[5]][5] +" than anything else. If unable to see the whole of your life with compassion, this approach may keep you from growing spiritually. You report having the most experience with " +decoder[myAnswers[0]][0]+ " and " +decoder[myAnswers[0]][0]+ ", each playing a debilitating role on your capacity to " +decoder[myAnswers[0]][0]+ " and " +decoder[myAnswers[0]][0]+ ". The Soul desires that you remember that feelings offer feedback about the quality of your thoughts. Screen your feelings separate from your thinking and life will improve.\r\r There is wisdom in this knowledge today. It presents here as the organizing quality of a life that seemed random. If you understand synchronicity, then this reading is more than a meaningful coincidence. Personal growth is not just about getting answers. More often than not, it is about asking better questions. One cannot be their own mirror. Reflect. Reflect.\r\r Warmly, \rThe Soul ";
                                            stop();


                                            I am still getting undefined in the text for answers.

                                            I am still not getting any trace information in the output box.

                                            It seems as though the code is not tracking the clicks...do I need a clipevent handler??? I recreated the whole thing using your exact code and was getting that error.

                                            Should I be using actionsript 1 instead of 2???

                                            I am so lost here lol

                                            Thanks again for your help!!!!

                                            • 19. card test
                                              Greg Dove Level 4
                                              Any change you can post a link to your fla? I'll take a look at it if you want.
                                              • 20. Re: card test
                                                Greg Dove Level 4
                                                Oh, BTW you're now using all 5 responses in terms of their positions, whereas your original requrement was for 3 answers with three levels of text changeout depending on their sequence.

                                                This is not the cause of the problem as it should pick up some of them as it is. But once that's fixed it would cause some 'undefined's to appear, because its not set up to decode the whole 5. Its only set up for only three answers at the moment and three text values for each one. Its probably easier for me to take a look at your fla, fix it and then you can see what I did.
                                                • 21. Re: card test
                                                  mkbanister Level 1
                                                  You surely can have the fla....I would prefer to email it to you if thats ok. If you email me at thegraphicplace@yahoo.com. I can send it to you in a reply (that way you are not giving your email out on here). Thank you so much for your help. The reason for 5 variables each is because I am going to expand it in the future., but if it causes a problem now I will change it......I cant thank you enough for the help !!!!
                                                  • 22. card test
                                                    Greg Dove Level 4
                                                    OK I sent you an email...send it on through.
                                                    • 23. Re: card test
                                                      mkbanister Level 1
                                                      OOOH WOW, you are wonderful!!!!

                                                      The reason for the button is I have five more sets of different cards I have to add, I shouldnt have a problem now that I have the first set down.

                                                      This is the first flash that really dug in deep in coding way beyond my skills (which arent much lol) , and I cant thank you enough.

                                                      Be sure to take the test when I am done !!!!

                                                      THANK YOU THANK YOU THANK YOU
                                                      • 24. Re: card test
                                                        Greg Dove Level 4
                                                        You're welcome.