-
Quick Help on Random
I have three (say) button actions
(1) on (release) {
_root.eck.jimmye._visible = false ;
_root.leg.jimmyl._visible = false ;
_root.murr1.jimmym._visible = false ;
)
(2) on (release) {
_root.leg.blul._visible = false ;
_root.eck.bluc._visible = false ;
_root.leg.irishl._visible = false;
)
(3) on (release) {
_root.eck.jimmye._visible = false ;
_root.leg.jimmyl._visible = false ;
)
Is there any way, on pressing one button that one of above actions are executed randomly.
any help appreciated!
-
FK'n_dog
in this example -
clipA has nested clips - a1, a2, a3
clipB has nested clips - b1, b2, b3
clipC has nested clips - c1, c2, c3, c4, c5
you need to put the clip names into an array and select a random clip
Code:
tgt = this;
arr = [['clipA','a1','a2','a3'],
['clipB','b1','b2','b3'],
['clipC','c1','c2','c3','c4','c5']];
function randVisible(){
N1 = arr.length;
rN1 = random(N1);
N2 = arr[rN1].length;
rN2 = random(N2);
rN2 == 0 ? rN2++ : null;
trace(this[arr[rN1][0]][arr[rN1][rN2]]);
tgt[arr[rN1][0]][arr[rN1][rN2]]._visible = false;
};
btn.onPress = function(){
tgt[arr[rN1][0]][arr[rN1][rN2]]._visible = true; //reset
}
btn.onRelease = function(){
randVisible();
}
-
thanks - I'll have go at it, although I was trying to avoid arrays! tks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|