-
How do I make a button comic?
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?
Last edited by GLXRBLT; 05-10-2013 at 04:52 PM.
-
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:
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
}
}
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.
GOOD LUCK!
Last edited by jkell; 05-18-2013 at 03:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|