UISLIDER problem

Discussion in 'Jiggy Runtime Development' started by The Ax, Jun 9, 2008.

  1. The Ax

    The Ax Banned

    Joined:
    Mar 11, 2008
    Messages:
    647
    Likes Received:
    22
    whats wrong with this?

    it only works for 0 , 8 and 16

    sc = new UISliderControl( [ 10 , 320 , 300 , 48 ] );

    sc.setMinValue( 0 );
    sc.setMaxValue( 16 );
    sc.setNumberOfTickMarks( 16 )
    sc.setAllowsTickMarkValuesOnly( true )
    sc.onValueChanged = function( value ){
    if (value == 0){
    Mychr.setBackground( new Image( "f4c0.gif" ), 0);
    }
    if (value == 1 ){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 2 ){
    Mychr.setBackground( new Image( "f4c2.gif" ), 0);
    }
    if (value == 3){
    Mychr.setBackground( new Image( "f4c3.gif" ), 0);
    }
    if (value == 4){
    Mychr.setBackground( new Image( "f4c4.gif" ), 0);
    }
    if (value == 5){
    Mychr.setBackground( new Image( "f4c5.gif" ), 0);
    }
    if (value == 6){
    Mychr.setBackground( new Image( "f4c6.gif" ), 0);
    }
    if (value == 7){
    Mychr.setBackground( new Image( "f4c7.gif" ), 0);
    }
    if (value == 8){
    Mychr.setBackground( new Image( "f4c8.gif" ), 0);
    }
    if (value == 9){
    Mychr.setBackground( new Image( "f4c9.gif" ), 0);
    }
    if (value == 10){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 11){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 12){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 13){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 14){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 15){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    if (value == 16){
    Mychr.setBackground( new Image( "f4c1.gif" ), 0);
    }
    }

    secondView.addSubview( sc );
  2. The Ax

    The Ax Banned

    Joined:
    Mar 11, 2008
    Messages:
    647
    Likes Received:
    22
    NVM
    those are just uncommon values between 0-16

    1.0685920715332031 works lol
  3. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    I havent used the Slider yet (need to tho) but from a quick look at your code i think it might be because of your values...
    sc.setMinValue( 0 );
    sc.setMaxValue( 16 );
    sc.setNumberOfTickMarks( 16 )
    ..you set the number of ticks to 16 but your values have a range of 17...0-16...think you might have forgot the 0 (done that enough times myself)
  4. The Ax

    The Ax Banned

    Joined:
    Mar 11, 2008
    Messages:
    647
    Likes Received:
    22
    ty,
    that helped a good bit

Share This Page