Multimedia
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsWeb DesignMultimedia

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old May 24th, 2005, 12:30 PM
Scooty Scooty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 80 Scooty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 58 m 43 sec
Reputation Power: 4
Question ActionScript Help

I use the following code to make a particular scene in a movie play random frames and it works fine, but I was wondering if it is possible to make it so once a frame is selected it will not be selected again unless the scene is accessed again or maybe all the frames are done. Thanks.

Code:
//generate a random number from 1 to 157
   var nRandom = 1 + Math.floor(Math.random()*157);
   
// tell timeline to goto and play the random number 'nRandom'
   gotoAndstop(nRandom);
home_btn.onRelease = function() {
 gotoAndplay("Scene1", 1);
}

Reply With Quote
  #2  
Old May 24th, 2005, 10:51 PM
Lafinboy's Avatar
Lafinboy Lafinboy is offline
The Laughing Moderator
ASP Free Loyal (3000 - 3499 posts)
 
Join Date: Apr 2004
Location: Sydney, Australia
Posts: 3,263 Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)Lafinboy User rank is Sergeant (500 - 2000 Reputation Level)  Folding Points: 29199 Folding Title: Starter FolderFolding Points: 29199 Folding Title: Starter Folder
Time spent in forums: 2 Weeks 1 Day 10 h 35 m 51 sec
Reputation Power: 15
Send a message via ICQ to Lafinboy Send a message via AIM to Lafinboy Send a message via MSN to Lafinboy Send a message via Yahoo to Lafinboy Send a message via Skype to Lafinboy
The theory would be to store the generated random numbers in an array. That way you can build a loop to check if the generated number is in the array. If it is then go back and generate a new number, if it isn't then add the new number to the array and play that frame. You would need to test the length of the array so that if it was full (had 157-1 records) then the code would empty the array so that the process could start again.

Reply With Quote
  #3  
Old May 25th, 2005, 10:47 AM
Scooty Scooty is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 80 Scooty User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 58 m 43 sec
Reputation Power: 4
Wow. I will research that. Can you give me a start. I am not a professional programmer. Thanks again though



Quote:
Originally Posted by Lafinboy
The theory would be to store the generated random numbers in an array. That way you can build a loop to check if the generated number is in the array. If it is then go back and generate a new number, if it isn't then add the new number to the array and play that frame. You would need to test the length of the array so that if it was full (had 157-1 records) then the code would empty the array so that the process could start again.

Reply With Quote
Reply

Viewing: ASP Free ForumsWeb DesignMultimedia > ActionScript Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway