-------------------------------------------------------------------------------------------------------------------------
RANDOM COUNTER NO REPEAT AS2 AS3 SHOT CODE
OR USE THIS CODE AS2
OR USE THIS CODE FOR AS3
JUST CHANGE BUTTON FUNTION
Bn1.addEventListener(MouseEvent.CLICK,Fn1);
function Fn1(event:MouseEvent):void{
IT SHOWS 10 DIGITS
IT SHOWS 1 TO 10 DIGITS RANDOMLY
NEED CHANGE THIS LINE: var FillArray =[1,2,3,4,5,6,7,8,9,10];
5,2,10,8,7,9,1,6,3,4
NEED CHANGE THIS LINE var FrameNo = FillArray[Num2]+2;
var FrameNo = FillArray[Num2];
-------------------------------------------------------------------------------------------------------------------------
READMORE:
http://flashcollege.blogspot.co.uk/2016/04/random-frame-no-repeat-as2.html
-------------------------------------------------------------------------------------------------------------------------
var FillArray =[1,2,3,4,5,6,7,8,9,10];
function RandomNumberAs2(){
var Num1 = FillArray.length;
var Num2 = random(Num1);
var FrameNo = FillArray[Num2];
FillArray.splice(Num2,1);
trace(FrameNo);
Txt1.text =(FrameNo);
}
RandomNumberAs2();
Bn1.onPress = function (){
RandomNumberAs2();
}
Bn2.onPress = function (){
RandomNumberAs2();
}
Bn3.onPress = function (){
RandomNumberAs2();
}
Bn4.onPress = function (){
RandomNumberAs2();
}
Bn5.onPress = function (){
RandomNumberAs2();
}
Bn6.onPress = function (){
RandomNumberAs2();
}
Bn7.onPress = function (){
RandomNumberAs2();
}
Bn8.onPress = function (){
RandomNumberAs2();
}
Bn9.onPress = function (){
RandomNumberAs2();
}
-------------------------------------------------------------------------------------------------------------------------
RANDOM COUNTER NO REPEAT WITH SPLICE AS2 AS3 CODE
-------------------------------------------------------------------------------------------------------------------------
//AS2 CODE
var FillArray =[1,2,3,4,5,6,7,8,9,10];
Bn1.onPress = function (){
var Num1 = FillArray.length;
var Num2 = Math.floor(Math.random() * Num1);
var FrameNo = FillArray[Num2]
FillArray.splice(Num2,1);
trace(FrameNo);
Txt1.text =(FrameNo);
}
//AS3CODE
var FillArray =[1,2,3,4,5,6,7,8,9,10];
Bn1.addEventListener(MouseEvent.CLICK,Fn1);
function Fn1(event:MouseEvent):void{
var Num1 = FillArray.length;
var Num2 = Math.floor(Math.random() * Num1);
var FrameNo = FillArray[Num2]
FillArray.splice(Num2,1);
trace(FrameNo);
Txt1.appendText([FrameNo]+", ")
}
-------------------------------------------------------------------------------------------------------------------------
EXPORT BY JS FLASH TOOL KIT IMAGES
window>ToolkitforCreatJs
-------------------------------------------------------------------------------------------------------------------------
EmoticonEmoticon