I've been playing around with this little ditty and I'm stuck. My problem is the loop in the @slider section. As written, if I move the slider the value of scale is recalculated. If I click the graphic button the slider moves but scale is not recalculated. If I move the loop to the @block section everything works like I'd expect. What am I missing here? Code:
Well that certainly explains it. Not the behavior I expected (obviously) but I suppose there's a reason for it. I guess I need to sit back and ponder my strategy a bit. Thanks for the info.
I think I have my code sorted out but now I've hit another road block. Is it possible to modify this in some way to allow it to be included with an import statement? Code:
--------------------- 19" HRE 543, Remus Exhaust w/Res Delete, GruppeM CAI, M5 Front Bumper, Xenon Angel Eyes
As far as I know sliders, filenames etc cannot be imported. I tend to try things out as an "in-line" function first to debug them, just like you have done with the switch() function. When all is OK, you can move the functions into an @init section in a jsfx-inc file. I would add variables for the File numbers in the JS FX: BTN_OFF = 0; BTN_ON = 1; BTN_BG = 2; and use them in the code Most of that gfx section can be made into a function - I would probably use the parameters for the file numbers for flexibility. And there are many variables there that can be made local, to hide them from the main code.
Thanks for the feedback DarkStar. I did as you suggested and changed the graphics section to a function with local variables. When I use this function inline everything works great, however, when I move the function to a jsfx-inc file I get no graphics display. I commented out the local statement in the function to look at the variables and the inline version looks OK but the import version are all 0. I'm guessing but it looks like the function in the jsfx-inc file is unaware of the .png files. I'll mess around with it some more but I think I may just be trying to do something JS isn't built to do. It's a shame though, it seems like it would really make doing graphics a lot cleaner. Anyway, thanks again for your suggestions. If nothing else I got a little bit closer to finally understanding the local vs. instance thing.
--------------------- 2001 Saphire Black M Coupe IE Subframe Bushings, UUC TME Reds, Goodridge SS Brake lines, UUC SS Clutch line, Sport Mode, Strong Strut STB, Toyo T1-R (street) 235/255 Toyo RA-1 (track) 255^2 , Eisenman 76mm Sport Exhaust, TCK D/A 450/500#,TCK CP, 3.46
You have to keep the filename definitions in the main JS FX file, not put them in the jsfx-inc file (No, I don't like it either). I move a lot of gfx handling out into a function library file.
Well this is embarrassing. The two files I was using to test with were in different directories. The import version was unaware of the .png files because I didn't tell it where in the hell they were. Lesson learned.
--------------------- Estoril/Modena '97 M3...sold for the second time. ------------------------------------ You only live once, and I'm running out of time...
I was trying to come up with a more compact way to display multiple on/off switches. Now I can control up to 16 sliders in the vertical space that 2-3 'regular' sliders would take. I didn't really intend to control it with a slider but the fact that it works with one opens a lot of other possibilities. If my Knobman skills didn't suck so bad I'd put numbers on the buttons and maybe some kind of lighting effect.