8 Replies Latest reply on Jul 19, 2010 3:56 PM by Glory04

    Zip Code Functionality

    Glory04 Level 1

      I'm looking for some assistance...okay a lot of assistance. =). I'm currently working on a project where I want to incorporate "find a location" functionality using the user's zip code. Basically, the user needs to be able to type in their zip code and once they hit the submit button, they are then taken to a page where it lists all locations available. Mind you, the website is ALL Flash. Currently, it's in ActionScript 2.0, but I could (at least with these pages) convert to ActionScript 3.0 if needed.

       

      I've tried searching for articles, but no luck. All I kept getting was results about Google Maps API. Is this something I should consider?

       

      Does anyone have any ideas on how to even begin developing something like this? Examples and links are accepted.

       

      Thanks.

        • 1. Re: Zip Code Functionality
          kglad Adobe Community Professional & MVP

          yep, you should consider google maps.  they have everything you need and more.

          • 2. Re: Zip Code Functionality
            Glory04 Level 1

            Thanks for the response. You confirmed exactly what I was thinking. I'm a bit Intimidated when it comes to coding. I guess I need some guidance or approval when I start to dabble into the code. =)

             

            Still, I'm trying to brainstorm and I'm trying to figure out the most effective and efficient way to go about this. What would you recommend I start looking at along with the Google Maps i.e. using an xml file to store zip codes, arrays, javascript???

             

            Anything will help?

            • 3. Re: Zip Code Functionality
              kglad Adobe Community Professional & MVP

              if you use as2, you'll need to use javascript to use the google api and then use the flash externalinterface class to communicate between flash and your javascript.

               

              if you use as3, you can use the api for flash.  there are tutorials you can find using google to search.

              • 4. Re: Zip Code Functionality
                Glory04 Level 1

                I'm going to go with attempting to use the Google API (as 3.0). I'll definitely hit you up when I get stuck.

                 

                You're awesome. Thanks.

                • 5. Re: Zip Code Functionality
                  kglad Adobe Community Professional & MVP

                  you're welcome.

                  • 6. Re: Arrays
                    Glory04 Level 1

                    ====FINAL MESSAGE======SORRY COMPUTER ISSUES====

                     

                    kglad,

                     

                    I spoke to you about 5 mths ago on suggestion for zip code functionality. I checked my options out and decided to use google's api. Works fine. Just wanted to say thanks again.

                     

                    Changing the subject:

                     

                    I have another issue I would like your help on regarding arrays. The following code is used to check if a user typed in the correct first OR last name in the same textfield. If the user did not a message pops up that says oops sorry name not found.

                     

                    var i:Number;
                    var first:Array = new Array("bob", "sue", "kate");

                    var last:Array = new Array("white", "kelley", "moss");

                     

                    var fullName =first.concat(last);

                     

                    What I've tried thus far is using a for loop that checks the length of fullName. If it equals textfield (name) then go to next page; if not messages pops up. That seems to work fine. But what if I want to check the length for each array and have each array take you to separate pages depending on what name you typed in the textfield (name)? I've tried creating two for loops and it works as should but for some reason I get the "name not found" message pops up and then it takes you to the page. Do you know what this is happening?

                    • 7. Re: Arrays
                      kglad Adobe Community Professional & MVP

                      you want to go to any of 9 different frames depending on which of the 9 name combinations is entered in your name textfield?

                      • 8. Re: Arrays
                        Glory04 Level 1

                        Okay, to make things easy, I’ve created a .AS file with the following code. On enter_btn, function nameMatch executes. In my nameMatch function, I’m checking both first and last name arrays. For both arrays, if text field (name) equals array go to the appropriate frame. If NOT, set noname_mc to true. When I type in a last name, everything works fine. If I type in a first name, the noname_mc pops up for a split seconds and then it goes to the appropriate frame. Would you know why this happens?

                         

                        enter_btn.onRelease = function() {

                                        nameMatch();

                        };

                         

                        function nameMatch () {

                                        for (i=0; i<first.length; i++) {

                                                        if (first [i] == name) {

                                                                        trace("first name okay");

                                                                        gotoAndStop(2);

                                                                        _root.boxes_mc.noname_mc._visible = false;

                                                                        break;

                                                        } else if (first [i] != name) {

                                                                        _root.boxes_mc. noname _mc._visible = true;

                                                        }

                                        }

                                        for (i=0; i<last.length; i++) {

                                                        if (last [i] == name) {

                                                                        trace("last name okay");

                                                                        gotoAndStop(3);

                                                                        _root.boxes_mc. noname _mc._visible = false;

                                                                        break;

                                                        } else if (last[i] != name) {

                                                                        _root.boxes_mc.noname_mc._visible = true;

                                                        }

                                        }

                         

                        }