سؤال

Current situation: i build a module containing with a view containing a button and two views:

  function moreButtonView(){
var self=Ti.UI.createView({
    height:350,
    top:-322,
    width:Ti.UI.FILL

});
var info=Ti.UI.createView({
    height:322,
    width:Ti.UI.FILL,
    top:0,
    backgroundColor:'#bbbbbb'

});
var infoShadow=Ti.UI.createView({
    height:322,
    width:Ti.UI.FILL,
    top:3,
    backgroundColor:'#000000',
    opacity:0.3

});

var btn= Ti.UI.createButton({
    backgroundImage:'/images/controls/pulldown_btn.png',
    bottom:0,
    left:10,
    height:28,
    width:49
})
self.add(infoShadow);
self.add(info);

self.add(btn);

Ti.API.info('bg-pulldow= '+ self.getBackgroundImage());
return self;
}
module.exports=moreButtonView;

after including it into the app.js i added an eventhandler to app.js that animates a sliding out or in of that view. now, on the press of the button the view gets animated and slides in from top. works.

but how can i access the opacity of 'infoshadow'?

I'm not that fluent in javascript (yet), would be nice if someone could explain it to me.

Thanks, Jan

هل كانت مفيدة؟

المحلول

In your commonjs module:

self.setShadowOpacity = function(opacity){
     infoShadow.opacity = opacity;
};

in your app.js

instanceNameOfYourModule.setShadowOpacity(0.5);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top