Flash intro to display a random photo

Posted on 2008-10-19
Last Modified: 2012-05-05
I am a complete Flash novice so I apologise if this is a silly question.

I would like an intro that displays a random photo (1 of 5) for a couple of seconds before going into the main site. Ideally, the photo should fill the screen with a black border and fade in and out.

I found some code that displays a random image and a line of code that points to the main page. However, I don't know how to adapt this so that the image displays few a few seconds and fades in and out.

I'm not sure whether I should be trying to do this in one Flash file or whether I should create 5 Flash files and display a random one.

As I say, I'm a complete novice with Flash so any advice on the best approach would be much appreciated.

Many thanks
// Sets the number of images in the random sequence
    // IMPORTANT: Set this number to how many images you have
    var myImageSequence = 5;
    // Creates a random number:
    var myRandomNumber = Math.floor(Math.random()*myImageSequence)+1;
    // Creates the full image name like: 1.jpg
    // IMPORTANT: If you're NOT using Jpegs change jpg to png or gif
    var myImageName = myRandomNumber + ".jpg";
    // Loads the random image:
    loadMovieNum(myImageName, 0);
{getURL("studio.htm", "_self");}

Open in new window

Question by:amberbee
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 39

Accepted Solution

blue-genie earned 125 total points
ID: 22756476
ok i'm going to point you to a number of things in the Help file where you can get some explanations and some code samples.

1. display for 5 second then go away - have a look at the Timer Class.
2. then for the fade in/out - have a look at the timer class.
3. how big are your images, you'll probably want to have a preloader as well.

try that so long - see how u manage and will assist further when i have a breather.
LVL 39

Assisted Solution

blue-genie earned 125 total points
ID: 22756508
oh i'm being a spanner.
for number 2 look at the Tween class
make sure u look in the AS2 section.

Look at using the Loader class to load your images, that way you can use the eventlistener to check if its loaded, then fade it in, wait 5000ms then fade it out and go to the other thing.

Author Closing Comment

ID: 31507572
OK many thanks - that's exactly what I wanted - pointing in the right direction. I'll try it out.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IE 11 Flash Player issue 7 252
Action Script coding 1 187
Adobe flash player memory exhaustion 6 98
Some You tube not working in IE11 on Windows 10 and 8.1 5 95
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to how to record live broadcast.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question