Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1275] Cannot apply backgroundGradient via alloy.globals

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-11-04T17:14:15.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
LabelsTCSupportTriage
ReporterMichael Stelly
AssigneeMauro Parra-Miranda
Created2014-09-22T20:29:54.000+0000
Updated2016-03-08T07:37:40.000+0000

Description

Steps to Reproduce

Create a project Replace existing index.* and alloy.js files with those attached. Run project. If you comment out the Alloy.Globals reference in index.js, and use the setGradient() function with the supplied values, the correct result will display.

Actual Result

Blank page

Expected Result

Text label, center-screen, with red gradient background and white text 'Label'.

Attachments

FileDateSize
backgroundGradientFails.zip2014-09-22T20:31:09.000+00002123

Comments

  1. Michael Stelly 2014-09-22

    File upload fails when posting through Studio.
  2. Motiur Rahman 2014-09-25

    Hello, We tested this issue but we didn’t reproduce it. It works as expected in this testing environment and test case. It was some declaration problem. *Result:* Works as expected.

    Testing Environment:

    Titanium SDK: 3.4.0-rc Titanium CLI: 3.4.0-rc4, Alloy: 1.5.0-rc3 iOS SDK:8 OS X Version: 10.9.5, Appcelerator Studio: 3.4.0

    Steps to Test

    1. Create an alloy project. 2. Paste this code in alloy.js, index.xml and index.js file. 3. Runt this code with the testing environment.
       
       Alloy.Globals = {
       	offbutton : {
       		type : 'linear',
       		startPoint : {
       			x : '50%',
       			y : '0%'
       		},
       		endPoint : {
       			x : '50%',
       			y : '100%'
       		},
       		colors : [{
       			color : 'green',
       			offset : 0.0
       		}, {
       			color : 'blue',
       			offset : 0.75
       		}]
       
       	},
       	// onButton : '#c60b20',
       	onButton : {
       
       		type : 'linear',
       		startPoint : {
       			x : '50%',
       			y : '0%'
       		},
       		endPoint : {
       			x : '50%',
       			y : '100%'
       		},
       		colors : [{
       			color : '#c60b20',
       			offset : 0.0
       		}, {
       			color : '#7c0714',
       			offset : 0.75
       		}]
       
       	},
       };
       
       
       // $.test.backgroundGradient = Alloy.Globals.onButton;
       $.test.setBackgroundGradient(Alloy.Globals.offbutton);
       console.log('backgroundgradient = ' + JSON.stringify(Alloy.Globals.offbutton));
       
       $.index.open();
       
       
       <Alloy>
       	<Window class="container">
       	<Label id='test'/>
       	</Window>
       </Alloy>
       
    Thanks.
  3. Mauro Parra-Miranda 2014-11-04

    Please check previous comment with a fix.
  4. Michael Stelly 2014-11-04

    Your reply misses a key point. If I apply the property backgroundGradient in alloy.js, the background for the object is NOT set. Note the difference here. Your example has an object with the properties of backgroundGradient implied:
       	offbutton: {
       		type: 'linear',
       		startPoint: {
       			x: '50%',
       			y: '0%'
       		},
       		endPoint: {
       			x: '50%',
       			y: '100%'
       		},
       		colors: [{
       			color: 'green',
       			offset: 0.0
       		}, {
       			color: 'blue',
       			offset: 0.75
       		}]
       	},
       
    My example has the backgroundGradient property explicitly set:
       	offbutton: {
       		backgroundGradient: {
       			type: 'linear',
       			startPoint: {
       				x: '50%',
       				y: '0%'
       			},
       			endPoint: {
       				x: '50%',
       				y: '100%'
       			},
       			colors: [{
       				color: '#727272',
       				offset: 0.0
       			}, {
       				color: '#3e3e3e',
       				offset: 0.75
       			}]
       		}
       	},
       
    So, the problem remains. The backgroundGradient property, when applied to a global object does not work.

JSON Source