8 Replies Latest reply on Apr 9, 2011 11:54 AM by brknneks

    text to button help

    brknneks

      i'm creating a photo page on my website www.3ft4.com and i'm trying to make the text in the upper right hand corner of my photos page linkable to load a different setion of photos depending on which ones the user wants to see. my website is a main.swf file and the photo page itself is like a templete with a square box in the middle that previews which photo you select from the thumbs below that, which is loaded by actionscript. i have already created the text and turned those into symbols, duplicated that photo page and renamed them as desired sectionCelebs, sectionFriends etc..... i'm needing the code for the buttons so when a user clicks on say the text Celebs it opens my Celebs Gallery, they click on Friends it opens my Friends Gallery. Also did i do the right thing by duplicating that one Photo page and renaming them for each Gallery or is there some code that i could use in the buttons actions that would just use the same Photo section templete but just loaded a different Gallery??? i hope this makes some since i'm new to all this.........

       

      Thanks,

       

      Brian

        • 1. Re: text to button help
          kglad Adobe Community Professional & MVP

          you can use the asfunction to create a link in a textfield that calls an actionscript function.  in that actionscript function you can display your other section(s).

          • 2. Re: text to button help
            brknneks Level 1

            this is the code the guy put in for the action layer on the Photo page i have now:

             

            function loadGallery(directory, images)
            {
                var _loc6 = this.createEmptyMovieClip("thumbContainer", this.getNextHighestDepth());
                _loc6._x = 30;
                _loc6._y = 534;
                for (var _loc2 = 0; _loc2 < images.length; ++_loc2)
                {
                    var _loc3 = _loc6.attachMovie("sectionPhotosThumbCombo", "picThumb" + _loc2, _loc2, {_x: _loc2 * 71});
                    _loc3.thumb.imgTarget.loadMovie("flashImages/" + directory + "/thumbs/" + images[_loc2] + ".jpg");
                    _loc3.reflect.imgTarget.loadMovie("flashImages/" + directory + "/thumbs/" + images[_loc2] + ".jpg");
                    _loc3.directory = directory;
                    _loc3.image = images[_loc2];
                    _loc3.onRollOver = function ()
                    {
                        this._xscale = this._yscale = 100;
                        this.onRollOut = this.onDragOut = this.onReleaseOutside = function ()
                        {
                            this._xscale = this._yscale = 100;
                        };
                        this.onRelease = function ()
                        {
                            showPic(this.directory, this.image);
                        };
                    };
                } // end of for
                imageHolder.imgTarget.loadMovie("flashImages/" + directory + "/" + images[0] + ".jpg");
            } // End of the function
            function showPic(directory, image)
            {
                imageHolder.imgTarget.loadMovie("flashImages/" + directory + "/" + image + ".jpg");
            } // End of the function
            var celebPics = new Array("aries", "brian", "charlie", "saget");
            var friendPics = new Array("andy", "army", "fellas", "grills");
            var hottiePics = new Array("cupcake", "cupcake2", "girls", "hellyeah", "jen2", "jenny", "okc");
            var prisonPics = new Array("crew", "crew1", "crew2", "prison1", "serals");
            var stagePics = new Array("001_1", "002_2", "003_3", "004_4", "1537", "2251", "2257", "9248");
            loadGallery("stage", stagePics);

             

            and this is the page i've added the text buttons to, now should i duplicate this file and name it say "sectionCelebs" but change the bottom loadGallery with "celebs", celebPics so that when the button is clicked it'll load this file with the new loadGallery?? and if so what should the button code be?

            • 3. Re: text to button help
              kglad Adobe Community Professional & MVP

              1.  that looks like decompiled (ie, hi-jacked) code.

              2.  the lack of code formatting makes that code difficult to read.

              3.  if you're just starting with flash, you should probably hire someone to do this for you.

              • 4. Re: text to button help
                brknneks Level 1

                good eye.... the guy building the site for me backed out, so i had to pull the file from my server and decompile it so i could work on it in flash. i have took that file "sectionPhotos" and duplicated it and renamed it to "sectionPlaces" and changed the AS at the bottom (loadGallery "places, placesPics") so that it loads the photos from that gallery. i just don't see why it's so hard to find the code to tell that button when clicked to open or load "sectionPhotos" switch to that gallery.....

                • 5. Re: text to button help
                  kglad Adobe Community Professional & MVP

                  i wouldn't say the task is hard.  but it's likely to be time-consuming because of your knowledge-base.  for example, there's nothing in the code you showed about a textfield so there's no place to edit your code to add the functionality you want.

                   

                  most likely someone will need to download your files and correct them for you.

                  • 6. Re: text to button help
                    brknneks Level 1

                    i converted the text into a button symbol, when i type in the go to url code it works fine.... so why couldn't i do the same by just telling it when clicked go to "sectionPlaces" or loadGallery ('places, placePics")??

                    • 7. Re: text to button help
                      kglad Adobe Community Professional & MVP

                      if you want your button to goto a frame label in the current timeline:

                       

                      this.gotoAndPlay("sectionPlacesLabel");

                       

                      or, if you want to load placePics.jpg into a movieclip named places, use:

                       

                      places.loadMovie("placePics.jpg");

                      • 8. Re: text to button help
                        brknneks Level 1

                        nethier one worked i keep getting the error "Statement must appear on holder' i'm placing the code into the button itself so i think the code i'd need is static code. i have my main photo page with is named 'sectionPhotos'...... the action script within that file tells it to upload my stage pics. ok so i duplicate that file and change the AS at the bottom of it to load my celeb pics and rename it 'sectionCelebs' so when a visitor visits my site and clicks the text button on my main photo page it uploads the file in which i have changed the AS in the action layers to load my celeb pics.