Scope? Animate working on Android but not iOS

You must Login before you can answer or comment on any questions.

Okay, below is one small section of one of my views. Where I do the animate in the lower code (infoWindow.animate) it works correctly on Android. but when I run it on the iPhone, nothing happens. I think it has to do with scope... Can someone help me figure this out?

//MainView Component Constructor
function InductionLengthView() {
    var self = Ti.UI.createScrollView({
        contentWidth:'auto',
            contentHeight:'auto',
            showVerticalScrollIndicator:true,
            showHorizontalScrollIndicator:false
    });
 
    /*
     * START UI ITEMS
    */
 
    var applicationNameLabel = Ti.UI.createLabel({
        top:'14dp',
        color:'#FFFFFF',
        font:{
                fontSize:'16sp'  
            },
        text:L('app_name'),
        height:'22dp',
        width:'auto'
    });
    self.add(applicationNameLabel);
 
    var inductionLength20View = Ti.UI.createView({
        top:'134dp',
        width:'310dp',
        height:'67dp'
    });
 
    var inductionLength20Button = Ti.UI.createButton({
        backgroundImage: Ti.Filesystem.resourcesDirectory + 'images/blue_box.png',
        font:{
            fontWeight:'bold',
            fontSize:'16sp'
        },
        title:L('induction_length_20'),
        height:'67dp',
        width:'310dp'
    });
 
    var infoTop = '44dp';
    var infoLeft = '287dp';
 
    var inductionLengthInfo20Button = Ti.UI.createButton({
        backgroundImage: Ti.Filesystem.resourcesDirectory + 'images/info.png',
        top:infoTop,
        left:infoLeft,
        title:'',
        height:'20dp',
        width:'20dp'
    });
    inductionLength20View.add(inductionLength20Button);
    inductionLength20View.add(inductionLengthInfo20Button);
    self.add(inductionLength20View);
 
 
    var infoWindow = Ti.UI.createView({
        backgroundColor:'#336699',
        borderWidth:2,
        borderColor:'#999999',
        height:'467dp',
        width:'267dp',
        borderRadius:10,
        opacity:0.90
    });
    self.add(infoWindow);
 
    var infoLabel = Ti.UI.createLabel({
        top:'7dp',
        width:'254dp',
        color:'#FFFFFF',
        font:{
            fontSize:'16sp'
        }
    });
    infoWindow.add(infoLabel);
 
    var infoCloseLabel = Ti.UI.createLabel({
        bottom:'17dp',
        color:'#FF0000',
        text:L('click_to_close'),
        font:{
            fontWeight:'bold',
            fontSize:'16sp'
        }
    });
    infoWindow.add(infoCloseLabel);
 
    var infoWindowAnimationOpen = Ti.UI.createAnimation();
    infoWindowAnimationOpen.height = common.DPUnitsToPixels(467);
        infoWindowAnimationOpen.width = common.DPUnitsToPixels(267);
    infoWindowAnimationOpen.duration = 100;
 
    var infoWindowAnimationClose = Ti.UI.createAnimation();
    infoWindowAnimationClose.height = 0;
        infoWindowAnimationClose.width = 0;
    infoWindowAnimationClose.duration = 100;
 
    /*
     * END UI ITEMS
    */
 
    /*
     * START UI ACTIONS
     */
 
    infoWindow.addEventListener('click',function(e) {
        infoWindow.animate(infoWindowAnimationClose);
        infoLabel.text = '';
    });
 
    inductionLengthInfo20Button.addEventListener('click',function(e) {
        infoLabel.text = L('induction_length_20_info');
        infoWindow.animate(infoWindowAnimationOpen);
    });
 
    /*
     * END UI ACTIONS
     */
 
    return self;
}
 
module.exports = InductionLengthView;

— asked 1 year ago by Joshua Wegener
4 Comments
  • hum actually it maybe to do with the dp added for android.. animation is doing a calculation so on iPhone its not a number. to go from.

    Without testing this it is only a theory.

    — commented 1 year ago by Trevor Ward

  • I can try and switch the animation to like a fade in.....

    — commented 1 year ago by Joshua Wegener

  • that could work....

    — commented 1 year ago by Trevor Ward

  • Show 1 more comment

Your Answer

Think you can help? Login to answer this question!