Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Using the current window with an animation

$
0
0

Hello All,

Thank you for your time and and help! I have created a sliding view and I am trying to animate the current view/window to flip to a new view. The problem is I am unable to use the current view/window with animate. I am getting this error message, "Uncaught TypeError: Cannont call method 'animate' of null. I'm assuming animate. I feel I am not properly using currentWindow. Does anyone have experience with this? Here is the code I have so far:

var win = Ti.UI.createWindow();
 
var view1 = Ti.UI.createView({ backgroundColor:'#123' });
var view2 = Ti.UI.createView({ backgroundColor:'#246' });
var view3 = Ti.UI.createView({ backgroundColor:'#48b' });
var view4 = Ti.UI.createView({ backgroundCOlor:'#DC6900'});
 
var anim_minimize = Titanium.UI.createAnimation({width:0,duration:500});
var anim_maximize = Titanium.UI.createAnimation({width:320,duration:500});
 
var button = Titanium.UI.createButton({
   title: 'FLIP',
   top: 10,
   width: 100,
   height: 50
});
button.addEventListener('click',function(e)
{
 
//The problem is bellow, how do I call the current window or current view here?
 Ti.UI.currentWindow.animate(anim_minimize);
 setTimeout(function(){
 Ti.UI.currentWindow.animate(anim_maximize); },
 500);
 
 var win=Alloy.createController('mycoolwindow').getView();
 win.open();
});
 
var scrollableView = Ti.UI.createScrollableView({
 views:[view1,view2,view3,view4],
  showPagingControl:true
});
 
win.add(scrollableView);
win.add(button);
win.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>