Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Other Web Development Languages (http://www.programmingforums.org/forum40.html)
-   -   Flash Buttons Problem (http://www.programmingforums.org/showthread.php?t=11243)

john Wesley Sep 3rd, 2006 11:01 AM

Flash Buttons Problem
 
Dont know if there are many Flash developers here but hopefully someone will understand this...

:

on (rollOver) {
        Home.onRollOver = function() {
                Home._alpha = 0;
                Home1._alpha = 100;
               
        };
}


The button home is 100% visible from the start, and home1 0%. What I want to achieve is; Have these two images change to the opposite on mouse over.

Taking a look at the Flash help it only seemed to show me how to stop, start or loop something on click. I figured this 'should' work' however nothing happens when I preview it. There is also no errors in the script according to the syntax checker.

Thanks for any help.

Wizard1988 Sep 3rd, 2006 1:58 PM

How about checking if they already are 100% and if so then change to 0 and the other way around.

Booooze Sep 3rd, 2006 2:11 PM

Don't have flash installed right now, but rather than messing with the alphas, why don't you make sure the roll over works. Have it display a message when you rollover each button. Then replace the code with the visibility features. All I can say :p sorry

grimpirate Sep 3rd, 2006 11:42 PM

I'm gonna see if I can explain this 'cause I know how to get it to work but bear with me John 'cause Flash is kinda weird to explain (at least to me). The code should actually be this:
:

on (rollOver) {
        Home._alpha = 0;
        Home1._alpha = 100;
}

Nothing else is really necessary and of course it should be located on the code area for the Home button. However, here's what might be causing the problem. Let's say you drew a rectangle and then converted it to a button and you put as the symbol name Home. That's not the instance name of the rectangle you created. The Home name you gave it represents all copies of that one particular type of button it's sort of like a parent. So what you have to do is actually go into the Properties window and instantiate the rectangle, by giving it an instance name, such as Home_btn (Flash recommends appending buttons with _btn since it helps the popups in the IDE and all that jive). I hope that makes your code work, and of course you should also do this with the Home1 button. Furthermore, the objects will remain that way so you might also want to include an on(rollOut) { } function to reset the alphas to their original state. Good luck.

P.S. If your objects aren't instantiated you're referring to something that doesn't exist, and unfortunately I don't think Flash catches those sorts of errors. The debugging leaves something to be desired.

john Wesley Sep 4th, 2006 5:46 AM

Thanks for all your input though I fixed this problem last night. Tomorow I will bring with me the code and show anyone interested, It has been expanded a little...

Funny with programming, everythings the same; but a bit different.


All times are GMT -5. The time now is 1:12 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC