PDA

View Full Version : image button switch image?


splinterD
07-22-2011, 11:37 AM
hi guys
i recently tried this cool tut : click (http://www.scriptspot.com/3ds-max/tutorials/maxscript-image-button-bmp-layout)
and was very pleased
now i want to switch the image displayed in the button by another factor to a specific image
in the same file

lets say something like this :

on (or) if "something something" do (or) then
(
btn_test.images = (the spcific one i want lets say 2)
)

its not working very well right now and i cant figure it out

would really appreciate it if you guys can help

thanks !!

lo
07-22-2011, 12:22 PM
First of all, that tutorial example is not very efficient for reasons noted in this thread:
http://forums.cgsociety.org/showthread.php?f=98&t=993295

Secondly, you just need to redefine the .images property of the button to reflect the new indices you want. Can you post a sample of the code that is not working for you?

splinterD
07-22-2011, 12:55 PM
thanks rotem so this is what i have right now
the button is defined like this:
button btn498 "" pos:[417,422] width:10 height:10 images:#("FDtest_16i.bmp", undefined, 8, 1, 4, 1, 1) border:false

and what im trying is :
on btn498 pressed do
btn498.images = ("FDtest_16i.bmp",8, 2, 4, 1, 1)

im getting:
"
-- Error occurred in anonymous codeblock; filename: D:\volt\scripts\temp\tracking to face rig Beta 0.3.mcr; position: 8395; line: 238
-- Syntax error: at ),, expected <factor>
-- In line: btn498.images = ("FDtest_16i.bmp",8
"

denisT
07-22-2011, 01:06 PM
... and what im trying is :
on btn498 pressed do
btn498.images = #("FDtest_16i.bmp", undefined, 8, 2, 4, 1, 1)

im getting:
"
-- Error occurred in anonymous codeblock; filename: D:\volt\scripts\temp\tracking to face rig Beta 0.3.mcr; position: 8395; line: 238
-- Syntax error: at ),, expected <factor>
-- In line: btn498.images = ("FDtest_16i.bmp",8
"

the couple things were missed

splinterD
07-22-2011, 01:16 PM
so simple...
thanks denis , i guess ill go put a bag over my head now...
is there a fast way to explain y it didn't work ?
i get that there were missing those 2 things but ... y ?
thanks again!

lo
07-22-2011, 02:03 PM
the .images property expects a value of type array. And not any array, an array of this format:
#(bitmap,bitmap,int,int,int,int,int)

you were supplying it with this value:
(bitmap,int,int,int,int,int)

which is not even an array.

splinterD
07-22-2011, 02:05 PM
ok but is it the "right" or "officiant" way of using bitmaps in buttons
or dose it load the bitmap for each button every time like in the thread you gave me earlier ?

lo
07-22-2011, 02:34 PM
If you supply it with a filename value like in your example, then it will load it each time as far as I can tell.

If you supply it with an already loaded bitmap value, it will not need to reload it each time and will run faster.

i.e.:
mybitmap = openBitmap "C:\\mybmp.bmp"
mybutton.images = #(myBitmap,undefined,4,1,1,2,2)

Both methods will work. If you have many buttons, the latter method's efficiency will probably be noticable.

splinterD
07-22-2011, 07:00 PM
sweet thanks again

CGTalk Moderation
07-22-2011, 07:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.