| Posted: 16 May 2009 19:34 | |
|
Registered User Currently Offline |
Posts: 8 Join Date: May 2009 |
|
Hi,
i'd like to create a png button and i want the png to change when the mouse passes over and/or press the button. The idea is to mimic the actual AE toolbars. |
|
| Posted: 17 May 2009 15:06 Last Edited By: admin | |
|
Administrator |
Posts: 16 Join Date: May 2009 |
|
In order to make a rollover button it is important to understand the ScriptUIImage object.
All elements that contain an image(iconbutton, image), retain their image info in this object. The ScriptUIImage object cannot be modified as all its properties are read only, it can only be created new with ScriptUI.newImage() function which returns a new ScriptUIImage object. The newImage function has 4 parameters this is the text from the ExtendScript OMV (slightly modified) Loads a new image from resources or disk files into an image object. Quote:
Creates a new ScriptUIImage object for use in controls that can display images(iconbutton, image), loading the associated images from the specified image files. The 4 parameters are (normal: Data Type: String , disabled (optional): Data Type: String , pressed (optional): Data Type: String , rollover (optional): Data Type: String) normal=The disk file path to the image used for the normal state. disabled=The disk file path to the image used for the disabled state. pressed=The file path to the image used for the pressed state. rollover=The file path to the image used for the rollover state. So basicly if you want ok.png for the regular pic ok_rollover.png for the rollover pic, ok_pressed.png for the pressed pic then the code for that ScriptUIImage object would be Code:
ScriptUI.newImage('C:\\ok.png',undefined,'C://ok_pressed.png,'C://ok_rollover.png'); However for some reason it seems that the image could only be set in the constructor of the object so the correct code would be Code:
myButton = dlg.add('iconbutton',undefined,ScriptUI.newImage('C:\\ok.png',undefined,'C://ok_pressed.png,'C://ok_rollover.png')); To see a working sample download here. |
|
| Posted: 19 May 2009 12:02 | |
|
Registered User Currently Offline |
Posts: 8 Join Date: May 2009 |
|
Thanks a lot.
I don't know why Adobe didn(t documented better the ScriptUI language. |
|