Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 04-16-2005, 09:36 PM   #1
ladyofbenjamin
ever learning...
 
Join Date: Aug 2004
Posts: 27
Default changing color of textfield inside movie clip

okay, i have a feeling this is going to be a stupid simple answer but i am just not getting it..... i have a textfield inside movie clip i am using like a button. i want to roll over the movie clip and have the text change color from grey to blue. i got that part to work. but i cannot for life of me get it to change back when i roll off. i've been trying to think of an if/else statement but can't figure out what to say for the 'if' part. well, IF the mouse is over the movie clip, duh... isn't that what the "onRollOver" means?

the second part is i will want the color to go Blue if i actually click on the movie clip, and then will want it to go back to grey if i click on a different clip, so i'll have to delete out the color change somehow....

.... and i just can't figure out how to actionscript this...

here's what i have:

ActionScript Code:
_root.attachMovie("test_mc", "test", _root.getNextHighestDepth()); test_mc._x=50 test_mc._y=50 test.onRollOver = function() {     //test.test_txt.textColor = 0x0944b3;     var myColor:Color = new Color (test.test_txt)     myColor.setRGB(0x0944b3);     } test.onRollOut = function() {     test.test_txt.textColor = 0x999999; }

the "onRollOut" doesn't work at all. notice i can change the color in two ways, one is commented out. don't know which way might be better.....i thought by using variable i could use a delete variable, but couldn't get that to work either...

can someone help me get my code right? this should be so simple, don't know why i can't get it..... thanks....
ladyofbenjamin is offline   Reply With Quote
Old 04-16-2005, 11:04 PM   #2
snapple
member
 
snapple's Avatar
 
Join Date: Feb 2002
Location: London
Posts: 2,442
Default

The problem is, where you actually create your new Colour object, is inside the braces, it's scope is limited to the body of the cdoe where is was first declared (i.e. the objects scope is limited to your onRollOver() function).

I bet if you create another colour object in your rollOut function, it will work (or declare your colour object outside of both).

If i were you, go for the text colour option. Your taking up more menory by creating instances of the Colour class everywhere.

Regards, snapple
snapple is offline   Reply With Quote
Old 04-16-2005, 11:39 PM   #3
ladyofbenjamin
ever learning...
 
Join Date: Aug 2004
Posts: 27
Default

bless you i knew it would be something easy i missed.... had to use the color class to make it work, dunno why, but i got it and that's what counts! thanks again!!!
ladyofbenjamin is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This 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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:17 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.