Loading random external images/text/swf - SWiSHMax Tutorials
 
  Buy Ebooks, Video Games, DVDs, Electronics and more !
Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads Make Money Online Blog . Free Image and Photo Sharing and Hosting

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Free image hosting
   Web Design Pakistan
   Swish Templates
   SWiSH Climax
   Talkfreelance Community
   Template Desire
   Lite boards
   Script Sector
   GimpTalk
   13dots
   Idea Designs
   PHP Cafe
   Sposatoettore
   Free swishmax templates
   Swishzone

Manage your site with Flax Article Content Management System
Loading random external images/text/swf
Category : SWiSHMax | Level : Intermediate | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

Hi,

As I saw this issue is very searched for and there wasn't a tutorial for it...

If you need a random image file loaded do the following:

CODE

onLoad () {
   imagesel = math.random(n);
   tellTarget (_root.loader) {
       loadMovie("image"+ imagesel +".jpg");
   }
}


Explanation

We declared a variable called imagesel that picks a number randomly from the n range... for example if n=3 then we have a result of a random number between 0,1,2,3.

loader is the sprite located in _root in which we want to load the image.

The images that will load have to be named like: image0.jpg, image1.jpg, image 2.jpg... and so on, depending on the number of images you have.


To load a text randomly, you have the following code:

CODE

onLoad () {
   txtsel = math.random(n);
   tellTarget (_root.loader) {
       loadMovie("text"+ txtsel +".txt");
   }
}




Explanation

We declared a variable called txtesel that picks a number randomly from the n range... for example if n=3 then we have a result of a random number between 0,1,2,3.

loader is the dynamic text located in _root in which we want to load the text.

The texts that will load have to be named like: text0.txt , text1.txt , text2.txt ... and so on, depending on the number of texts you have.

Hope this helps you out and achieve what you want. If you have any questions don't hesitate to ask. This "tut" will also be available in update nr.2 in SM Unleashed e-book.

Regards,
Eddie


© 2002-2005 Flaxweb Network | Article Manager | Gimp Tutorials Library | RAD C++ Library | Free C/C++ Sourcecode |
Sites of interest : Web Design Blog | Swish Templates | Swishmax Ebook | Photoshop Templates | Gimp Tutorials | Text Forum | Make Money Online