Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3106] Adding a view to a view clears out vars. Weird glitch.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2012-07-26T16:58:21.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsn/a
Reporterpeterlevn
AssigneeNeeraj Gupta
Created2011-04-15T03:37:10.000+0000
Updated2012-07-26T20:02:52.000+0000

Description

Titanium 1.6, iPhone SDK 4.2
Done this 100 times and now it wont work. When i add view1 to container, i can't get the var "backer" from container.
Comment out: 'container.add(view1);' and it will work.


var win = Ti.UI.currentWindow;
 
 
// called on view click
onViewPress = function(e) {
    alert(e.source.backer + ' : cool');
};
 
// initialize container view 
var container = Ti.UI.createView({
    width:286,
    height:327,
    backgroundColor:'#000'
 
});
 
// add container to window
win.add(container);
 
// initialize view1 
var view1 = Ti.UI.createView({
    backgroundColor:'#fff',
        width:200,
    height:300
}); 
 
// add view1 to container
container.add(view1);
 
container.backer = 'back';
container.addEventListener('click', onViewPress);

Comments

  1. peterlevn 2011-04-15

    This needs to be addressed.

  2. Stephen Tramer 2012-07-26

    Cannot reproduce described issue, SDK 2.2.0.014b86f, iPhone Sim 5.1

JSON Source