Alloy.Globals.SliderDrawer =
{
ListFontSize: 16,
LineHeight : 34,
Center: { y: 17 },
Width: 180,
TextColor: 'white',
BackgroundColor: 'transparent',
BackgroundGradient: {
type: 'linear',
startPoint: { x: '100%', y: '50%' },
endPoint: { x: '0%', y: '50%' },
colors: [ { color: '#464646', offset: 0.0}, { color: '#343434', offset: 0.33 }, { color: '#2E2E2E', offset: 0.67 }, { color: '#383838', offset: 1.0 } ],
}
};
function putIfAbsent(item, key, value)
{
if (!(key in item))
item[key] = value;
else
value = item[key];
return value;
}
function doMenuButton(e)
{
Ti.API.info('doMenuButton(' + JSON.stringify(e) + ')');
var controller = Alloy.createController('sliderdrawer');
controller.initialize(Alloy.Globals.menuItems,
{
top: isIOS ? 20 : 0,
right: 0,
width: Alloy.Globals.SliderDrawer.Width,
backgroundGradient: Alloy.Globals.SliderDrawer.BackgroundGradient
},
{
right: 0,
width: Alloy.Globals.SliderDrawer.Width,
separatorColor: '#802E2E2E'
},
Alloy.Globals.SliderDrawer.Width, handleMenuEvent);
}
Alloy.Globals.SliderDrawer.ChatMenuItem = { template: 'withBadge', eventname: 'socialComments', iconTop: {text: '\uf086'}, option: {text: 'Chat'}, badge: {text: 0} };
function AddToSlideDrawerMenu(item)
{
putIfAbsent(item, 'template', 'noBottom');
putIfAbsent(item, 'properties', {});
putIfAbsent(item.properties, 'height', Alloy.Globals.SliderDrawer.LineHeight);
putIfAbsent(item.properties, 'backgroundColor', Alloy.Globals.SliderDrawer.BackgroundColor);
if ('option' in item)
putIfAbsent(item.option, 'color', Alloy.Globals.SliderDrawer.TextColor);
if ('iconTop' in item)
putIfAbsent(item.iconTop, 'color', Alloy.Globals.SliderDrawer.TextColor);
if ('iconBottom' in item)
putIfAbsent(item.iconBottom, 'color', Alloy.Globals.SliderDrawer.TextColor);
Alloy.Globals.menuItems.push(item);
}
Alloy.Globals.menuItems = [];
AddToSlideDrawerMenu({ eventname: 'scheduleTab', iconTop: {text: '\uf073'}, option: {text: 'Schedule'} });
AddToSlideDrawerMenu({ eventname: 'benchmarkTab', iconTop: {text: '\uf012'}, option: {text: 'Tracking'} });
AddToSlideDrawerMenu(Alloy.Globals.SliderDrawer.ChatMenuItem);
AddToSlideDrawerMenu({ eventname: 'profileTab', iconTop: {text: '\uf007'}, option: {text: 'Profile'} });
AddToSlideDrawerMenu({ template: 'template', eventname: 'goalsTab', iconBottom: {text: '\uf05b'}, iconTop: {text: '\uf140'}, option: {text: 'My Next Goal'} });
if (boxprefs.prefs.ONOFF_MEDALERT)
AddToSlideDrawerMenu({ eventname: 'injuryTab', iconTop: {text: '\uf0fa'}, option: {text: 'Injuries?'} });
if (boxprefs.prefs.SPLASHPAGEANNOUNCEMENT != "")
AddToSlideDrawerMenu({ eventname: 'splashpage', iconTop: {text: '\uf0a1'}, option: {text: 'Announcements'} });
AddToSlideDrawerMenu({ eventname: 'signOut', iconTop: {text: '\uf08b'}, option: {text: 'Sign out'} });
$.index.open();
5) Called the "doMenuButton" function by label event listener.
Now I am having the error, "Uncaught ReferenceError: boxprefs is not defined". Please provide a clear sample code for me to test the validity of the bug. Thanks.