19 Replies Latest reply on Aug 29, 2007 2:31 PM by siney

    PLEASE Help ASAP - deadline looming

    siney
      Hi - I appreciate any specific help on this problem. I've developed a Flash Drag & Drop game for kids to dress a character properly for winter snow sports (skiing, snowboarding, xc & snowshoe) -- I've got everything working beautifully except for the fact that I would like the give the user the choice of a helmet OR a hat and still have either selection be considered correct. I know I'm looking at a logical OR operator (or at least I believe I am) -- but it is just NOT working. Can someone please please please take a look at my code asap and let me know what you think the problem is? The helmet is comprised of a mc with a nested button (instance name is 'boaderhelmet' - and the hat's instance name is "boarderhat".....here's the whole code for all the items... THANKS SO MUCH!


        • 1. Re: PLEASE Help ASAP - deadline looming
          .:}x-=V!P=-x{:. Level 3
          if (top1 == 'boardwickingtop' && top2 == 'boardinsulating' && top3 == 'boardjacket' && pants1 == 'wickpants' && pants2 == 'boardpants' && feet1 == 'boardersocks' && feet2 == 'boardboots' && glove1 == 'boardglove1' && glove2 == 'boarderglove2' && helmet == 'boarderhelmet' || helmet == 'boarderhat'){
          .......
          }
          • 2. Re: PLEASE Help ASAP - deadline looming
            siney Level 1
            thanks so much for your much needed help :) I have tried that -- in fact, my latest effort is that I've replaced the var for hat and made it helmet - so that it's only checking for helmet once....

            hatmcX = hatmc._x;
            hatmcY = hatmc._y;
            hatmc.onRelease = function(){
            if (hatmc.hitTest(head_pos)){
            stopDrag();
            this._x=_root.head_pos._x+(_root.head_pos._width/2)-(this._width/2);
            this._y=_root.head_pos._y+(_root.head_pos._height/2)-(this._height/2);
            helmet = 'boarderhat';
            }else{
            stopDrag();
            hatmc._x = hatmcX;
            hatmc._y = hatmcY;
            }
            }

            However, with the code ending the way you've suggested and I've tried, it seems like Flash is reading is as, if the character is dressed with the helmet, correct; if the character is dressed with the hat, correct; OR if the character just has the hat on, correct.....
            Any thoughts on how to work that fix? Thanks again!
            • 3. Re: PLEASE Help ASAP - deadline looming
              FlashForumName Level 1
              If I am understanding you correctly, you want it to happen with all the other variables true AND helmet OR hat which would be like this:

              • 4. Re: PLEASE Help ASAP - deadline looming
                siney Level 1
                That might be IT - I see you enclosed with ) and started again with ( to sep. out the helmet & hat condition....let me try that...

                Thanks!
                • 5. Re: PLEASE Help ASAP - deadline looming
                  siney Level 1
                  Thanks SO much - It looks like that did it! I appreciate the help!
                  • 6. Re: PLEASE Help ASAP - deadline looming
                    FlashForumName Level 1
                    You're welcome.
                    • 7. Re: PLEASE Help ASAP - deadline looming
                      siney Level 1
                      One other quickie along those lines, suppose with one of the characters, I've got both a hat & helmet; and sunglasses & goggles and wish to apply the same logic that you can choose either/or and still be right?

                      I've got:

                      if (top1 == 'skithermalshirt' && top2 == 'fleece' && top3 == 'skijacket' && pants1 == 'basepants' && pants2 == 'skipants' && feet1 == 'skisocks' && feet2 == 'skiboots' && glove1 == 'skiglove2' && glove2 == 'skiglove1' && helmet == 'helmet' && goggs == 'skigoggs'){

                      • 8. Re: PLEASE Help ASAP - deadline looming
                        FlashForumName Level 1
                        You can add more checks to the if statement yes or you can do them inside a nested if statement if you'd rather. You could have some something like this for the goggles:
                        • 9. Re: PLEASE Help ASAP - deadline looming
                          siney Level 1
                          SWEEEET -- thanks!!
                          • 10. Re: PLEASE Help ASAP - deadline looming
                            siney Level 1
                            I'm back for more help if anyone has some ideas.....my problem with this drag & drop quiz and here's the link:

                            http://www.northpoledesign.com/sia/newhowtodress/newhowtodress.htm

                            ...is that I've checked with a variety of folks who have tried to dress the characters properly & in-full; some are getting a Correct answer and some are getting a NOPE - Try Again answer --- EVEN IF they've in fact dressed the character properly. I've found that if you drag the jacket onto the character first, then the base layer for example, you have trouble dropping the base layer in place because the jacket is in the way, then when you are able to drop it after a few clicks, it might not drop it exactly ON target, but yet, it still snaps into position. I'm thinking this is what is causing the Incorrect - try again - return.

                            If anyone has any thoughts or ideas as to how to make this 1000% bulletproof so that it works for kids (& adults :) every time -- I wildly appreciate it! I thought I had this thing nailed last night -- but alas, not the case apparently. Thanks in advance!
                            • 11. PLEASE Help ASAP - deadline looming
                              FlashForumName Level 1
                              I took some of your code and in my testing it appears that, on occasion, the release event of the dragable items does not fire. This is why it is not lining up correctly even though the hittest should validate true, it never does due to the release event not firing.

                              At least, that is what is happening in my testing. You may want to see if it's the same thing on your end.
                              • 12. Re: PLEASE Help ASAP - deadline looming
                                FlashForumName Level 1
                                If you are seeing the same result, it would lead me to believe that it has something to do with the depth of the items causing the events to not trigger at times. That's my best guess at this point, anyway.
                                • 13. Re: PLEASE Help ASAP - deadline looming
                                  siney Level 1
                                  That sure seems to make sense and would contribute to the inconsistency that folks are experiencing. What in the world is the solution to making sure the release event releases and snaps to the intended drop target....and not to just a portion of the drop target??
                                  I even tried locking the items in place after you drop them. So if you drop the jacket on first, then go back and try to drop the base layer, it still won't let me do it easily. I've got to click around and ultimately it will, but again, it might not be snapping 100% into the right spot somehow....
                                  • 14. Re: PLEASE Help ASAP - deadline looming
                                    siney Level 1
                                    For the depths of the items, I've actually got that set up with the items on different layers; obviously with the base layers on the bottom and Layer 2 on the next higher layer, etc. Any thoughts on other ways to set it up so they're all on the same layer and get positioned & layered thru actionscript?
                                    • 15. Re: PLEASE Help ASAP - deadline looming
                                      siney Level 1
                                      I just took another look at the onRelease event and see that the hit test/drop target shows that it's on the _root level; however, while that's true, so are the items. I removed the _root reference on the first baseshirt and left it on the next item so you can see what I mean....I haven't tried this across the board, but it does work when I dress the character with just the baseshirt not referencing the _root level....Do you think that would solve my primary issues with the onRelease events? Thanks again!

                                      baseshirtX = baseshirt._x; // put circle back if dropped in wrong place
                                      baseshirtY = baseshirt._y;
                                      baseshirt.onRelease = function(){
                                      if (baseshirt.hitTest(shirt_pos)){
                                      stopDrag();
                                      this._x= shirt_pos._x+(shirt_pos._width/2)-(this._width/2);
                                      this._y= shirt_pos._y+(shirt_pos._height/2)-(this._height/2);
                                      top1 = 'skithermalshirt'; // set top 1 variable to 'skithermalshirt'
                                      }else{
                                      stopDrag();
                                      baseshirt._x = baseshirtX;
                                      baseshirt._y = baseshirtY;
                                      }
                                      }
                                      fleecemcX = fleecemc._x;
                                      fleecemcY = fleecemc._y;
                                      fleecemc.onRelease = function(){
                                      if (fleecemc.hitTest(shirt_pos)){
                                      stopDrag();
                                      this._x=_root.shirt_pos._x+(_root.shirt_pos._width/2)-(this._width/2);
                                      this._y=_root.shirt_pos._y+(_root.shirt_pos._height/2)-(this._height/2);
                                      top2 = 'fleece';
                                      }else{
                                      stopDrag();
                                      fleecemc._x = fleecemcX;
                                      fleecemc._y = fleecemcY;
                                      }
                                      }
                                      • 16. Re: PLEASE Help ASAP - deadline looming
                                        FlashForumName Level 1
                                        You can try this, it appears to be working in my testing. You'll have to change the variable names to fit your objects(I just use mc_1, mc_2, etc) and be sure to apply it to each event but it appears to be working on my end. Just be sure to add the depth changes to each onPress and onRelease. You can give it a shot and see if it fixes it or not. You can probably get by with just one prevDepth variable but I used one for each for simplicity in my testing. You can work that out however you want if this method fixes your problem.

                                        • 17. Re: PLEASE Help ASAP - deadline looming
                                          siney Level 1
                                          wow - I appreciate that! I'll need to give that a shot....

                                          I did a test on the skier file without the _root reference to see if that would help and I'm returning a correct answer every time....any chance you would take a sec and try and see if it works on your end? Here's the link:

                                          http://www.northpoledesign.com/sia/newhowtodress/skierdresstest.htm

                                          Thanks again! If it does work - I think this would be a quicker fix; but otherwise, I'll try your solution.
                                          • 18. Re: PLEASE Help ASAP - deadline looming
                                            FlashForumName Level 1
                                            It appears to be working to me as well.
                                            • 19. Re: PLEASE Help ASAP - deadline looming
                                              siney Level 1
                                              with regards to the depths solution --- would I need to bring all the items of clothes onto one layer?