19
Apr
09

Actionscipt 2.0: Simple Gallery

Making a simple gallery using a button on the screen;

  • This is done by creating a movieclip, into which all of the images are placed
  • A button is then linked to the movieclip which selctes the next picture in the frame (gallery is the name of the movieclip);

on (press) {

_root.movingframe.gallery.gotoAndStop(2);

}

Gallery1

The buttons on the keyboard can also be used to scroll through images, using this code, which is placed on the frame (the gallery is once again reffernced in the code;

on (keyPress “<Left>“) {

myframe = this._currentframe;

this.gotoAndStop(myframe-1);

if(myframe==1){

this.gotoAndStop(3);

}

}

on (keyPress “<Right>“) {

myframe = this._currentframe;

this.gotoAndStop(myframe+1);

if(myframe==3){

this.gotoAndStop(1);

}

}

A random bouncing motion, which can be adjusted to any form of more complex animation can be created, using a mix of fixed and random time slot coding;

Bounce

var count = 0;

var max = random(100)+100;

this.onEnterFrame = function() {

count++

if(count==max){

_root.bounce.gotoAndPlay(2);

count=-60;

max=random(300);

}

};

Advertisements

0 Responses to “Actionscipt 2.0: Simple Gallery”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: