Newbie here, Green as grass.
What I want is to make a picture that is essentially just a plain flash button, and you when you push it,another picture is displayed.
How do I go about doing that?
Printable View
Newbie here, Green as grass.
What I want is to make a picture that is essentially just a plain flash button, and you when you push it,another picture is displayed.
How do I go about doing that?
There are several ways to make that happen. It sounds like you are wanting to create an image gallery. You are not going to want to do that with physical buttons for each image, but rather use a Loader object or UILoader component.
You can create an "invisible" button on top of the loader and just change what is loaded each time the button is pressed.
1) add a UILoader component to the stage and call it "pictureViewer"
2) Draw a rectangle that is the same size as your UILoader create a MovieClip symbol and give it an Instance Name "invisBtn" in your Properties window
3) change the opacity of "invisBtn" to 0 by going to Properties Window>COLOR EFFECT>Alpha>0%
4) in the same folder and your FLA and SWF re-name your images pict1.jpg, pict2.jpg, pict3.jpg
Then copy and paste the following code:
This makes a quick image gallery that will loop once it reaches the end. when you add more pictures you will need to change the totalImages to match.Code:var imageNumber:uint =1
var totalImages:uint =3
invisBtn.addEventListener(MouseEvent.CLICK, nextPicture);
function nextPicture(event:MouseEvent):void
{
if(imageNumber<=totalImages){
pictureViewer.source="pict"+imageNumber+".jpg";
imageNumber ++
}else{
pictureViewer.source="pict1.jpg";
imageNumber =2
}
}
GOOD LUCK!