A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [RESOLVED] (CS4) Using Hover state of one button to simultaneously activate another

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    71

    resolved [RESOLVED] (CS4) Using Hover state of one button to simultaneously activate another

    Hi,

    I have flash which contains the map of the United States. Each state is a separate button. When each state is in hover mode, it changes the look/size of that state and adds names of the cities in white on the particular state.

    I would actually like to add 2 things to this flash.

    1) When the state is hovered over, not only will the state change, but the cities belonging to that state (in the list to the right, will highlight)

    and

    2) I would like the city names in the list, when hovered over to highlight and to activate the hover mode of that particular state. In addition, that cityName button in the list and the state button should be able to direct to a URL upon hit.

    I currently have each state as a button with each state's hover mode changes. I will be changing the cityNames into buttons (they are currently MCs). I think it will make it easier with hovers and URL directs.

    I need some guidance along the way here, because I have an idea how this must be accomplished, but there are many things that I'm not sure how to do:

    Once I change the CityNames into Buttons, then modify their hover modes to look like a highlight, then I know to do the following for the URL direct:

    for example:

    NYC_btn.onRelease = function() {
    getURL("http://www.NewYorkCity.com");
    };

    One of these will go on each text cityname button. But how do I tell the button to also activate the NewYorkState_btn into hover mode?
    I will also need each State image button to automatically arrange to the front when they are hovered so that they will not be overlapped by other states.

    Also, What do I do to get each state to hover and simultaneously highlight the appropriate CityName button(s) in the list?

    I have included an image below (FLashMapHover.jpg) so that it is a bit more clear what I am trying to do.

    In the meantime, I will continue working on it - but welcome any and all suggestions.

    Thanks,
    AC
    Attached Images Attached Images

  2. #2
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Would it be something like this?
    Attached Files Attached Files

  3. #3
    Member
    Join Date
    Dec 2007
    Posts
    71
    @nunomira

    As a matter of fact YES!

    Wow! Thank you! Impressive!

    OK, So I see that every State image wiill need to be on a new layer (instead of all on the same layer).

    I didn't see any functions for directing to the URL, so is it OK if I were to put that OnRelease function directly on each CityName button? Or would it have to be specified in the script layer?

    AC

  4. #4
    Registered User nunomira's Avatar
    Join Date
    May 2002
    Location
    portugal
    Posts
    7,003
    hi,

    Separating things by layer is just a matter of preference / organization.
    You achieve that easily in modify->timeline->distribute to layers.

    I didn't add the onRelease, because you had that already.
    Just add something like:
    Actionscript Code:
    city1.onRelease = function()
    {
        getURL("http://www.domain.com/");
    }

    along with the rest of the code.

    Actually, I forgot to mention: the trick I used was using MovieClips and the labels "_up", "_over" and "_down" which automatically makes them behave like buttons.

  5. #5
    Member
    Join Date
    Dec 2007
    Posts
    71
    @nunomira

    Thanks, yeah... I went back and tinkered with it and found that you had it by label.

    I will go ahead and do a complete overhaul of the file I currently have.

    I've also just found out that in order to move a particular state Image to the forefront when it is hovered on, I will need to use something called SwapDepth

    for example:

    state1.onRollOver = function()
    {
    city1.gotoAndStop("_over");
    city2.gotoAndStop("_over");
    state1._swapDepth(10);
    }

    Is that correct to add the swapDepth there?

    I also didn't see how the state1 MC recognized how to do it's own rollover (It wasn't in the function list nor did it have any AS directly on it).

    Does the .onRollover function automatically tell the button attached to it, to move to the "_Over" state? I'm not following how that is happening. Everything else I pretty much get.

    Thanks,
    AC




    I wonder

  6. #6
    Member
    Join Date
    Dec 2007
    Posts
    71
    I put:

    this.swapDepths(-99)

    Directly on the first frame of the symbol that shows on the "_Over" position and I did this for every State image that had a hover.

    It worked perfectly.

    Thank you so much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center