Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label inside of input box, fades to transparent 1

Status
Not open for further replies.

Niv3k

Programmer
Jul 11, 2001
350
US
At they have a really nice effect with the credit card info where it looks like so:
Code:
+--------+
| label  |
+--------+
And when you put any text inside the box, the "label" fades out to be almost nearly transparent.

Any idea how this was done? I tried making two mc's, one with static text, one with dynamic text, but I can't seem to make the static text fade out.

Kevin
 
Okay, I have it to the point where I type things, the background label fades to nothing. But does anyone know how to make a text box respond to a javascript type change event? For example, if I cut or paste some text into the field, I want it to check the transparency...
 
And another part of this problem: I now have two input boxes. When I enter information they both go dim... Here are the _root functions in frame 1:
Code:
// Begin Custom functions
function CheckEmpty (oInput, oLabel) {
	if (oInput == "") {
		NewColor = new Color(oLabel);
		CT = new Object;
		CT = { ra: '100', rb: '255', ga: '0', gb: '0', ba: '0', bb: '0', aa: '100', ab: '70'}
		NewColor.setTransform(CT);
	}
}

function CheckFull (oInput, oLabel) {

	if (oInput != "") {
		NewColor = new Color(oLabel);
		CT = new Object;
		CT = { ra: '80', rb: '244', ga: '0', gb: '0', ba: '0', bb: '0', aa: '20', ab: '20'}
		NewColor.setTransform(CT);
	}
}

And here is an example of a calling event:
Code:
onClipEvent (keyUp) {
	_root.CheckEmpty(_root.MySwitchName.SwitchName, _root.MySwitchNameLabel);
}
onClipEvent (keyDown) {
	_root.CheckFull(_root.MySwitchName.SwitchName, _root.MySwitchNameLabel);
}

Why do they both go dim the first keystroke?!?! Once you enter information in, and delete it, each label acts properly, but that first time is killing me!
 
Had a look at your code and can't see why it's not working as you want it to...

There's another way to do what you want which is similar to the javascript change event. It's an undocumented feature of Flash called the _changed event.

create a textbox

name the field "input" or whatever

label a frame input_changed (or whatever_changed)
attach your code to that frame

the event triggers everytime you change the contents of the text box.


Not as neat as a function because it's a Flash 4 subroutine but useful nonetheless.
 
I broke down and started using a trace function. Also I put the boxes on different layers, and it works fine, but if they are on the same layer, even if the hierarchy split two layers up, the root functions get called for BOTH boxes.

It confuses me. I can't see building a separate layer for each box, as there will be over 25 boxes....

But I will try the _changed bit. Hopefully that will work...

Kevin
 
I should not have said layer above, I should have said level... Different layers doesn't help.

Kevin
 
The changed event works exactly as I wanted! Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top