plz. help me with actionscript 3.0

MartinC.

Baseband Member
Messages
56
Hi, I'm trying to try to find a good site that has information about how to program with actionscript. I have searched for some, but I can only find ones
that are for people who already know how to program with it. I have no experience with it. Also, do I need a compiler or need to download anything for this? (by the way i want to know about ACTIONSCRIPT 3.0).
----
here is where i am
-I have flash CS4
-I have no experience with any programing language (I know how to program batch files, but that doesn't really count)
-I know how to make decent animations using flash CS4
----
 
the swf file that is created by adobe flash is a "compiled" movie. There is no seperate compiler for actionscript.

You must run actionscript within the context of a flash movie.
You can use adobe flash to write it, or any other text editing tool.

Two types of actionscript can be written:
1.) Embedded- This type is within the timeline or within sprites/movieclips/buttons in your fla file.
2.) External- these are seperate .as files that contain "classes" or other "objects" that can be imported into your timeline and used.

The best way to learn is not by trying to learn about "actionscript" itself, but instead to solve a problem.

For example: I want my movie clip to move accross the screen when I click a button.

So, in this case the best place to start would be doing a search for "Actionscript 3 movieclip animations".

Learn by trial an error.

If you'd like to learn how to "program" I would suggest NOT doing so in actionscript.

Here is an example of what I mean:

Code:
function fadeClip():void {
  myMovieClip.alpha-=.05;
} // end function fadeClip

setInterval(fadeClip,500);
Basically what this code does, is if you have a movieclip that you have added to the stage called "myMovieClip" (Make sure you have given it an instance name of myMovieClip once you add it to the stage), it will create a fade animation.

First, I created a function.
Next, I added code within the function to reduce the 'alpha' property of the movieclip by 5%.
Finally, After I created my function, I put my function on an interval. What this means is that every 500 miliseconds (1000 milliseconds = 1 second) it will call the function that fades myMovieClip. The result is the gradual fade-out of the movieClip.

Try it.

That should be enough to get you started, hope it helps.
 
thanks, but how do i put this actionscript inside of my stage?
Also, I am trying to learn how to make games like the ones on sites such as newgrounds and miniclips, am I learning the best thing or should I try to learn something else?
 
Yeah, you're learning the right thing for that.

To put actionscript in your movie there are two places to put it and the distinction between the two is very different.

First of all, the shortcut to bring up the actionscript window is F9.
Once that is up you can either place actionscript on the timeline (by selecting a keyframe), or you can place it on a movieclip or button (by clicking the mc or button and placing the actionscript). Placing it on the button is useful for adding code to handle button clicks.
 
yay! it worked, thanks :)
edit-
Also, I tried applying the same technique (kind of) you used to make it fade to make it move, and it didn't work, here is my code (below), do you know what I am doing wrong?

this was my first attempt

function fadeClip():void {
myMovieClip.width-=.05;
} // end function fadeClip

and this was my second attemp

setInterval(fadeClip,500);
function fadeClip():void {
myMovieClip.w-=.05;
} // end function fadeClip

setInterval(fadeClip,500);
 
If you want it to move, try using x and/or y instead of width.
ex: myMovieClip.x+=1;

Alpha values are percentages (.05 being 5%). In the case of x / y, they are rational numbers (1,5,20,2.5, etc...).
 
Back
Top Bottom