Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: FLASH: scripting motion redux
From: Helen Triolo
Date: Tue, 28 Nov 2000 14:17:32 GMT

Hi Catherine. Those bubbles, and most things that require continuous
display of something that's changing over time, are done with a
movieclip that has an onClipEvent(enterFrame) routine attached to it.
In Flash 5, unlike Flash 4, the movieclip itself can be any number of
frames, even 1, and it will loop continuously as long as it's on stage
and controlled by an onClipEvent(enterFrame) routine. So you just
create your movieclip, drag it onto the stage in the frame you want it
in, select it and type your code into the Object Actions tab. (In Flash
4, you put the code into the movieclip itself, but in Flash 5, the code
resides in the Object Actions for the instance of the movieclip, if that
makes sense).

The bubblemaker uses two movieclips: bubbleclip, which just has 1 frame
with a bubble graphic, and bubblemaker, which has a masked copy of
bubbleclip -- also only 1 frame. Once bubblemaker has been dragged to
the stage, this code goes into the Object Actions tab to make randomly
floating up bubbles that get deleted when they reach a certain y
position. The complications are all in generating the randomness --
moving the bubbles isn't hard at all (it's just changing the y position
every time the routine is executed).

onClipEvent (load) {
nTimeCount = 71;
nBubbleCount = 0;
}
onClipEvent (enterFrame) {
if (nTimeCount > 70) {
duplicateMovieClip (mcBubbleClip, "mcBubbleClip" + ++nBubbleCount,
nBubbleCount);
// bubbles start in random place between x=0 and x=200
this["mcBubbleClip"+nBubbleCount]._x = math.random()*200;
// bubble size is between 30 and 100% of symbol size
nBubbleSize = 30+math.random()*70;
this["mcBubbleClip"+nBubbleCount]._xscale = nBubbleSize;
this["mcBubbleClip"+nBubbleCount]._yscale = nBubbleSize;
this["mcBubbleClip"+nBubbleCount]._y = 330;
// make new bubble between every 40 and 60 frames
nTimeCount = math.random()*20;
}
nTimeCount++;
// delete bubbles at top and
// move all remaining clips up one pixel per frame
for (i=1; i<=nBubbleCount; i++) {
if (this["mcBubbleClip"+i]._y < -20) {
removeMovieClip("mcBubbleClip"+i);
} else {
this["mcBubbleClip"+i]._y -= 1;
}
}
}

So in your case, you'd put the code that moves a clip along a lissajous
curve into the onClipEvent(enterFrame) routine, and it would display
continuously. I don't know what a lissajous curve is, but it sounds
interesting -- if you'd care to post or send me the code for it, I'd be
glad to try to stick it into the bubblemaker and see if I can get it to
do something.

Regards,
Helen
-----------------------------------------------------
i-Technica · http://i-technica.com · 301.424.6037
developer resources: http://i-technica.com/whitestuff

Catherine Kunicki wrote:
>
> Hi.
>
> Cat's back in tutorial mode : )
>
> I asked this question back in August or September and recieved a couple of
> great answers which I didn't save and can't seem to dig up in either flasher
> or flashcoders archives.
>
> I have some old scripts (Hypertalk and Lingo versions) which move an object
> in lissajous curve patterns. Since its familiar territory, I want to try
> them out with Flash 5 actionscript.
>
> I have my movieclip moving in a "while (i < somenumber)" loop. My clip moves
> correctly, however all you can see is really the first and final positions.
> I need ideas (or links to tutorials) about the best way to show the steps.
>
> I think using movies with more than one frame might have been the answer : )
>
> I noticed helen triolo's elegantly moving bubbles, which I might try and
> figure out - looks like there might be some help there - but if anyone can
> give me a jump start, I'd appreciate it.
>
> Catherine
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flasher is generously supported by...
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> flashforward2000 and the Flash(tm) Film Festival
> November 27-29, 2000, LONDON, National Film Theatre
>
> Produced by United Digital Artists and lynda.com
> -Sponsored by Macromedia, Adobe Systems and Apple Computer
> -http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
> Register before November 10 and save £200
> http:// www.flashforward2000.com
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> To unsubscribe or change your list settings go to
> http://www.chinwag.com/flasher or email helpatchinwag [dot] com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flasher is generously supported by...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flashforward2000 and the Flash(tm) Film Festival
November 27-29, 2000, LONDON, National Film Theatre

Produced by United Digital Artists and lynda.com
-Sponsored by Macromedia, Adobe Systems and Apple Computer
-http://www.flashforward2000.com or UK tel. +44 (0870) 751 1526
Register before November 10 and save £200
http:// www.flashforward2000.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe or change your list settings go to
http://www.chinwag.com/flasher or email helpatchinwag [dot] com


Replies
  Re: FLASH: scripting motion redux, Catherine Kunicki

Replies
  FLASH: scripting motion redux, Catherine Kunicki

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]