{ "id": "61735", "key": "TIMOB-1103", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11258", "description": "Holding Pen for Triaged Issues", "name": "Backlog", "archived": false, "released": false } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-10-28T12:36:52.000+0000", "created": "2011-04-15T02:44:05.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "button", "defect", "dynamic", "image", "ios", "iphone" ], "versions": [], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-10-28T12:36:52.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}

A customer has been trying to set either the image or the\nbackgroundImage of a button with an image downloaded from a site.\nThe following code shows this bug.

\n

var win = Ti.UI.currentWindow;

\n

var imageView = Titanium.UI.createImageView({

\n
\nbackgroundColor: 'blue',\ntop:10,\nleft:10,\nwidth: 125,\nheight: 89\n
\n

}); win.add(imageView);

\n

var photoButton = Ti.UI.createButton({

\n
\ntitle: 'Click me',\ntop: 135,\nleft: 10,\nwidth: 125,\nheight: 89,\nbackgroundColor:'blue',\nbackgroundImage: 'blah'\n
\n

}); win.add(photoButton);

\n

photoButton.addEventListener('click', function()
\n{

\n
\nimageView.backgroundColor = photoButton.backgroundColor = 'red';\nc = Titanium.Network.createHTTPClient();\nc.onload = function() {\n    var f = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'photo.jpg');\n    Ti.API.info('Writing to:'+f);\n    f.write(this.responseData);\n    imageView.backgroundColor = photoButton.backgroundColor = 'green';\n    //imageView.image = f;\n    photoButton.backgroundImage = f;\n    //imageView.image = photoButton.image = 'KS_nav_views.png'; // !!! QUESTION: why does cause a crash?\n};\nc.ondatastream = function(e) {\n    ind.value = e.progress ;\n    Ti.API.info('ONDATASTREAM2 - PROGRESS: ' + e.progress);\n};\nc.open('GET', 'http://www.appcelerator.com/wp-content/uploads/2009/06/titanium_desk.png');\nc.send();\n
\n

});

{html}", "attachment": [], "flagged": false, "summary": "Setting a button image dynamically", "creator": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "ctredway1", "key": "ctredway1", "displayName": "ctredway", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "170785", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Bug is not valid, does not reproduce in: \r\nTiMOB sdk version: 1.8.0.v20111027152620 \r\nStudio version: 1.0.6.201110251616\r\nOS version: Mac OS X Lion\r\nDevices tested on: iphone emulator, iphone 5.0, ipad2 4.3.5", "updateAuthor": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2011-10-28T12:34:20.000+0000", "updated": "2011-10-28T12:34:20.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }