6 Replies Latest reply on Oct 4, 2010 9:19 PM by kglad

    Button behavior

    Fajza Level 1

      I have an application online at http://chaz45.com/main26a.html with 4 buttons on the left side.  The first three buttons work fine.  The fourth button selects a php application that loads a contact form.  For some reason when that button is clicked by the user, it doesn't react like the others.  If you move the mouse away from the button after clicking it, the page will load, but when you initially click the button and the mouse is still hovering over it, it does nothing.  If you move the mouse pointer around while still hovering over the button (after clicking it), the button moves repeatedly.  The buttons are 'button' objects in flash and the 'down' state of each button includes a slightly modified X and Y coordinate on the button, in order to show movement when clicked.  Below is the AS 2.0 code for the site.  Any help would be appreciated.

      ****************************************************************************************** *****************************

      main26a.fla ActionScript code:

       

      stop();
      // ------ IMPORT ----- \\
      import mx.transitions.Tween;
      import mx.transitions.easing.*;

       

      // ---- INIT ----- \\
      var endY:Number;
      background_mc._y = songlist_btn._y - 3;
      var soundPress:Sound = new Sound();
      soundPress.attachSound("click1");
      var booking = "http://www.chaz45.com/booking.html";

       

      // ----- FUNCTIONS ----- \\

       

      //--- function moveBox is located in frame ### on the 'box' layer. \\
      function moveBox(endY)  {
          background_mc._alpha = 100;
          new Tween(background_mc,"_y",Strong.easeOut,background_mc._y,endY,20,false);
      }

       

      function buttonTweens() {
          new Tween(songlist_btn,"_y",Bounce,songlist_btn._y,255.15,5,false);
          new Tween(events_btn,"_y",Bounce,events_btn._y,344.65,5,false);
          new Tween(media_btn,"_y",Bounce,media_btn._y,437.30,5,false);
          new Tween(booking_btn,"_y",Bounce,booking_btn._y,529.95,5,false);
      }

       

      // ----- ROLLOVER EVENTS ----- \\
      songlist_btn.onRollOver = function() {
          moveBox(songlist_btn._y - 3);
         
      }

       

      events_btn.onRollOver = function() {
          moveBox(events_btn._y);
         
      }

       

      media_btn.onRollOver = function() {
          moveBox(media_btn._y);
         
      }

       

      booking_btn.onRollOver = function() {
          moveBox(booking_btn._y);
         
      }

       

      // ----- CLICK EVENTS ----- \\
      songlist_btn.onPress = function  () {
          soundPress.start();
          background_mc._alpha = 0;
      }

       

      events_btn.onPress = function  () {
          soundPress.start();
          background_mc._alpha = 0;
      }

       

      media_btn.onPress = function  () {
          soundPress.start();
          background_mc._alpha = 0;
      }

       

      booking_btn.onPress = function  () {
          soundPress.start();
          background_mc._alpha = 0;
      }

       

      songlist_btn.onRelease = function  () {
          getURL("http://www.chaz45.com/htdoc/songlist.html","_self");
      }

       

      events_btn.onRelease = function  ():Void {
          getURL("http://www.chaz45.com/htdoc/events.html","_self");
      }

       

      media_btn.onRelease = function  () {
          getURL("http://www.chaz45.com/htdoc/media.html","_self");
      }

       

      booking_btn.onRelease = function  () {
      //    getURL("http://www.chaz45.com/scripts/contact.php","_self");
      }

       

      /*//-------- Music Control --------\\
      var songPosition:Number = song.position;
      var song:Sound = new Sound();
      song.attachSound("song1");
      song.setVolume(80);
      song.start();

       


      this.musicPlayer_mc.stop_mc.onRelease = function  () {
          songPosition = 0;
          song.stop();
      }

       

      this.musicPlayer_mc.play_mc.onRelease = function  () {
          songPosition = song.position;
          song.start(songPosition);
      }

       

      this.musicPlayer_mc.pause_mc.onRelease = function  () {
          songPosition = song.position;
          song.stop();
      }

       

      this.musicPlayer_mc.volDown_mc.onRelease = function  () {
          if (song.getVolume() > 0) {
              song.setVolume(song.getVolume() - 10);
          }
      }

       

      this.musicPlayer_mc.volUp_mc.onRelease = function  () {
          if (song.getVolume() < 100) {
              song.setVolume(song.getVolume() + 10);
          }
      */

      ****************************************************************************************** *******************************

      *** The contents of contact.php  that is executed when the Contact button is clicked is below: ***

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

       

      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Chaz45 Contact Form</title>
      <style type="text/css">
      body {
          background-color: #BA8201;
      }
      </style>
      <link href="/style1.css" rel="stylesheet" type="text/css" />
      </head>

       

      <body>
      <div align="center">

       

      <div align="center">
        <h1>CHAZ45 Contact page</h1>
      </div>

       

      <div align="center" id="normalText">
          <a href="http://www.chaz45.com/main.html">Home</a>
          <a href="http://www.chaz45.com/songlist.html">Songlist</a>
          <a href="http://www.chaz45.com/events.html">Events</a>
          <a href="http://www.chaz45.com/media.html">Media</a>
          Contact
          <a href="http://www.chaz45.com/booking.php">Booking</a>
      </div>

       


      <div align="center">
          <h4>To Book Chaz45 for an event, click <a href="booking.php">here</a></h4>
      </div>

       

      <form method="post" action="contactemail.php">

       

      <!-- DO NOT change ANY of the php sections -->
      <?php
      $ipi = getenv("REMOTE_ADDR");
      $httprefi = getenv ("HTTP_REFERER");
      $httpagenti = getenv ("HTTP_USER_AGENT");
      ?>

       

      <input type="hidden" name="ip" value="<?php echo $ipi ?>" />
      <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
      <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

       


      Your Name: <br />
      <input type="text" name="visitor" size="35" />
      <br />

       

      Your Email:<br />
      <input type="text" name="visitormail" size="35" />
      <br />
      <br />

       

      Subject:<br />
      <select name="subject" size="1">
      <OPTION SELECTED VALUE="General Information">Select...</OPTION>
      <option value=" General Information ">General Information </option>
      <option value=" Booking ">Booking </option>
      <option value=" Other ">Other (please specify) </option>
      </select>
      <br />

       

      <input type="hidden" name="othersubject" size="35" />

       

      <?php echo $subject ;

       

      //$('#othersubject').val('3');

       

      //if ($subject == "Other") {
      //    $othersubject(type) = "text";
      //}

       

      echo $othersubject;

       

      ?>

       

      <br /><br />

       

      Message:
      <br />
      <textarea name="notes" rows="4" cols="40"></textarea>
      <br />
      <input type="submit" value="Send Mail" />
      <br />
      </form>

       

      </div>
      </body>
      </html>

       

      ****************************************************************************************** *****************************

       

      *** Contents of resulting file (contactemail.php) that sends the message:  ***

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

       

      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <title>Chaz45 Send Contact Email Script</title>
      </head>
      <body>

       

      <!-- Reminder: Add the link for the 'next page' (at the bottom) -->
      <!-- Reminder: Change 'YourEmail' to Your real email -->

       

      <?php

       

      $visitor = $_POST['visitor'];
      $visitormail = $_POST['visitormail'];
      $subject = $_POST['subject'];
      $othersubject = $_POST['othersubject'];
      $visitormsg = $_POST['notes'];

       

      $todayis = date("l, F j, Y, g:i a") ;

       

      $subject = ("New message from Chaz45 website");

       

      $message = " $todayis [CST] \n
      From: $visitor ($visitormail)\n
      Message: $visitormsg \n
      ";
      // Do not remove the previous line!!

       

      $from = "From: $visitormail\r\n";

       


      mail("chaz4577@gmail.com", $subject, $message, $from);

       

      ?>

       

      <p align="center">

       

      Date: <?php echo $todayis ?>
      <br />

       

      Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
      <br />

       

      Subject: <?php echo $subject ?> (<?php echo $othersubject ?>)
      <br />

       

      Message:
      <?php $notesout = str_replace("\r", "<br/>", $visitormsg);
      echo $notesout; ?>
      <br />

       

      Your message has been sent.
       
      <br /><br />
      <a href="http://chaz45.com/contact.php"> Contact </a>
       
      <a href="http://chaz45.com/main.html"> Home </a></p>

       

      </body>
      </html>

        • 1. Re: Button behavior
          kglad Adobe Community Professional & MVP

          i don't see the button moving but i see the last 1/2 of the text (tact) being compressed from left-to-right.  you could go check that button's timeline to search for the problem but unless you know how to move everything to its own layer (distribute to layers) so you can find the over-lapping problem, it will probably be easier to remake that button from scratch.

          • 2. Re: Button behavior
            Fajza Level 1

            Well that's interesting.  I can see the entire button moving, as it should be, no compressed text or anything.  I wonder if you are using a different screen resolution than I am.  I am using 1600 x 900 currently.  I'll check it out with different resolutions to see if I can duplicate what you are seeing.

             

            I will bust the button apart into layers.  I guess I might have a button inside of a button. That might explain the strange behavior here.

             

            Thanks for the input.

            • 3. Re: Button behavior
              Fajza Level 1

              Ok it must be something with the text inside the button.  I changed to 1024x768 and then i could

              more easily get to different places inside the button.  What I noticed is that when you dont hover over

              the text after clicking, the button works and calls the form immediately.  The "shaking" only seems to occur when I am still hovering over the text portion of the button.

              • 4. Re: Button behavior
                kglad Adobe Community Professional & MVP

                make sure your textfield is not selectable.

                • 5. Re: Button behavior
                  Fajza Level 1

                  It's fixed now.  I took your advice and removed all of the frames inside the button and recreated them.  That seems to have done the trick.  Thanks for your help.

                  • 6. Re: Button behavior
                    kglad Adobe Community Professional & MVP

                    you're welcome.