Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 12-29-2009, 08:55 PM   #1
Baseband Member
 
MartinC.'s Avatar
 
Join Date: Nov 2009
Posts: 56
Question plz. help me with actionscript 3.0

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
----
__________________

__________________
all your base are belong to us
MartinC. is offline   Reply With Quote
Old 12-30-2009, 09:07 AM   #2
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: plz. help me with actionscript 3.0

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.
__________________

__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 12-30-2009, 09:36 PM   #3
Baseband Member
 
MartinC.'s Avatar
 
Join Date: Nov 2009
Posts: 56
Default Re: plz. help me with actionscript 3.0

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?
__________________
all your base are belong to us
MartinC. is offline   Reply With Quote
Old 12-31-2009, 09:14 AM   #4
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: plz. help me with actionscript 3.0

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.
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Old 12-31-2009, 03:39 PM   #5
Baseband Member
 
MartinC.'s Avatar
 
Join Date: Nov 2009
Posts: 56
Default Re: plz. help me with actionscript 3.0

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);
__________________
all your base are belong to us
MartinC. is offline   Reply With Quote
Old 01-02-2010, 04:27 AM   #6
In Runtime
 
Daeva's Avatar
 
Join Date: Dec 2005
Posts: 407
Send a message via AIM to Daeva Send a message via MSN to Daeva Send a message via Yahoo to Daeva
Default Re: plz. help me with actionscript 3.0

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...).
__________________

__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier.
Edit = Best feature ever
http://www.twitter.com/xDaevax
Daeva is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 01:53 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0