# URGENT HELP: Roll-overs using actionscript

**URL:** https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928
**Category:** Uncategorized
**Created:** [October 24, 2006, 6:20pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928 "2006-10-24T18:20:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![spancholi](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spancholi](https://forum.kirupa.com/u/spancholi)
#### Post date: [October 24, 2006, 6:20pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/1 "2006-10-24T18:20:57Z")

</div>

Hi:

I’ve created a U.S.Map with roll-overs for each state. What i want is that when you roll-ver each state, you can see a photo + some text appear in the same scene. The idea is that, eachstate has a different photo+text that appears when you roll over it. How do I do this using actionscript?

I have attached a raw .fla file I have started, in order to see what I’m talking about. Please click on “HIV” button to view the roll-overs already created. All I need is to add photos to each U.S. state now??

PLEASE HELP, THIS IS URGENT!

---

<div class="post-metadata">

### Author: ![skellykitten](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skellykitten](https://forum.kirupa.com/u/skellykitten)
#### Post date: [October 24, 2006, 8:07pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/2 "2006-10-24T20:07:59Z")

</div>

I can’t find your attached fla, but I think I get what you mean.

```auto
this.yourStateMc.onRollOver = function(){ /*replace yourStateMc with the the instance name you gave your mc*/
attachMovie("newphoto","newphoto", this.getNextHighestDepth());/* replace newphoto with your phot name*/
newphoto._x= 150;//put in your own coordinates.
newphoto._y=150;
}

```

is that what you are looking for?  
I’m also new to actionscript and didn’t test that since I can’t see your file:)

---

<div class="post-metadata">

### Author: ![spancholi](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spancholi](https://forum.kirupa.com/u/spancholi)
#### Post date: [October 24, 2006, 8:49pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/3 "2006-10-24T20:49:43Z")

</div>

[QUOTE=skellykitten;1984607]I can’t find your attached fla, but I think I get what you mean.

```auto
this.yourStateMc.onRollOver = function(){ /*replace yourStateMc with the the instance name you gave your mc*/
attachMovie("newphoto","newphoto", this.getNextHighestDepth());/* replace newphoto with your phot name*/
newphoto._x= 150;//put in your own coordinates.
newphoto._y=150;
}

```

is that what you are looking for?  
I’m also new to actionscript and didn’t test that since I can’t see your file:)[/QUOTE]  
Here is the code I changed it to…It still says error in code?? I am attaching myflash file. Please help me if you can! Everyting i need is on the “HIV BUTTON” PAGE.

this.Batterman.onRollOver = function(){  
attachMovie(“batterman\_photo.jpg”,“batterman\_photo.jpg”, this.getNextHighestDepth());  
newphoto.\_x= 150;  
newphoto.\_y=150;  
}

---

<div class="post-metadata">

### Author: ![skellykitten](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skellykitten](https://forum.kirupa.com/u/skellykitten)
#### Post date: [October 24, 2006, 10:45pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/4 "2006-10-24T22:45:31Z")

</div>

You’re fla still isn’t attached, at least not that I can see. Make sure after you hit browse and select it that you press upload, then post your message

---

<div class="post-metadata">

### Author: ![skellykitten](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skellykitten](https://forum.kirupa.com/u/skellykitten)
#### Post date: [October 24, 2006, 10:54pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/5 "2006-10-24T22:54:09Z")

</div>

I should have asked this too-  
[LIST]  
[_] first is your “batterman” object a button or a movieclip?  
[_]are you loading your photo externally or from the library?  
[\*]did you drag it onto the screen or use attachmovie on “batterman”[/LIST]If you are loading (the photo) it externally it’s a different script, you have to create an empty movie clip to load it into. You can do that by pressing ctrl+f8 and then naming it. Thne you can drag it on the stage where you want it, or you can creat it dynamically.  
I’ll play around and see what I can figure out 🙂

---

<div class="post-metadata">

### Author: ![skellykitten](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@skellykitten](https://forum.kirupa.com/u/skellykitten)
#### Post date: [October 24, 2006, 11:46pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/6 "2006-10-24T23:46:11Z")

</div>

Me again-  
I used this and it worked- I’m assuming you are loading the jpgs externally so here are some things you need to make sure of first:

1. make sure that you have your fla and your jpgs saved in the same file folder ont your computer  
2 when you upload them to the internet (if you are going to) they also have to be in the same folder/directory

```auto

//creates an empty movie clip to load your jpgs into
this.createEmptyMovieClip("cont_1", this.getNextHighestDepth());

batterman.onRollOver = function(){
//load to emptycontainer
 cont_1.loadMovie("batterman_photo.jpg");
 cont_1._x=225;
 cont_1._y=255;
};
// this removes the clip on rollout- just delete it if you don't want that to happen.
batterman.onRollOut = function(){
	cont_1.unloadMovie("batterman_photo.jpg");
}

```

One thing with code written this way is that you don’t attach it directly to the movieclip. On your main timeline, you need to make another layer, name it actions and lock it so you don’t accidently put any movieclips or buttons on it. Then place the actionscript on the first frame of that layer.  
I hope this helped:)

---

<div class="post-metadata">

### Author: ![spancholi](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spancholi](https://forum.kirupa.com/u/spancholi)
#### Post date: [October 25, 2006, 12:45pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/7 "2006-10-25T12:45:08Z")

</div>

HERE IS THE FLASH FILE. PLZ TEST!!!

[quote=skellykitten;1984607]I can’t find your attached fla, but I think I get what you mean.

```
 ActionScript Code:
 [FONT=Courier New][LEFT][COLOR=#0000ff]this[/COLOR].[COLOR=#000080]yourStateMc[/COLOR].[COLOR=#0000ff]onRollOver[/COLOR] = [COLOR=#000000] **function** [/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR] [COLOR=#808080]*/*replace yourStateMc with the the instance name you gave your mc*/*[/COLOR]

```

[COLOR=#0000ff]attachMovie[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]“newphoto”[/COLOR],[COLOR=#ff0000]“newphoto”[/COLOR], [COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]getNextHighestDepth[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR];[COLOR=#808080]_/_ replace newphoto with your phot name\*/_[/COLOR]  
newphoto.[COLOR=#0000ff]\_x[/COLOR]= [COLOR=#000080]150[/COLOR];[COLOR=#808080]_//put in your own coordinates.\*[/COLOR]  
newphoto.[COLOR=#0000ff]\_y[/COLOR]=[COLOR=#000080]150[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

is that what you are looking for?  
I’m also new to actionscript and didn’t test that since I can’t see your file:)[/quote]

---

<div class="post-metadata">

### Author: ![spancholi](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@spancholi](https://forum.kirupa.com/u/spancholi)
#### Post date: [October 25, 2006, 1:08pm UTC](https://forum.kirupa.com/t/urgent-help-roll-overs-using-actionscript/204928/8 "2006-10-25T13:08:02Z")

</div>

HERE IS THE FLASH FILE. PLZ TEST!!! COULD YOU PLEASE TEST THE CODE YOU WROTE ON IT & SEND IT BACK TO ME? IT STILL SHOWING ME ERRORS :hurt:

ALSO, YOU MAY NEED TO GROUP EVERYTHING AND INCREASE THE SIZE, JUST SO U CAN SEE THE GRAPHICS. I HAD TOR EDUCE THE FILE SIZE AS THERE IS A SIZE LIMIT ON YOUR WEBSITE.

THANK YOU AGAIN FOR DOING THIS. I AM LOOKING FORWARD TO YOUR REPLY AS YOUARE SO CONCISE & ARTICULATE. TRULY ENJOYING THIS! U GUYS ARE THE BEST!

THANKS!!!
