[Closed] image button switch image?
hi guys
i recently tried this cool tut : click
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 !!
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?
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 emp racking to face rig Beta 0.3.mcr; position: 8395; line: 238
– Syntax error: at ), expected <factor>
– In line: btn498.images = (“FDtest_16i.bmp”,8
“
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!
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 ?
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.