Hi vina!
Check out http://www.w3schools.com/jsref/dom_obj_style.asp for more info on styling.
Since Hype API does not have “color” (which refers to text) in its “Get~Set” vocabulary we need to use a different approach. The code below still assumes what ever element gets assigned the event handler is the target. If You also wanted to change another element’s text then You would need to spec the ID for that element (in Hype’s “Identity Inspector”) - such as a red text box = ID of “redBox”:
Initialize the global variable “redBoxText” - called by “On Scene Load” handler:
function sceneVariables(hypeDocument, element, event) {
redBoxText = hypeDocument.getElementById('redBox');
// created a global variable named "redBoxText"
}
Called by the "On Mouse Over" handler...
function scaleDown(hypeDocument, element, event) {
hypeDocument.setElementProperty(element, 'scaleX', .75, 0.5, 'easein')
hypeDocument.setElementProperty(element, 'scaleY', .75, 0.5, 'easein')
element.style.color = "#FFEBA3"; // affects text, if any, in the element
redBoxText.style.color = "#FFEBA3";
// set text color to "yellow" (hexadecimal value)
}
Called by the "On Mouse Out" handler
function scaleUp(hypeDocument, element, event) {
hypeDocument.setElementProperty(element, 'scaleX', 1.0, 0.5, 'easeout')
hypeDocument.setElementProperty(element, 'scaleY', 1.0, 0.5, 'easeout')
element.style.color = "black"; // affects text, if any, in the element
redBoxText.style.color = "#000000";
// set the red box's text color to "black" (hexadecimal value)
}
Example File: ScaleDemo_v2.hype.zip (18.5 KB)