Hi Duncan I already make this two functions and works well but I have to convert to string de value of the color and get the r,g,b´s values with the substring function. Seein your example its better because make the operations directly, but (as you can see in my code)I dont know how to work with hexadecimal values. Could you explain the next lines of code? or tell me where could I read a tutorial about progaming hex operations in AS. tnx a lot :)
var c1 = {r:(c1 & 0xFF0000) >> 16, g:(c1 & 0x00FF00) >> 8, b:c1 & 0x0000FF}; var c2 = {r:(c2 & 0xFF0000) >> 16, g:(c2 & 0x00FF00) >> 8, b:c2 & 0x0000FF}; var r = (c2.r-c1.r)/(n-1); var g = (c2.g-c1.g)/(n-1); var b = (c2.b-c1.b)/(n-1); /*My functions*/ function sacaPasos(etapas,val):Array { etapas = etapas/2 var tI:Number = 0; var tS:Number = 255; var arreI:Array = new Array(); var arreS:Array = new Array(); var factI:Number = Math.floor((val-tI)/etapas); var factS:Number = Math.floor((tS-val)/etapas); for (var pa = 1; pa<= etapas-1;pa++) { arreI.push(factI*pa); arreS.push(val+(factS*pa)) } var arreRegresa = arreI.concat(arreS) return (arreRegresa); } function aplicaPasos(colBase:String):Void { var R = parseInt("0x"+colBase.substring(2,4)); var G = parseInt("0x"+colBase.substring(4,6)); var B = parseInt("0x"+colBase.substring(6,8)); var rA:Array = sacaPasos(p,R); var gA:Array = sacaPasos(p,G); var bA:Array = sacaPasos(p,B); var cade; for (var apl= 0; apl<= rA.length-1; apl++) { var aplColor:Color = new Color("step"+(apl+1)+"_mc"); var st = "0x"; cade = Number(rA[apl]); st+= (cade.toString(16).toUpperCase().length== 1) ? "0"+(cade.toString(16).toUpperCase()) : (cade.toString(16).toUpperCase()); cade = Number(gA[apl]); st+= (cade.toString(16).toUpperCase().length== 1) ? "0"+(cade.toString(16).toUpperCase()) : (cade.toString(16).toUpperCase()) cade = Number(bA[apl]); st+= (cade.toString(16).toUpperCase().length== 1) ? "0"+(cade.toString(16).toUpperCase()) : (cade.toString(16).toUpperCase()); aplColor.setRGB(st); _contene["step"+(apl+1)+"_mc"].col = st; } } aplicaPasos("#C0C0C0"); Ing. Juan Anzaldo Tel Cel. 614 427-6523 Blog : http://janzaldo.blogspot.com __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com