View Full Version : Flash start buttons...
Hi i am jon
October 29th, 2005, 02:04 PM
ok im getting better with flash (i use flash 8)...but i still cant seem to get a start button to work, all the tutorials i find are outdated so i figure my own way, but i cant figure out how to make working buttons, i put in
on (release) {
MyButton.onPress = function () {
gotoAndPlay(2);
};
}
but there is an error :/ any one please correct my mistake?
kevin
October 29th, 2005, 03:10 PM
You have a semi colon after the parameter bracket }
Only use semicolons after statments like functions and such.
Also, MyButton.onpress = function () {... is wrong.
To make a function, you do this:
function MyButton () {
gotoandplay(2);
}
there's no equal sign.
Plus, why are you making a function of it, just have it as below to go to frame 2.
on(release) {
gotoAndPlay(2);
}
But if you're making a function for an unknown reason...
on(release) {
function MyButton () {
gotoAndPlay(2);
}
}
If you're just trying to go to the next frame (2), then you want to use the first whole script I made. The reason is, a function is a peice of script that you can reuse over and over but using MyButton(); and it'll give you output. But it won't when you make it because with "function name() {" you are just creating a function and not executing it. So if name was your function, to use the function later with a different script, you'd just type name()...
Hope you get it. And btw, if you were wondering if gotoAndPlay() was a function, it is. Flash makes it a default one.
Kiros
October 29th, 2005, 06:36 PM
Hmmm... I didn't know that Flash was based off of Java syntax :shock: Eh, but I haven't dealt with Flash any.
And just to confirm it, Kevin's absolutely right :)
Hi i am jon
October 29th, 2005, 10:12 PM
alright well thanks and all....but...i kinda got lost lol what i am trying to do is just make a simple play button and the tutorial i was on just told me to insert the script they gave me...obviously wrong....where the hell did you learn all this lol....
Kiros
October 29th, 2005, 10:58 PM
Well, Kevin knows A LOT about PHP, and it just so happens that a lot of PHP is Java-like, but without the need for a virtual machine. And obviously, Flash is based off of Java too. In fact, a lot of languages are based off of Java (or have something related to Java) except COBOL, but that is the worst language ever... I hate it >_<
Anyway.... I know DHTML and Java tid-bits really well, plus C++ (which has 90% like Java), so that's mainly how I know all that jazz.
This is actually why I'm trying to come up with a stable, powerful language that's not really based off of another one. Though it's gonna take me forever :roll: I still need some local scripters, but Albany is nothing but red necks and country bumpkins :P
Btw, the code that you were going to use is incomplete. You have to declare the class MyButton and you much have a public child of MyButton (onPress). You also would have to remove that semicolon after that closing bracket. And the function is still incomplete. Something like this would make more sense:
on (release)
{
MyButton.onPress = function(gotoAndPlay(2));
}
But even if you did mean to make a function called MyButton, you would just be defining a function, not calling one. Though I don't think you can define a function without declaring it's prototype. :what:
And if MyButton.onPress is an attribute, and you do not need to call a function into a function, then just use
on (release)
{
MyButton.onPress = gotoAndPlay(2);
}
Hi i am jon
October 30th, 2005, 08:00 PM
thanks :D, now i got it :D.........now oneeee more question, do you know of a usefull tutorial site for flash, i did them all on my old one, my brother told me www.flashkit.com but that has to be the worst excuse for tutorials in the world :O...anyway, if you know any sites it would be very helpfull.....thanks again
Kiros
October 31st, 2005, 01:04 AM
Dunno what to tell ya Jon, I haven't learned Flash yet, and so have no idea which tutorials are good and which aren't :P Sorry....
Hi i am jon
October 31st, 2005, 01:23 AM
its all good i searched around on newgrounds and found a street fighter tutorial, so ill be workin on that for a long while, thanks anyway and thanks for the help with that button from hell :P, and thank you ark for the site, and thank you kevin for also helping with that damn button....
vBulletin® v3.8.9, Copyright ©2000-2021, vBulletin Solutions, Inc.