Solved

Random images in Flash and

Posted on 2003-11-21
2
448 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
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
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.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now