Randomize a Movie Clip Animation Using Actionscript
I'm new to actionscript.
I've been working on this sort of sunset-like sequence in
Flash. I've created a movie clip of a star that has a sort of
twinkle animation. It consists of 3 layers. What I want to do is
randomize this animation so I can use the symbol spray tool to fill
my sky with twinkling stars. If I just to a "gotoAndPlay" repeat,
they all twinkle at the same time, and this looks pretty stupid.
My limited knowledge and experience with Actionscript tells
me that I need to define the animation as a function and use some
sort of math randomizer to control when it plays?
I have some books on actionscript I'm yet to work through, as
this is sort of a hobby of mine that I'm teaching myself, but I
haven't had the time nor energy to wrap my brain around it yet.
Thanks for any help!
Well, I've now decided to only have a few stars twinkling, so
it's no longer going to be that much of an effort to do a couple of
different movie clips that twinkle at different periods of time. I
just had the brilliant idea to do constellations that highlight and
serve as the button navigation for my portfolio website, and I plan
to have it seem like your panning up above the horizon and looking
up into the sky, and having about a hundred twinkling stars moving
and twinkling at the same time would probably prove super taxing on
most computers lol...
I'd still like to hear from anyone who may know how to do
this as it would still come in handy to me.
Similar Messages
-
How to find out where movie clips are used?
When I look at FLA project tree, I see Use Count column next to a movie clip. How do I find where this movie clip is used?
Hi,
You can use Edit > Find and Replace panel and set Symbols to Search
Hope this Helps
Thanks!
Mohan -
How do I remove a the contents of a movie clip created using loadClip?
I have a Flash site that loads specific SWFs into a movie
clip called "content_mc" based on a button click. I do this using
the "loadClip" method. I then remove (I thought) the SWF from the
movie clip with "unloadClip" and replace it with a new SWF using
"loadClip." All seemed to be working fine, but now I see that
scripts from a SWF that I thought I unloaded are still running.
I'm sure this is due to my lack of understanding of what
"loadClip" and "unloadClip" are doing. And there certainly may be a
better way to do what I want to do... but such is life. What is the
method to delete a the contents of a movie completely from memory?
or is there a better way to do what I want to do?
Thanks for your help,
DavidNope you understand more or less correctly. unloadClip takes
away the contents that loadClip placed. However there are certain
things that don't go away.
My guess is that you have some setIntervals. Those must be
cleared (clearInterval) before you do the unloadClip.
Or perhaps you have set up some listeners? Again those must
be removed. -
How do I backup movies/clips to use in future projects?
After burning my first DVD & deleting the iMovie file, I was sad to discover that I could not just pop the DVD into my drive & access the material to use in future projects. (Is there a way to do do this that I don't know about?)
I'm guessing I need to burn the archived iMovie file onto multiple regular CDs (I have not burned anything that spans several CDs before). This is confusing me because the zipped file is hardly smaller than the original (Is there a better zip program than the one that comes with this system?) I threw away the wrapper for my blank CDs so I don't know how much they hold but I think it is something ridiculously small like 670MB and the iMovie file is 7GB. Is this the only way to save my movie/clips so that I can bring clips into a future movie?
1.8 GHz Power PC G5 Mac OS X (10.3.9) 256 MB DDR SDRAMwelcome Novice to the board ....
hmm, multidimensional question ...
DVD is end-of-the-road, not meant for further processing; there are tools, allowing to import DVD to iM, but that is a time-consuming and lossy (=losing pic quality) process, due to the deliver-format nature of DVDs.... search forum for "DVD import"
iM is by concept not meant to handle a clip in many projects (that can easily been accomplished with pro tools as FC(E), which offer "bins" for imports, offering the content to many sequences/projects).
there are workarounds, dragging clips from the internal files of an iM project to another... but, as said: you "fumble" the concept: import tape, edit, burn - done.
a video contains ~13GB of data per hour... and, video is allready highly compressed, no zipper can reduce that dramatically... and, you risk damage of files... yepp, a cd-r fits ~700MB = 3.5min of video......
recommended workflow:
* don't store iM projects on -r media (cd/dvd), but firewire connected harddrives..
* keep the tapes; import clips from tape into project; you can export single clips out of iM/import into another project, I wouldn't do that with "lots" of clips, importing the tape is... more convenient.. -
Referencing a movie clip by using a variable
I have been using this line of code to fade in a movie clip:
new Tween(background_mc, "_alpha", None.easeNone, 0, 100, .5, true);
Now, I want to accomplish the same thing, only this time by using an element from an array (bg_array[currentSlideNumber]) that stores the instance name "background_mc"
I've tried the following, but it doesn't work:
new Tween(bg_array[currentSlideNumber], "_alpha", None.easeNone, 0, 100, .5, true);
What am I doing wrong?
ThanksYou are telling flash to look inside that array and tween the _alpha property of the string -- because instance names are strings -- "background_mc" from 0 to 100. But generally speaking a string doesn't have an _alpha property.
What you really want to do is tell flash, look inside this array find the string then use that string to look inside another array -- the array of all objects on some timeline -- to find a clip and then tween its _alpha property. That sounds like a lot, but it only adds a little bit to your code.
new Tween(this[bg_array[currentSlideNumber]], "_alpha", None.easeNone, 0, 100, .5, true);
I'm assuming the code is on the same timeline as background_mc?
Annother approach would be to store instance references instead of the names. I'm not sure how you are creating the background, but instead of putting the name into the array, put a reference. So if you were using attachMovie you could do something like this.
var bg_array:Array=new Array()
var tempVar:MovieClip=this.attachMovie("background","background_mc",100);
bg_array.push(tempVar);
Finally, and not to anything you've asked about, but don't you find the suffixes annoying? Why, bg_array and background_mc? If you type your variables you will still get code completion and you will have less to type and your code won't be so long. I just find that having to type those underscores and all makes me likely to make mistakes and makes it much harder to read the code. Just a thought. -
Playing Movie clip backward using buttons?
Im trying to create a series of images that scroll acoss the page left and right using arrows at either side of the stage. The arrows use mouse over events to play a movie clip of the images foward and backward.
There are a few issues I am having. I have a mouse over and mouse out events in place to start and stop the clip on to different buttons. However when playing the clip backward with my current script the mouse out doesnt do anything so the clip just keeps playing backward to the beggining. Once this has happened neither button then does anything.
Another issue is once the clip has played foward once in total and I mouse over the same arrow button again it flicks back to the begginging of the clip.
Here is my current scrpit:
panel.stop();
leftarrow_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_7);
leftarrow_btn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_4);
function fl_MouseOverHandler_7(event:MouseEvent):void
panel.play();
function fl_MouseOutHandler_4(event:MouseEvent):void
panel.stop();
rightarrow_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_9);
rightarrow_btn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_7);
function fl_MouseOverHandler_9(event:MouseEvent):void
panel.addEventListener(Event.ENTER_FRAME, everyFrame);
function everyFrame(event:Event):void
panel.prevFrame();
function fl_MouseOutHandler_7(event:MouseEvent):void
panel.stop();
Please Help!!
Patrickuse:
panel.stop();
leftarrow_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_7);
leftarrow_btn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_4);
function fl_MouseOverHandler_7(event:MouseEvent):void
panel.play();
function fl_MouseOutHandler_4(event:MouseEvent):void
panel.stop();
rightarrow_btn.addEventListener(MouseEvent.MOUSE_OVER, fl_MouseOverHandler_9);
rightarrow_btn.addEventListener(MouseEvent.MOUSE_OUT, fl_MouseOutHandler_7);
function fl_MouseOverHandler_9(event:MouseEvent):void
panel.addEventListener(Event.ENTER_FRAME, everyFrame);
function everyFrame(event:Event):void
panel.prevFrame();
function fl_MouseOutHandler_7(event:MouseEvent):void
panel.removeEventListener(Event.ENTER_FRAME,everyFrame); -
Encode movie clips for use in PDF presentation?
I've tried several formats for use in PDF.
FLV, F4V and H.264. But i always experience massive lag in Full Screen Mode. Even when I encode with low rate settings.
Any best practises?Those are the only formats supported in Rich Media Annotations. Within the Acrobat Family they render using Flash Player, so the performance should be similar to a full-screen display of the same video from another source (e.g. on a website).
What do you mean by 'massive lag'? Are the audio and video tracks out of sync, is the playback slow or buffering? You must expect an initial delay when the RMA activates, as the video file must be decompressed from the PDF file's data stream and transferred to memory for Flash Player to open. That can take anything up to three seconds depending on the hardware and size of the stream. -
Animated drop down buttons not working in movie clip
Hi,
I am working on this site: (AS2)
http://www.steamandclean.com/Index_w_1.html
I have two types of drop down menu. One under Commercial and one under Technical
The buttons are movie clips. The drop downs are also movie clips that start in frame 2 and are triggered on rollover.
The child buttons are buttons living on the drop down movie clips. They are set to getURL
As you see they are not willing to neither link to any url or will they run their move clip animation. One is a button and one is a movie clip.
The left movie clip has a mask, but it makes no difference if I remove the mask . It also has a emboss filter and no difference is I take that away either.
All of it is in one flash movie right now, but I will be splitting it up in a master navigation movie and individual swf's soon.
Right now I have the main movie, then the button MC then the dropdown MC and in the drop down MC I have placed either a animated (button) MC or a button. So it nested in nested in.......
In both cases I scripting the child buttons like this:
on (rollOver) {
gotoAndPlay(2);
on (rollOut) {
gotoAndPlay(6);
on (release) {
getURL("http://steamandclean.com");
I have also tried to use
_parent.getURL and _root.getURL in stead of just get URL, but it does not work.
The drop down buttons seem to be buried. In the left side the whole drop down panel seems to act like a link?
What am I doing wrong?
Can you help?
ggaardeHi Ned
Thank you for your reply again.
I figured it out.
Your reply prompted me to have my main button on rollover to go to a frame number on the main time line and then move the content of the drop down movie clip to that frame.
The drop down panel now work and the child buttons animation now work as well. I just had to find a way to make the drop down panel disappear on rollout. Since I could not script the actual drop down panel I created three skinny invisible buttons and placed them on the right, left and button of the drop down panel. I scripted them to go back to frame 1 on both rollover and rollout. Done.
See the result there:
http://www.steamandclean.com/Index_w_1.html
(Left side only)
Thank you for your help.
ggaarde -
[AS3] how do i use this angle in another lower level movie clip?
i'm tryin to use an angle from one movie clips to be part of
an if statement in another lower level movie clip. my code is
probably ugly but here it is. thank you in advance for the
helpi need to learn how to declair a variable (like angle) in a
lower level movie clip to use it in other movie clips is this not
correct?
var angle:Number;
please help -
How to play movie clips for a certain amount of time only
Hello everyone, I think I have a relatively basic question here but I can't figure it out. I have a movie clip loaded using action script 3 at the start of my animation, I want ito to end at the 120th frame. But I can't use the stop(); command because it will also stop the rest of my animations from the 121st frame onwards. So my problem is, how can I stop the movie clip without stopping the rest of my animations?
Thank you in advance!I don't think I have codes that load the swf, but I've sent you the code that I would like to stop. Thanks!
-
Help with smooth scrolling (masked movie clip)
Ok, I really need help here, and I'll be very grateful for
help before Monday.
Someone has made a movie with a different set of text on each
frame, the text goes out of the viewable area.
I have been asked to make these frames appear in a pop-up on
another flash and be scrollable.
i thought this would be easy...just cut and paste them into a
movie clip, then using a mask to hide the rest of the text.
However, it is going painstakingly slow.
Seems to be a performance issue, but it might be my code.
Any help with the code, or optimisation elsewhere would be
helpfully.
Heres a simplified version of the flash;
www.darkflame.co.uk/flashwork/Flash_popuptest.fla
Code for the scrolling;
_global.MoveUp = function(text) {
_root.ITproduct.IT_productlist._y =
_root.ITproduct.IT_productlist._y+6;
updateAfterEvent();
//trace('press');
Called and stopped by;
on (press){
//this._parent.IT_productlist._y =
this._parent.IT_productlist._y +10;
//_global.scrollon = "yes";
clearInterval(IntervalID);
IntervalID = setInterval(MoveUp,100);
updateAfterEvent()
//updateAfterEvent();
//MoveUp();
//scroll on
on (release) {
//this._parent.IT_productlist._y =
this._parent.IT_productlist._y +10;
clearInterval(IntervalID);
updateAfterEvent();
//scroll off
which is linked to a button.
I dont know if this is a actionscript problem, or the way the
page is made, or both.
Any help would be appreciated.
Thanks in advance,
Thomas Wrobelyou have extraneous graphics on-stage that are slowing the
scrolling (and even causing problems in the authoring environment).
here's your file with those graphics removed:
http://www.gladstien.com/Files.popupTest.fla -
Trying to access a specific movie clip with a string
Ok, what I am trying to do is create as many movie clips as I
need and then access those movie clips using string values. These
string values are stored in an array and coincide with a given
movie clips instance name. Check out the following code:
I think my problem is that Flash is trying to call movie clip
methods on a string instance. I'm not sure how to type cast in
Flash, or even if it is possible, but how would I access the
strings as movie clips?DuhChamp,
> I think my problem is that Flash is trying to call movie
> clip methods on a string instance.
Bingo.
> I'm not sure how to type cast in Flash, or even if it is
> possible, but how would I access the strings as movie
> clips?
Use eval() or the array access operator, []. Details here
http://www.quip.net/blog/2006/flash/actionscript-20/reference-objects-dynamically
David
stiller (at) quip (dot) net
Dev essays:
http://www.quip.net/blog/
"Luck is the residue of good design." -
Playing a Movie Clip within a Movie Clip on load
Hi,
I'm trying to play a Movie Clip animation that is within a Movie Clip after a button has been pressed in a different Movie Clip.
The issue is that all Movie Clip animations are playing as soon as the SWF is loaded.
I have a separate Main.as file that contains all of the coding except for the animation stops:
package
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
var title1:Title1;
var scene1:Scene1;
var scene2:Scene2;
var scene3:Scene3;
var scene4:Scene4;
var scene5:Scene5;
var scene6:Scene6;
var scene7:Scene7;
var scene8:Scene8;
var scene9:Scene9;
var scene10:Scene10;
public function Main()
title1 = new Title1();
scene1 = new Scene1();
scene2 = new Scene2();
scene3 = new Scene3();
scene4 = new Scene4();
scene5 = new Scene5();
scene6 = new Scene6();
scene7 = new Scene7();
scene8 = new Scene8();
scene9 = new Scene9();
scene10 = new Scene10();
addChild(title1);
title1.buttonStart.addEventListener(MouseEvent.CLICK,onButtonStartClick);
scene1.buttonWalkOutside.addEventListener(MouseEvent.CLICK,onButtonWalkOutsideC lick);
//title
function onButtonStartClick(event:MouseEvent):void
addChild(scene1);
removeChild(title1);
Scene1(parent).gotoAndPlay("frame1")
//scene1
function onButtonWalkOutsideClick(event:MouseEvent):void
addChild(scene2);
removeChild(scene1);
So right now, I'm getting this error:
TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Stage@46534041 to Scene1.
at Main/onButtonStartClick()
Any help is greatly appreciated... I've been grinding at this all night.I had been trying a bunch of different methods after searching for clues on Google, so it probably doesn't make sense with the parent.
I replaced the code with what you wrote, and I am given this error now:
Main.as, Line 44
1120: Access of undefined property scene1Text1.
Is there somewhere I have to declare scene1Text1 in Main.as? -
Finding the width of a JPEG loaded into a movie clip
I will be loading a page of bio information. Next to the
person's photo (photos will vary in width) I want to put a column
of buttons about 20 pixels to the right of the photo. So after I
load the photo into an empty movie clip, I'm trying to get the
width of the photo in order to figure out the x position of the
buttons next to it. Here is what I have:
myImage = "images/" + _level0.images[link];
loadMovie(myImage,image_mc);
// JPEG loads okay into image_mc //
trace("image_mc._x = " + image_mc._x);
// I get "Image_mc._x = 393" as expected //
trace("myImage._width = " + myImage._width);
// I get "image_mc._width = undefined" //
trace("image_mc._width = " + image_mc._width);
// I get "image_mc._width = 0" //
How do I find the width of the loaded JPEG?you are probably trying to get the width before the image has
loaded completely.. use the MovieClipLoader class to load the image
into the empty movie clip, then use the onLoadInit event to get the
movie clips's width(which is the images width);
var mcLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadInit = function(target:MovieClip):Void{
trace(image_mc._width);
mcLoader.addListener(myListener);
mcLoader.loadClip(myImage, image_mc); -
Referancing objects in the level above the movie clip
i want to referance objects in the level above the movie clip that i have the AS in. what i mean is that i have a movie clip on the stage, and that movie clip has some actionscript in it, and that AS needs to refer to an object on the main stage, how would i do that? i have tried parent and stage 1, but neither seem to work
ok, so let's say that i have a MC on the stage, then inside that MC, there's a frame, with some code attached to it. i want to referance another MC on the main stage, can u give me some example code on how to do that please, thanks
Maybe you are looking for
-
Error while file download to excel
Hi all, I have a requirement where i need to download the final output table data into excel sheet. I tried with the below logic. I am getting the pop up to open or save the excel sheet at desired location. But when I open the excel sheet,its showing
-
Mainstage 2: Suddenly no midi signal
Im running Mainstage 2.1.3 with Lion 10.7.5 Hardware is: Malletkat Pro (midi keyboard) --> Mbox 2 -->Macbook The concert is setup and running smoothly when suddenly Mainstage no longer recieves midi signal. Mainstage is not frozen, it simply stops r
-
Hello, Please help to understand how PI 7.1 treats different encoding formats eg ANSCI ect or how it handels properity chacters coming in messages? If PI 7.1 has started supported other encoding formats along with UTF - 8. I have seen many encoding t
-
Soundtrack Pro 5.1 export dropping levels
I tried searching, but can't find this anywhere exactly. One thing that seemed similar said to trash preferences or duplicate the project, or reinstall... and I don't really want to do that, but this problem makes no sense to me. I have a 5.1 mix I'm
-
Getting internal table definition
Hi all, Let's say that I've defined internal table based on internal type (not in dictionary). Does anybody know if there is some FM that could return to me definition of that table (how many fields, their types and so on). For dictionary based type