View Full Version : Funky Functions.
Riddler?
May 16th, 2004, 04:56 PM
I like to think i have a decent knowledge of AS, but this silly little problem has evaded me... Check out my FLA. I'm trying to make a very simple function that will fadein/fadeout a MC whenever run.. you should understand from the FLA. Any help appriciated :)
http://jayhayes.no-ip.com/fader.zip
mediatot
May 17th, 2004, 03:53 AM
Okay .. I'm also fairly new to AS, but here's what I can see :
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Changes:
fadetarget = "testtarget";
fadetarget = testtarget;
You can't call fade() within fade() .. it doesn't have a condition so it runs forever as fast as your CPU can hand it. Using +- 5 would usually work, but that would have to be included in onClipEvent(enterFrame){...} so that it will add or subtract 5 from the _alpha each time the frame is entered. This is determind by the Frame Rate of which yours is set to 12.
The two ways I can think of making this work would either be to insert your fade() function directly into an onClipEvent(enterFrame){...} with a condition like _root.fadein == 1 and so all you have to do is keep your current button. The other way would be to keep your function as is and investigate setInterval().
Oh, one last thing... when checking a condition, it's "==" to check wheather x is equal to y.
Hope that helped you a bit. If you don't really understand what I'm saying, have a look at the various item definitions on macromedia.com or search for them in the tutorial section of this site.
G'luck :)
Riddler?
May 17th, 2004, 09:10 AM
hey, thanx for the help.. I understand now why I should have left out those quotes, but i didnt realize that it called that function everytime.. ill try putting it on a (load) next time. btw, yes i knew about the "==", it was just a syntax error on my part when writing it hehe :).. ill let ya know if it works out
Riddler?
May 17th, 2004, 10:49 PM
alrighty well here's my solution.. i really didnt want to do it this way, cause it seemed like it would task my cpu, but it works, so i guess thats all that matters :)..
http://jayhayes.no-ip.com/fadetest.fla
Hopefully that can help someone else out.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.