Solved

Random images in Flash and

Posted on 2003-11-21
2
461 Views
Last Modified: 2010-04-03
Hi, I'm looking for a simple solution to randomly display an image in Flash each time the browser loads.

Also, I would like to know how I can limit a movie to play on the home page only once per browser session.

Thanks for your help!
0
Comment
Question by:liltyga
[X]
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 Comments
 
LVL 27

Accepted Solution

by:
negatyve earned 250 total points
ID: 9796353
>Hi, I'm looking for a simple solution to randomly display an image in Flash each time the browser loads.

suppose you've got a "images" folder with this content:

pic1.jpg, pic2.jpg, pic3.jpg, pic4.jpg.... pic20.jpg

where you want to display your picture, create an empty movieclip, with "loader" instance name.
then, in the same frame, drop this code:

loader.loadMovie("images/pic" + (random(20) + 1) + ".jpg");

>Also, I would like to know how I can limit a movie to play on the home page only once per browser session.

it dipends on the server side language supported by your web hoster. anyway, you can do it something similar with javascript and cookies:

sample1: http://flash-mx.html.it/guide/swf/negatyve_javascript/introCookies/getURL/intro.html
source1: http://flash-mx.html.it/guide/zip/negatyve_javascript/cookieGetURL.zip
sample2: http://flash-mx.html.it/guide/swf/negatyve_javascript/introCookies/GotoFrame/filmato.html
source2: http://flash-mx.html.it/guide/zip/negatyve_javascript/cookieGotoFrame.zip
sample3: http://flash-mx.html.it/guide/swf/negatyve_javascript/introCookies/LoadMovie/intro.html
source3: http://flash-mx.html.it/guide/zip/negatyve_javascript/cookieLoadMovie.zip
0
 

Expert Comment

by:gangsidestep
ID: 10178030
Hey I want to do the same thing as above but taking pictures from a php file
can you help??
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

627 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