{ "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.
\nvar win = Ti.UI.currentWindow;
\nvar imageView = Titanium.UI.createImageView({
\nbackgroundColor: 'blue',\ntop:10,\nleft:10,\nwidth: 125,\nheight: 89
\n
\n}); win.add(imageView);
\nvar photoButton = Ti.UI.createButton({
\ntitle: 'Click me',\ntop: 135,\nleft: 10,\nwidth: 125,\nheight: 89,\nbackgroundColor:'blue',\nbackgroundImage: 'blah'
\n
\n}); win.add(photoButton);
\nphotoButton.addEventListener('click', function()
\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});