A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Color picker, don't work...

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    12

    Color picker, don't work...

    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 :
    Code:
    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]);
    	
      }
    }

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Take a look at the example koolmoves/examples/flash8/colorslider or something like that.

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    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

  4. #4
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    Something like this ?
    Code:
    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]);
    }

  5. #5
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    Yes excellent, Very good
    But you create MYmc and i want to color the objet "wall". "Wall" is a shade.
    Have an idear ?

  6. #6
    Junior Member
    Join Date
    Apr 2007
    Posts
    12
    My error : color direct to shape dont work, but if i copy on a movie....

    GREAT !!
    Thank you !!!
    Prefectly

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center