AnsweredAssumed Answered

custom widget for ArcGIS Online Development Related question

Question asked by awetab on Dec 22, 2016
Latest reply on Dec 27, 2016 by rscheitlin

Hello all,let me post my partial code in which I have difficulty to figure out its solution: I have a button with "FadeIn" id and I want to call the FadeInPrimaryOpacity(op) function for each value of i repeatedly till the limit value of i is reached after the FadeIn button is pressed.so,is there any wrong with my code

postCreate: function() {
registry.byId("FadeIn").on("click", lang.hitch(this, this.PrimaryLayer_Visibility));

},

PrimaryLayer_Visibility:function () {

// don't worry about "this.primaryLayer" since this is partial code of the whole code
if (this.primaryLayer.visible) {
for(var i=0;i<=10;i++)
setTimeout(function(){
FadeInPrimaryOpacity(i/10.0);
},2000);
} else {
for(var i=10;i>=0;i--){
setTimeout(function(){
FadeInPrimaryOpacity(i/10.0);
},2000);
}
}
} ,
FadeInPrimaryOpacity:function(op) {
this.primaryLayer.setOpacity(op);
},

Outcomes