Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

question for a brain

$
0
0

Hi All,

 

I'm broken my head on this problem:

This script present the problem, random are unknow value (we don't know in advance the length)

var ressource="dialog { text: 'titleBox'}";

 var dlg=new Window(ressource);
 dlg.btnCANCEL=dlg.add('button',undefined,'Cancel',{name:'cancel'});
 for (j=1;j<Math.round(7*Math.random(1))+2;j++){
 dlg.['pan'+j]=dlg.add('panel',undefined,'Randomize',{name:'rnd'});
 dlg.['pan'+j].orientation='row';
dlg.['pan'+j].btnRND=dlg.['pan'+j].add('button',undefined,'Randomize',{name:'rnd'});
dlg.['pan'+j].btnRND.onClick = function (){     this.parent.[j].text=Math.round(100*Math.random(1));     }  for (i=1;i<Math.round(10*Math.random(1))+2;i++){       var rnd=Math.round(100*Math.random(1));
dlg.['pan'+j].[i]=dlg.['pan'+j].add('edittext',undefined,rnd);
}

}
dlg.show();

rnd.jpg

I need to randomize each line when i push "randomize" button. As you can see, only 'textedit' shield value is changed by the last value of [i].

because onClick function (when i press button)  is executed after for(i) is terminated. so i = Math.round(10*Math.random(1))+2...

 

Here my real question, how i can attribute each button to each element of his list ??

So.. let's me know all your suggestions / ideas

I hope that i was clary, if not, feel free to ask me (here or PM)

Thanks to all peoples who takse a bit of time to read and reply at all post of this forums

 

 

art.chrome


Viewing all articles
Browse latest Browse all 12845

Trending Articles