Adam
asked on
Trying to create a simple map with Flash AS3
Hi there!
I'm a real noob when it comes to Flash so I think my question is relatively simple but alas...I just can't seem to figure this out.
I'm trying to create a map similar to the one on Obama's site (see under "Connect with OFA in your state"). The map I'm looking to create is essentially the same but I don't need the names to appear underneath when you hover over the items on the map or on the right hand side. The only additional thing I would be looking to add is once you hover over an item, the alpha for all other items is reduced (and once you rollout, everything goes back to normal). Does that make sense?
Now, this seems like a relatively simple thing to do. However, the only way I know how to pull this off is to create a whole bunch of event listeners for each of the rollovers. I know this will work but this doesn't seem like the most efficient way to do this (if i use this approach and need to change something, I'll have to make the same changes a whole bunch of times). Each of the rollovers essentially behave the same way so it would make sense that I create a function that can perform this without manually doing it to each item.
Like I said, I'm not an expert at Flash but I'm sure there has to be a better way to do this. Can someone lend me a hand?
Thanks!
I'm a real noob when it comes to Flash so I think my question is relatively simple but alas...I just can't seem to figure this out.
I'm trying to create a map similar to the one on Obama's site (see under "Connect with OFA in your state"). The map I'm looking to create is essentially the same but I don't need the names to appear underneath when you hover over the items on the map or on the right hand side. The only additional thing I would be looking to add is once you hover over an item, the alpha for all other items is reduced (and once you rollout, everything goes back to normal). Does that make sense?
Now, this seems like a relatively simple thing to do. However, the only way I know how to pull this off is to create a whole bunch of event listeners for each of the rollovers. I know this will work but this doesn't seem like the most efficient way to do this (if i use this approach and need to change something, I'll have to make the same changes a whole bunch of times). Each of the rollovers essentially behave the same way so it would make sense that I create a function that can perform this without manually doing it to each item.
Like I said, I'm not an expert at Flash but I'm sure there has to be a better way to do this. Can someone lend me a hand?
Thanks!
ASKER
Hi gingermoleman,
Thanks so much for your reply. Unfortunately, my Flash skills are not really all that advanced. I think I understand what it is your suggesting but I'm not sure if its something I can pull off on my own.
Would you mind elaborating on your example a bit more? I would greatly appreciate it.
P.S. The map I'm looking to make is quite simple so using the Google Maps API would be a bit of overkill. Thanks for the alternative suggestion though.
Thanks so much for your reply. Unfortunately, my Flash skills are not really all that advanced. I think I understand what it is your suggesting but I'm not sure if its something I can pull off on my own.
Would you mind elaborating on your example a bit more? I would greatly appreciate it.
P.S. The map I'm looking to make is quite simple so using the Google Maps API would be a bit of overkill. Thanks for the alternative suggestion though.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Wow! Thanks so much GMM! You definitely went way above and beyond. This is extremely helpful!
Cheers!
Cheers!
No worries, I have learned tons due to the generous helping nature of many on the web and strangely find myself wanting to "repay" that by putting back in. All very zen like!
that and im a point whore :)
that and im a point whore :)
ASKER
I hear ya. Very noble of you!
Speaking of which, I actually posted a new question related to this question. Its something relatively small but I can't figure it out. I know you enjoy your points so if you're interested, you can find it here:
http://www.experts-exchang e.com/Soft ware/Photo s_Graphics /Web_Graph ics/Macrom edia_Flash /Q_2691997 2.html
I use your sample (with some modifications) as a reference. If you're not interested or don't have time - then no worries. I appreciate the help anyway.
Have a good one.
Speaking of which, I actually posted a new question related to this question. Its something relatively small but I can't figure it out. I know you enjoy your points so if you're interested, you can find it here:
http://www.experts-exchang
I use your sample (with some modifications) as a reference. If you're not interested or don't have time - then no worries. I appreciate the help anyway.
Have a good one.
Firstly, can't check the example as I'm on my phone so apologies if I'm not spot on for what your after.
Your thinking is correct, if the event is the same but some vars are all that change then its "smarter" to do it with 1 listener.
How are you with arrays? In essence you need to put your buttons in a list along with the changing vars. Ie
I'd. Name
0. London
1. New york
3. Moscow
In the listener function you would have something like
Function buttonClicked(e:MouseEvent
Var currentPress = e.target.I'd;
// this gets the I'd of the object clicked on.
HoverText.text = myArray[currentPress].name
// this changes a text field to the associated name from our array
}
Alternately, check out the flash api for google maps has many benefits and loads of documentation.
Gmm