Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

randomizer question

Status
Not open for further replies.

Flashoid

Technical User
Dec 11, 2002
163
US
I have created this by following this code from the FAQ page:

First create a movie, e.g. BannerLoader.swf
Then create the banners. They must have the same dimensions as BannerLoader.swf (400x80 is a good size), but they can be of any duration or filesize and interactive or not.
Name the banner files bannerX.swf, where X is a number. The numbers of the banners start at 0 and must be increment: banner0.swf, banner1.swf, banner2.swf, etc...
Insert two keyframes in BannerLoader.swf.
Label the first one, e.g. "LoopStart" and add the following code:
Set Variable: "Delay" = 10
Set Variable: "NumBanners" = 75+1
Set Variable: "TmpTimer" = Int(GetTimer/1000)
If ((TmpTimer-(Delay*(Int(TmpTimer/Delay))))=1)
Loop While (CurMovie eq NewMovie)
Set Variable: "NewMovie" = "Banner" & Random (NumBanners) & ".swf"
End Loop
Set Variable: "CurMovie" = NewMovie
Unload Movie (1)
Load Movie (CurMovie, 1)
End If

And this code to the second:
Go to and Play ("LoopStart")

However, I get this error message:

(**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 1: Syntax error.
Set Variable: "Delay" = 10

**Error** Scene=Scene 1, layer=Layer 2, frame=2:Line 1: Syntax error.
Go to and Play ("LoopStart")

Total ActionScript Errors: 2 Reported Errors: 2)

when playing it -- does anyone have any suggestions on what I am doing wrong or have another actionscript that would work better? I would ideally like to have different banners load randomly.

thanks!
 
That looks like old actionscript.

Try this:

Code:
Delay = 10;
NumBanners = 75+1;
TmpTimer = getTimer()/1000;
 if (TmpTimer-(Delay*(TmpTimer/Delay))==1){
      do {
          NewMovie = "Banner" + Random (NumBanners)+ ".swf";
	  }while (CurMovie == NewMovie);
      CurMovie = NewMovie;
		unloadMovie(1)
		loadMovieNum(CurMovie,1);
 }
On second frame
Code:
gotoAndPlay("LoopStart");

I have not actually tested this script just did my best to convert it to a current form of actionscript. This looks like it is Flash 3 or earlier. VERY out dated.

One thing that may help you on things like this. If you highlight something in the action pallette (like "go to and play") you can right click and select view help for info on that action. If it is not available anymore you will not see anything(unless only recently deprecated).

I hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Pixl8r --

The previous errors disappeared but it still doesn't work. Thanks for the right+click tip and help though.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top