;

PDA

Click to See Complete Forum and Search --> : Color picker, don't work...


infocie
04-27-2007, 12:49 PM
Hello, I have a problem for creat a color picker in koolmoves. I use an example of Koolmoves for creat my color picker but dont work. The action script work for "listbox", but how to change the color of my shape name : wall.
Help me please.

The action script :

stage.scaleMode = "noScale";
stage.align = "tl";

listbox.setSelectedIndex(0);


CreateKListBox("styling",4,{'_x':350,'_y':50,width:110,rowcount:3});
styling.addItem("Background", "background" );
styling.setSelectedIndex(0);
styling.onChange = function(){
var t = listbox1.getStyleProperty(styling.getValue());
t = '00000'+t.toString(16);
_root.ccode.text='( 0x'+t.substr(-6)+' )';
_root.ccode.text="test";
}


createEmptyMovieClip("colors",5);
colors._x=470;
colors._y=50;
colors.__proto__ = KComponent.prototype;
colors.c = new Array();
for (b=0;b<4;b++){
for (g=0;g<8;g++){
for (r=0;r<8;r++){
x = Math.floor(b/2)*8+r;
y = (b % 2)*8+g;
c = 65536*Math.round(r*255/7)+256*Math.round(g*255/7)+b*85;
colors.kDrawBoxFilled(x*6,y*6,x*6+6,y*6+6,c);
colors.c[x*16+y]=c;
}
}
}


colors.onPress = function(){
var p=new Object();
p.x=_root._xmouse;
p.y=_root._ymouse;
this.globalToLocal(p);
var x = Math.floor(p.x/6);
var y = Math.floor(p.y/6);
var s = _root.styling.getValue();
if (s.length>1) {
listbox.setStyleProperty(s,this.c[x*16+y]);

}
}





http://infocie.free.fr/Scripts cool/colorpicker.jpg

blanius
04-27-2007, 01:15 PM
Take a look at the example koolmoves/examples/flash8/colorslider or something like that.

infocie
04-27-2007, 03:02 PM
It's different, the script use color matrix whith R V B panel.

maybe (dont work)

var s = _root.wall.getValue();
if (s.length>1) {
wall.setStyleProperty(s,this.c[x*16+y]);

Help me, please :cool:

w.brants
04-27-2007, 03:32 PM
Something like this ?
createEmptyMovieClip('myMC',1);
myMC.beginFill(0);
myMC.moveTo(20,20);
myMC.lineTo(60,60);
myMC.lineTo(20,60);
myMC.endFill();

myMC_Color = new Color(myMC);

createEmptyMovieClip('colors',2);

colors._x = 470;
colors._y = 50;
colors.c = new Array();
for (b=0;b<4;b++){
for (g=0;g<8;g++){
for (r=0;r<8;r++){
x = Math.floor(b/2)*8+r;
y = (b % 2)*8+g;
c = 65536*Math.round(r*255/7)+256*Math.round(g*255/7)+b*85;
colors.beginFill(c);
colors.moveTo(x*6,y*6);
colors.lineTo(x*6+6,y*6);
colors.lineTo(x*6+6,y*6+6);
colors.lineTo(x*6,y*6+6);
colors.endFill();
colors.c[x*16+y]=c;
}
}
}

colors.onPress = function(){
var p = new Object();
p.x=_root._xmouse;
p.y=_root._ymouse;
this.globalToLocal(p);
var x = Math.floor(p.x/6);
var y = Math.floor(p.y/6);
myMC_Color.setRGB(this.c[x*16+y]);
}

infocie
04-27-2007, 04:28 PM
:thumbsup: Yes excellent, Very good :thumbsup:
But you create MYmc and i want to color the objet "wall". "Wall" is a shade.
Have an idear ?

infocie
04-27-2007, 04:47 PM
My error : color direct to shape dont work, but if i copy on a movie....

GREAT !!
Thank you !!!
Prefectly