How can I make a button do two things?

I’ve made a photo gallery using this tut:

http://www.kirupa.com/developer/mx/photogallery.htm

But I wish to have some corresponding text appear next to it.

So far i’ve created the texts as external MC’s, and placed them in an array (same as the pics in the above tut, but named all of the elements differently).

When I assign the AS to the buttons to change the pic, they will only change one thing: either the pic or the text, not both.

Each element will change if its own, but they wont work together.

This is the AS on a button:

  
on (release) {
 _root.changePhoto(1)
 and _root.changePhoto2(1)
}

Can anyone please tell me what AS I need to add to make the button perform both functions.

Thanks

:p:

what’s the

and

for? just take it out. if i am right in thinking that the changePhoto2() functions changes the text, then this is definately your problem. you do not need and for more that one line of code.

The changphoto2() does change the text.

The ‘and’ was not in there to start with, but it didn’t work, so I added it in case that was what was missing.

In short, the ‘and’ makes no difference.

I think cyberathlete is right. You should be able to control as many timelines and have as many functions as you want after the on release. I don’t know why the following wouldn’t work.

on (release) {
_root.changePhoto(1)
_root.changePhoto2(1)
}

Post your .fla, someone will figure it out quick.

Just add the text to the bottom of the graphic, and then update them in the library

Thanks guys,

the .fla is attached.

There are two MC’s on the loadboxes layer that the jpegs and text Mc’s load into.

And there are two action layers for each array, obviously if your looking at this, you’ll have to substitue your own MC’s and jpegs in them.

The buttons contain the AS mentioned earlier.

At the moment the buttons contain both lots of AS, but only change the text MC’s when pressed. If I remove that AS for the text Mc’s, the pics change!!!

Thanks for your help.

Mad Flasher,

Thanks for the reply, but I don’t follow.

Could you break it down for me?

well im not sure if I undertsnad what effect you want, but you could either place the text directly on the pics, so there is no need to load to seperate things, or is you want the pic, and then the caption sepratly underneath it, (prefrably do this using a graphical software thing) get your pic, and then leave a gap under it and place the text, save it and update in flash. If you really want it to look cool, you could have a seperate mask for the pic, and the text.

If you still dnt undertand, I mite be able to show you what I mean later

ok I think I understand you.

What your basically saying, is to include the text in the same MC as the pic, so they load together as one file?

I’m aware I can do this, but I was saving it as a last resort. The layout of my page, with buttons makes it a bit awkward to do that.

If I cant get the AS sorted on the buttons that’s what i’ll have to do anyway.

Thanks for the suggestion anyway.

:thumb:

Still can’t get this working.

Does anyone have any ideas at all?

The .fla is attached above is someone could take a look.

Any help at all would be appreciated,

Thanks.

i’ll have a go at it and post the fla file later k

the images are not included with the fla file, so I cnt really show you what I mean, but I can quickly make a sample of what I mean

Attached Is a very simple flash image and text gallery, it is very easy to edit, and the button coding is also simpler then yours, If you hav and problems just post