Action Script tutorials

Hey Y’all!\rCan anybody tell me where I can find some free tutorials that explain the basics and all that stuff. Kirupa’s tutorials are excellent, but they don’t tell me how to “do it yourself”.\r\rThanks\rAlbino

Wut? Kirupa’s examples go step by step through the process. If you want to do it yourself, just don’t download the Partial Source, and make all the movie clips and everything by yourself. Personally I feel that Kirupa’s tutorials and the others on the site (analog clock especially!!:wink: j/k) are some of the best that I’ve seen anywhere on the net. I’ve looked all over before I stumbled onto this site, and I took up residence, and I haven’t left yet. (don’t plan to anytime soon either) I have seen at many other places, that the tutorials are very vague, or not complete in some way or another, or you have to be an expert flasher to understand them. But thats just my opinion. Also, I don’t think that any other sites are really going to give you a step-by-step run-down of everything included in the tutorial, you’re just going to have to know how to make buttons, MCs, and do tweening. And as far as any actionscript goes, there is usually an explaination of the code somewhere with the tutorial so you could reproduce it on your own if you have to. Again, just my opinion. Good Luck on your quest.\r\rJubbs

Check out the best of Kirupa forum below. I moved a couple of posts there which I feel really give a good basic example of action scripting, movie clip manipulation and button actions.

No offense:\rKirupa’s tutorials are the best I’ve ever seen, but they don’t tell me (maybe I am just too stupid which is a possibility) how do make an actionscript myself. I understand what the codes mean that Kirupa uses in his tutorials, but I wouldn’t know how do it myself. I have no clue what kind of codes there are and what the list of tags is.\rFor example an explanation for the tags that are included in normal mode or ANYTHING like this. I am not trying to offend anybody here, but I know about everything about the easy stuff and to make more advanced things I need to know how the actionscript works.\rPLEASE HELP ME\rANYBODY\r\rsad\rDon Albino

There was no offense taken, but just as I said before, there really are no tutorials that will tell you exactly what each tag means. There are actionscript dictionaries online, at the Macromedia site, and I’ve seen a few others. You could start there. I don’t know a whole hell of a lot about actionscript either, but what I do know I’ve learned from the tutorials. Once you’ve gone through a few of the tutorials you should get a basic understanding, and then from there you do the harder tutorials, and try more effects then ask questions. There are too many tags, and too many commands for someone to just list out what everything means.

That was a project, though, wasn’t it ? “Do something like what Colin Moock did in his book”, if my memory is correct. That would be really great. But huge. My method : I read the tutorial, I do the tutorial, and then I redo it without looking at the code. You should try it.\r\rpom 0]

first:Let’s just assume I am EXTRODINARY dumb\r second:\rsome examples of what I mean:\rWhat do the underscroes mean? when do I have to put stuff in parantheses and when not, when do I use “:” and “;” and all the other signs. When do I have to put this “}” or this “{”\r\rJust about everything. Kirupa does a great job in explaining what he does, but I need the very basics.\rI got all the stuff about gotoAndPlay and all the really easy stuff.\r\rMan, I really hate to bother you all the time, but I just need help, that’s all.\r\ra sad and clueless\rDon Albino

why do you need to know that stuff. If you are editing in normal mode, it will do all that stuff for you. You should be editing the actionscript in normal mode if you are a beginner. I don’t know what those things mean, and I have a fairly decent grasp of actionscripting and (to misquote) “ignorance is bliss” because I don’t give a flyin’ fk what any of those things mean, do, or the reason they exist. But to give you a run down of the things i do know…\r\r"(" and “)” are used to tell something, say a button or MovieClip, when to perform an action. \r\rEXAMPLE::\ron a button the code would be::\r\r<font color=blue>on (press){\rgotoAndPlay (2);\r}</font>\r\rthis is telling the button, to go to frame 2, when the button is pressed by the mouse.\r\ron a MovieClip the code would be::\r\r<font color=blue>onClipEvent (load){\r_x = 300\r_y = 450\r}</font>\r\rthis is telling the MovieClip, when it loads, to go to those coordinates.**\r\rthe parenthesis “(” and “)” also let Flash know what objects to perform actions on, or where to go.\r\rEXAMPLE::\r\r<font color=blue>startDrag (_root.MovieClip1)</font>\r\rThis code is telling Flash to drag the MovieClip, MovieClip1.\r\r\rin the codes above you saw “{” and “}” these just contain all of the code that will be performed within that action.\r\rEXAMPLE::\r\r<font color=blue>onClipEvent (load)<font size=4 color=purple>{</font>\r_x = 300\r_y = 450\r<font size=4 color=purple>}</font></font>\r\rSee how the _x and the _y are contained within the brakets? These brakets are telling Flash to perform the actions that are contained within those brakets only.\r\rand the underscores just go in front of properties.\r\r_alpha defines the alpha of a MovieClip Ex:: this._alpha =75\r_x defines the “X” position of a MovieClip Ex:: this._x = 300\r\retc…etc…etc…\r\r\rand lastly “;” basically means a return. When you are finished with one line of code and you press Enter, there should be a “;” there. However, you don’t have to put these in yourself if you are using Expert Mode, because Flash detects them itself. In Normal Mode, they are put in automatically.\r\r\r\rI hope this helped you somewhat. But if you do the tutorials more and keep working on it, you will have a good understanding of what these things mean. It is not necessary to know what everything means. Try doing actionscript in Normal Mode, it makes things a lot easier.

YOU ARE THE MAN\rYou don’t even know how much that helped me. And this is not a joke. I am serious. I could need some more, but this will get me started.\r\ra happy\rDon Albino\r\rP.S.\rWhat does the “_root” thing mean?

_root refers to the root. lol…uhmmm _root specifies an absolute path. here’s the Def from Macromedia::\r\rDEFINITION::Property; specifies or returns a reference to the root movie Timeline. If a movie has multiple levels, the root movie Timeline is on the level containing the currently executing script. For example, if a script in level 1 evaluates _root, level 1 is returned.

Great explanation Jubba. About that _root. thing : maybe you noticed that when you create a movie clip, you create a new timeline. And you may have, why not, several movies called the same on different * levels* (those aren’t really levels, so let’s say at different depths of the movie). Well, if you’re inside a movie clip that’s on the main scene, and imagine that you want to aim at another movie clip that’s on the main scene, you’ll have to access through the _root. because you can’t do it directly.\r\rI tried to explain it in the Bacteria effect tutorial. I suggest you check it out (there’s a very ugly drawing next to it.)\rpom 0]

lol… It’s funny seeing a frenchman trying to explain _root… I guess I’ve had my own difficulties with that.\r\rUnderscore: some people use underscore when labeling things. I consider this in poor form, but none the less it’s pretty common place. So the following does not apply to that particular case of underscore usage.\r\rThe rest of the time, in Flash underscores usually represent properties of objects.\r\r_x is the number of pixels to the right, of the upper left corner of the movie\r\r_y is the number of pixels down from the upper left corner.\r\r_alpha is the property of transparency, as has been explained above.\r\r_xmouse is the x possition of the mouse. yup that means that there is an _ymouse too.\r\rusually when you see an underscore you should be aware that either a property is being set, or a property is being requested.\r\rNow:\r_root refers to the maintimeline of the level0 movie. Don’t really worry about the level0 part of that right now… that’s not important till you get into loading swfs into each other.\rbut _root is very important and so is _parent.\r\rIf you create a movie clip, you can tell it to do things by changing it’s properties, but in order to do this you must tell Flash what it is that it is looking for. We do this with “Instance” names.\rOne of your panel’s is called the “Instance” panel, and it is opened by menu option “Window/Panel/Instance”. If you select a movie clip you can enter an “Instance” name in this panel.\r\rNow in the action script panel you can do anything you want with the movie clip. But, if your movie clip is inside another movie clip then that one needs an instance name too.\r\rwhen calling upon a movie clip to do something, we direct the attention of the movie along a chain of names.\r\rSo if we have a three movie clips and they are called “myMovieClip1”, “myMovieClip2”, and “myMovieClip3”, \r\rNow, “myMovieClip1” is on the main timeline, and “myMovieClip2” is inside “myMovieClip1”.\r\r"myMovieClip3" is inside “myMovieClip2”.\r\rfrom the main timeline we could tell “myMovieClip3” to turn invisible with the following\r\rmyMovieClip1.myMovieClip2.myMovieClip3._alpha=0;\r\rwe’ve called up the chain to the last movie clip, calling each on in turn and placing a period inbetween each name. Then there is a final period and the property of alpha. This is all on the left of the equals sign so it means that we are setting the property to whatever is on the right hand side of the equals. It can be a number as in our example above, or an expression.\r\rNow back to _root. :slight_smile: \r\r_root refers to the main timeline in a string of object names. If we were to have action script in “myMovieClip3” which told the main timeline to gotoAndPlay for instance, we could word it like this.\r\r_root.gotoAndPlay(32);\r\r_parent refers to the timeline which contains the timeline that some code is on. So if we had action script in “myMovieClip3” which was going to tell “myMovieClip2” to gotoAndPlay, then we could call it in two different ways.\reither\r_root.myMovieClip2.gotoAndPlay(76);\rOR\r_parent.gotoAndPlay(76);\r\reither way would accomplish the same result.\r\rI mentioned the left hand side of the equals sign up above, in the following case\r\rmyVariable=_root.myMovieClip1._alpha;\r\rwe are taking a variable called “myVariable” and we are setting it equal to whatever the alpha level of “myMovieClip1” is. So checking out which side of the equals sign things are on will help you to understand script better too.\r\rI hope I’ve explained that well enough… :slight_smile:

Hey, gimme a break… :smiley: \r\rpom 0]

yeha give the Frenchman a break…he’s…well, French. _root is a funny thing, we all know when to use it, and what it does, but none of us can explain it clearly for the life of us. Maybe that should be a tutorial…just about using _root…lol :slight_smile:

now that you’re done with _root. how bout _parent…like\r_pomsdaddy or _jubbasmommy???\r\rj/k kidding about the mothers and fathers. \r\ranyway, _parent works exactly like _root, it’s what’s called a reference parameter, (refer-whatsawhosi?) which is another name to call something else, which in this case is the upper level in which the calling object is being called from. if you put a movieclip on the main stage and called it’s parent, it would be the same thing as the root. but if you put movieclip1 inside movieclip2 and called the parent from movieclip1, you’d be referring to movieclip2. movieclip2 is at a higher level and “carries” movieclip1, thus its parent.

Thanks for taking time to tell a newbie how to do that stuff.\rI appreciate it.\rJust one more question.\rWhat does the\r"_this" \rmean?\r\rDon Albino\r\rP.S.\rI finally got the _root thing

its not _this. its just “this.” it means that you are refering to the Object you are placing the code in.\r\r\ronClipEvent(load){\rthis._y = 45\r}\r\rmeans that the clip that you place the code on goes to the Y position 45 when the clip loads.

in some cases, you don’t even need “this” example, when you call the objects properties within itself:\ronClipEvent(load) {\r_y = 45;\r}\r\rdoes the same thing.\rexamples of properties are:\r_x\r_y\r_xscale\r_yscale\r_rotation\r_alpha\r_visible\r\ri’m sure there are more but i can’t think of them right now.

Actually, this is never necessary in Flash 5, except when you want to use this[“mc”+i]._x for instance.\rIt’s used in C++ if my memory is correct, to define Class methods. Don’t ask me xhat this means, please.\r\rpom 0]

maybe I’m just used to seeing it or something, but I find it easier to see what the code is talking about if people use it. As soon as you start self refering, but leaving out “this” I get completely lost.