Welcome Guest [Log In] [Register]
Welcome to Brackenwood. We hope you enjoy your visit.


You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Math.(random)
Topic Started: Apr 15 2005, 02:55 AM (203 Views)
Ratio
Member Avatar
Brackenwood Heavyweight
lake


okay, i got the rain droplets here in a movie clip, and basically i was wandering wether math random could help me make the droplets apper at random points ant random times in the lake. could someone tell me the full code to do this?
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Yeah man

Firstly you need to give it a linkage name, so open up your assets library (F11). Then in that there should be your movieclip, right-click on it and go down to linkage, then tick the top box and give it a name "mcSplash".

Then, hit ok.

Then click on frame 1, and press the F9 key. this will bring up the actionscript window.

type the following:

Code:
 
x = 0;

_root.onEnterFrame = function() {

x++;
_root.attachMovieClip("mcSplash", "iSplash" + x, x);
_root["iSplash" + x]._x = random(Stage.width);
_root["iSplash" + x]._y = 100 + random(300);

}


Then go back to your library and double-click on the splash movieclip (so you should be in the frame view for the splash now). go to the last frame of the splash, select the last frame and press F9. in the a.s. window type

this.removeMovieClip();

This will remove the splash from the stage after it's finished "splashing".

That should just about do the trick. it will add 1 splash every frame, which you can randomize by putting this just under _root.onEnterFrame = function() {:

Code:
 
vRand = random(5); //Make up to 5 splashes in 1 frame
for (y = 1; y <= vRand; y++) {


and put another } just below the last one already there.

:)

Wanna know how I know this so well? I actually wrote my own rain engine a while back.... I'll upload it to photobucket in a sec. :D

<edit> here it is :) My Rain Engine

Cheers, Vec
Offline Profile Quote Post Goto Top
 
mystical-mongoose
Member Avatar
Eggy Toast
Vector
Apr 14 2005, 06:29 PM
Yeah man

Firstly you need to give it a linkage name, so open up your assets library (F11). Then in that there should be your movieclip, right-click on it and go down to linkage, then tick the top box and give it a name "mcSplash".

Then, hit ok.

Then click on frame 1, and press the F9 key. this will bring up the actionscript window.

type the following:

Code:
 
x = 0;

_root.onEnterFrame = function() {

x++;
_root.attachMovieClip("mcSplash", "iSplash" + x, x);
_root["iSplash" + x]._x = random(Stage.width);
_root["iSplash" + x]._y = 100 + random(300);

}


Then go back to your library and double-click on the splash movieclip (so you should be in the frame view for the splash now). go to the last frame of the splash, select the last frame and press F9. in the a.s. window type

this.removeMovieClip();

This will remove the splash from the stage after it's finished "splashing".

That should just about do the trick. it will add 1 splash every frame, which you can randomize by putting this just under _root.onEnterFrame = function() {:

Code:
 
vRand = random(5); //Make up to 5 splashes in 1 frame
for (y = 1; y <= vRand; y++) {


and put another } just below the last one already there.

:)

Wanna know how I know this so well? I actually wrote my own rain engine a while back.... I'll upload it to photobucket in a sec. :D

<edit> here it is :) My Rain Engine

Cheers, Vec

Action Script really helps a lot more then I thought!! To bad it wont work if you put your animations on DVD...I mean a good animater who is great at Action Script could make an awesome animation. Maybe Macromedia should design a DVD and telivision safe version of Action Script, or try at least.
Offline Profile Quote Post Goto Top
 
Mr. Jiggmin
Member Avatar
made of tulips
That’s cool Vec! How did you get that impact detection going? Seems like a hit test every frame for all of those water drops would make things start lagging. I dunno about that green water though. :lol:

I'm just guessing, but I'd say that you could probably export to .exe to get actionscript to work on a dvd. Or maybe with some know how you could get the dvd to run a normal old swf?
Offline Profile Quote Post Goto Top
 
RJ213
Member Avatar
Brackenwood Member
Not bad the rain drops was kind of good..
but can you tell me how I could put some of my animation on...
It would really help alot....
Offline Profile Quote Post Goto Top
 
RJ213
Member Avatar
Brackenwood Member
And also I was wondering if someone could tell me how do I convert me flash animation into GIF format.....
Offline Profile Quote Post Goto Top
 
Bussman
Member Avatar
FLASH GENIUS (I wish...)
why would u wanna do that?
Offline Profile Quote Post Goto Top
 
RJ213
Member Avatar
Brackenwood Member
So i could put on of my shorter animation as my avatar...
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
you can use swf's as your signature, as long as they are 550x150 or less in size, and are below... 10k i think...

All you do is type

Code:
 
[flash=550,150]www.place.com/file.swf[/flash]


Where 550 is the width, 150 is the height, and www.place.com/file.swf is the location of your file, which you can host at
-www.freewebs.com,
-www.imageshack.us, or
-www.photobucket.com

:)

I have an interactive signature.. see :) You can click + drag the floating balls too :lol:

<edit> *slaps self in the face*
You meant your avatar picture on the left, didn't you.... :yfok:

Well, you go file >> export >> export Movie (or control-alt-shift-S). Then in the drop-box you select "GIF Sequence (*.gif)"... and follow the prompts :)
Offline Profile Quote Post Goto Top
 
Ratio
Member Avatar
Brackenwood Heavyweight
**Error** Scene=Scene 1, layer=Layer 5, frame=1:Line 1: Statement must appear within on/onClipEvent handler
x = 0;

**Error** Scene=Scene 1, layer=Layer 5, frame=1:Line 3: Statement must appear within on/onClipEvent handler
_root.onEnterFrame = function() {

Total ActionScript Errors: 2 Reported Errors: 2


what did i do wrong?
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
You put it on a movieclip. What you have to do is put the code on a frame, that is, select the frame that you're on in the timeline (up the top), THEN press F9. when you paste the code in, a little "a" should appear in that frame in the timeline. :)

eg:

Posted Image
(thankyou www.macromedia.com :) )

The third layer down, "actions", on the first frame, there is the little "a".

You need to click on the frame 1 box and open up the actionscript window and paste it in there. :)
Offline Profile Quote Post Goto Top
 
Ratio
Member Avatar
Brackenwood Heavyweight
im sorry, its still not working, no error report, its just not working. the moive is playing as if there's no action script at all, just one splash, in the middle constantly looping.
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
That's my bad... I tested it and found the prob.

Where it says _root.attachMovieClip, it should actually be _root.attachMovie

Sorry about that.
Offline Profile Quote Post Goto Top
 
Ratio
Member Avatar
Brackenwood Heavyweight
im sorry vector, its still not working


here's the fla if you want to look at it
Offline Profile Quote Post Goto Top
 
Vector
Member Avatar
Resident Actionscript Guru ♂
Admin
Here it is, the main problem was in the right-click >> linkage, you actually typed "mcSplash" with the talking marks :P

sorry, I should've explained it better :)

real copy attached. :)
Offline Profile Quote Post Goto Top
 
Ratio
Member Avatar
Brackenwood Heavyweight
SCORE! thank you very much!
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Actionscript · Next Topic »
Add Reply