image button switch image?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 07 July 2011   #1
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 !!
 
Old 07 July 2011   #2
First of all, that tutorial example is not very efficient for reasons noted in this thread:
http://forums.cgsociety.org/showthr...p?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?
 
Old 07 July 2011   #3
thanks rotem

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
"
 
Old 07 July 2011   #4
Originally Posted by splinterD: ... 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
 
Old 07 July 2011   #5
so simple

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!
 
Old 07 July 2011   #6
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.
 
Old 07 July 2011   #7
ok

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 ?
 
Old 07 July 2011   #8
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.
 
Old 07 July 2011   #9
sweet

sweet thanks again
 
Old 07 July 2011   #10
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:19 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.