Advertisement

11.02.2007 at 02:29PM PDT, ID: 22935978
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Flash Actionscript Rollovers that stay highlighted when clicked

Asked by gonzogambler in Macromedia Flash, Miscellaneous Web Development

Tags: , , ,

I'm creating a US map in flash where the states highlight when you rollover them and then when clicked stay highlighted and display contact information until another state is clicked.

I have most of it working, but I cannot get the states to stay highlighted when clicked.  I'm trying to create
a variable that says if the mouse has been clicked on a state and then a function that says if its clicked put the movie of the state on frame 2 (highlighted) and if not go back to white.

here is the code on the actionscript layer:

var clickState = "off";

function clearInformation () {
      this.proavWA._alpha = 0;
      this.proavCA._alpha = 0;
      this.proavOR._alpha = 0;
      this.proavNV._alpha = 0;
      this.proavID._alpha = 0;
      this.proavMT._alpha = 0;
      this.proavWY._alpha = 0;
      this.proavCO._alpha = 0;
      this.proavAZ._alpha = 0;
      this.proavNM._alpha = 0;
      }

function clickChecker() {
      if (clickState = "off") {
                  this[rolledState].gotoAndStop(1);
                  trace ("its working");
      } else {
                  this[rolledState].gotoAndStop(2);
                  trace ("its working part 2");}
      }
      
function hoverRemove () {
      this[selectedState].gotoAndStop(1);
}

And here is what the action script for the movie clip of the state of washington looks like:

on (rollOver) { /* highlight state and put grab name for clickChecker */
      gotoAndStop(2);
      _global.rolledState = this._name;
}

on (rollOut) { /* check to see if state should stay highlighted */
      _root.clickChecker();
      trace (clickState);
}

on (press) { /* remove contact box and color from previous clicked state */
      _root.clearInformation();
      _root.hoverRemove();
}

on (release) { /* set name and contact info then make state stay highlighted */
      _root.states = "Washington";
      _root.proavWA._alpha = 100;
      _global.clickState = "on";
      _global.selectedState = this._name;
}


using traces it seems like the variable starts as undefined even though I tried to set it.  The function always executes the first part of the if statement never the else.  If i set it to off when the state gets rolled over it doesnt make a difference.

you can view how the swf works here:  http://www.kylejlarson.com/chief/map/map.html
so far i've just been working with oregon and washington so the other states aren't set up yetStart Free Trial
[+][-]11.03.2007 at 12:21AM PDT, ID: 20206186

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia Flash, Miscellaneous Web Development
Tags: rollover, flash, actionscript, stay
Sign Up Now!
Solution Provided By: Zeffer
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628