ActionScript 2.0 :: Generating Then Removing Randomness In Movieclip
Mar 23, 2010
I've created a movieclip for the homepage of a website. It is a series of images that are displayed in sequence.
However, I needed the movieclip to start at a random place when the page loads, so I used:
gotoAndPlay (random (1465));
on the 1st frame, which works fine. The problem is that once the movie reaches frame 1465 (the end) it jumps to a random frame again, instead of looping back to frame 1 as I would like.
How do I cancel the random frame function after its 1st use?
View 1 Replies
Similar Posts:
Feb 25, 2011
I have this line of code, it's a part of a code that generates mcs at random X and Y, it worked when I wanted it to spawn everwhere, but now i want to limit the X to 200 - 430 this is the code for spawning on all 640 (1-640) pixels of the movie:
this._x = random(640);
i've tried (200-430) but it acts as 200 minus 430 and I end up with the X being 0 somehow
Edit: Never mind, I got it... Here's how: this._x = 200 + random(230);
View 1 Replies
Jun 23, 2010
I was wondering if anyone could enlighten me as to how I could generate a rectangle movieclip on top of the longest section of a frame of a movieclip using AS3?
If this is the movieclip frame, I want it to find the longest portion of the movieclip on the right.
And then generate a rectangular movieclip on the longest section of the frame on the right side.
(Don't mind the white bg, I just used paint quick, it won't be there)
I can figure out how to generate the rectangle and all of that, but I am confused as to how I could determine the length of the longest portion of the movieclip, and how to tell AS3 to place it there.
View 9 Replies
Feb 23, 2011
I started converting this flex application to run on android using the new flex hero sdk.i already replaced all mobile-incompatible components and got it running a few times succesfully.
When I use the same libraries running the original webapplication it works perfectly.The big problem however are these random Invalid BitMapdata errors while starting the mobile application. Here's the whole output.
[Code]...
Now it seems to me that, wile running the mobile application, it is unable to find the image, as when I run the webapplication, using the same library where the above line of code is, it is able to find the image.
This problem has been haunting me for days now and I'm really starting to think this is a bug, especially because it sometimes DOES run. Or is there something I'm missing here.
View 1 Replies
Nov 13, 2007
So I've got 10 MovieClips on stage that animate in, and each MC has a stop command on the first frame. I then have this AS on the main timeline on the last frame when everything is in place:
Code:
this._lockroot;
// Random MovieClip Actions
[code].....
View 2 Replies
Dec 21, 2009
I get video into flash from this webcam, then I can add some graphic or animation the over this video, so I wanna know how can I convert this movieclip's(web cam's video + overlayed graphic) animation to flv or mov format? May be something with capturing frame by frame?
View 1 Replies
Dec 16, 2009
How do i use the on(dragover), becuase i am making a simple randomness game,(to start off) because i have something that you can drag, and i want to make it if you drag the thing over it it takes you to a new keyframe.Here is the movie clip i want to be drug on: (nothing happens)
Code:
on(dragOver) {
gotoAndStop(3)
}
Heres the code that you can drag the item(works)
Code:
on(press) {
startDrag(this)[code].....
View 1 Replies
Mar 25, 2011
How do I make visible a movie clip in the main movie from another movie clip when it loads? Not using addchild since the movie clip is on stage.
[Code]....
View 3 Replies
May 21, 2009
Is there a way to remove a class linked to a movieclip? For instance, I've got a ball (e.g. ball0_mc) that's placed in a target. The way the ball is dragged and dropped into a target is by using a class called Ball. What I would like to do is remove the Ball class from ball0_mc once it's been placed in a target so that it can't be dragged or dropped anymore.
View 2 Replies
May 16, 2010
Allright, this is what my code looks like:
ActionScript Code:
public function onRequestStart(navigationEvent:NavigationEvent):void
{
playScreen = new ZombieHorde();
[Code]....
When I do removeChild on playScreen, the movieclip just becomes invisible, it doesn't actually get REMOVED. Is it possible to delete a movieclip that you've created just like that?
View 3 Replies
Mar 14, 2007
im creating a game where when the spacebar is pressed the character attacks with a sword.the sword is an animated movieclip and at the end of the movieclip i have a his.parent.removeChild(this); to remove the movie clip but i get an errorCode:TypeError: Error #1009: Cannot access a property or method of a null object reference.
View 1 Replies
Oct 24, 2010
ok so im trying to use
stop();
addEventListener(Event.ENTER_FRAME,myFunction);
function myFunction(event:Event) {
[code]....
View 3 Replies
Sep 24, 2009
I have 5 movieClip buttons. I want the GALLERY button to stay on the stage at all times, "which it does" but i want when the user clicks on 1 of the other 4 buttons for the remaining 3 to disappear. Example...when the user clicks on the KIDS button, the COUPLES, PORTRAITS AND BELLIES buttons disappear, or when the user clicks on COUPLES, for the KIDS, PORTRAITS AND BELLIES buttons to disappear, and so on.
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
[code]......
View 16 Replies
May 10, 2010
I have 5 movieClip buttons. I want the GALLERY button to stay on the stage at all times, "which it does" but i want when the user clicks on 1 of the other 4 buttons for the remaining 3 to disappear. when the user clicks on the KIDS button, the COUPLES, PORTRAITS AND BELLIES buttons disappear, or when the user clicks on COUPLES, for the KIDS, PORTRAITS AND BELLIES buttons to disappear, and so on.
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
var currentPage:MovieClip = gallery_mc
[code].....
View 1 Replies
Feb 2, 2009
I have a MovieClip that I dynamically add other MCs as children to. Now I'd like to have a function that removes ALL children at once. I tried a loop with (i < mc.numChildren) but somehow it will only remove even-numbered children, the odd ones stay on stage?
View 12 Replies
May 27, 2010
I have random buttons on the stage that I have set up so each one, when clicked, will load different movieclip.These movieclips load directly on top of each other in the exact same place.The problem I'm having is the previous movieclip does not clear off the stage when the the next button is clicked.I need to set up a condition that will remove the current movieclip when another button is selected to load the next movieclip.Below is part of my code that needs editing. I've been researching switch, else, and other conditional statements but can't figure out how to make this happen.I have the fla or swf file for viewing, let me know.
// Event Listenershempelbtn.addEventListener(MouseEvent.CLICK,btnActions);fourtyonebtn.addEventListener(MouseEvent.CLICK,btnActions);draycottbtn.addEventListener(MouseEvent.CLICK,btnActions);eg
[code].....
View 5 Replies
Dec 21, 2011
I placed a movieclip on the stage, what functions are there to remove it?
removeMovieClip(target);
Only seems to work on MCs which have been attached to the stage E.g.
attachMovieClip();
The _visible property keeps the movieclip there just keeps it invisible. What completely removes it? It is called tankCPU.
View 6 Replies
Jan 26, 2009
In my document class I have assigned the root of fla to theRoot movieclip as theRoot = MovieClip(this.root); And as my program proceeds I have added several childs to theRoot. Now at the end of my program I need to delete all the childs of theRoot. So,how can I do this without individually deleting single childs.
View 1 Replies
Jan 28, 2009
In my .fla file, I have a MovieClip (we'll call it Clip1) linked to a corresponding class defined in a separate .as file.There's a case where I want to create a new MovieClip (Clip2) where Clip1 is, then remove Clip1. This case is dealt with by a function in Clip1's class.So, when I get to removing I do:ActionScript Code:this.parent.removeChild(this)Now, if the DocumentClass created Clip1 and placed it on the screen, this goes fine. But if Clip1 was placed on the stage in the .fla file (by dragging and dropping), it looks like Clip1 is not removed. I think it does get removed, but for some reason it gets recreated. This is the problem.
View 9 Replies
Nov 30, 2009
i am having trouble with removing a movieclip off the stage, i am using removechild but i get an error:
ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
at flash.display:isplayObjectContainer/removeChild()
at agptest_fla::MainTimeline/removeArrow()
here is my script
ActionScript Code:
var aLeft:MovieClip = new arrowLeft();
var n1:Number = 0;
[code]....
View 1 Replies
Jan 11, 2011
I have a function called changeMovie which is supposed to load a new movie/swf into a already established container.I can get the new movie to load (all these movies have sound embedded in them) but I can not figure out how to get the old movieclip out of memory.I can foresee an instance of memory overload in my application down the line.I am using Flash CS3 with AS3.[code]As it stands now, I can get the new movie to play and be shown but the old movie clip still continues to play "in the background - along with its sound".
View 9 Replies
Apr 25, 2011
I've currently got an array made up of Movie Clips, and a variable to tell us how long that array is. It looks like this:
ActionScript Code:
var coinArray:Array = [coin1, coin2]; //an array which contains all of the coins
var numCoinArray:int = coinArray.length; //how many objects are in the coinArray
I've got a function called collisionTest which tests a collision between two objects.
So, I've got a loop set-up so if my character and a coin collides, it removes the coin it collided with from an array. It looks like this:
ActionScript Code:
function coinCollect(evt:Event)
{
for (var i:int = 0; i < numCoinArray; i++)
{
[Code].....
Is this trying to reference my objects as something other than MovieClips and is finding them and not recognizing them? I'm completely lost on this and can't understand why it doesn't work.
View 8 Replies
Feb 1, 2003
I've seem to have hit a snafu in a small animation I am creating for my next tutorial. What I have, is a movie clip that gets duplicated when the space bar is pressed. The movieclip has actions setup so that when the movieclip reaches a certain y value, it will remove itself via this.removeMovieClip()
The problem is, every movie clip that is duplicated does remove itself like it is supposed to. The exception is the original movie clip that I duplicate from. That movie clip seems to want to stay and cause problems (it is not removing itself because it isn't duplicated via attachmovie or the duplicateMovieClip method).
View 6 Replies
Apr 5, 2007
i have this function that everytime i click the screen a box appears.
function box () {
_root.onMouseDown = function(){
movie = _root.attachMovie("mcBox", "mcBox", _root.getNextHighestDepth());
[code].....
View 3 Replies
Nov 13, 2009
How do I completely remove a movieclip? I am able to create a moviecilp, then add it to the stage with addChild(), then I am able to remove it from the display list by using removeChild()However, the movieclip is still present. Here's what I did.I created a movieclip.. which has a trace on the 10th frame : trace("Movieclip still exists")On the 20th frame I have : a reference to a function which is on the document classThis function is this
Code:
function removeMC():void{
removeChild(mc)
[code]....
View 7 Replies
Nov 30, 2009
I've very new to using Flash with AC3. I've got a small project that reads infomation in from XML files and creates a very two simple menus. The first being the years 2009,2008,2007 etc. (yearMenu_mc). When I click one of these it reads another xml file and builds another menu below (subMenu_mc). This is all working. What I cannot get to work is when I click another year I need it to clear the previous menus text, it just seems to keep over writing and I end up with text that I cannot read anymore. The code I've posted and tried works in one respect it does in fact reset subMenu_mc and I get clear text, but it seems to get rid of the background colour I had set for subMenu_mc.
Code:
import scripts.*;
Variables
var myFont=new fontArial();
var margin:int=2;
var link:String;
var cWhite=0xFFFFFF;
var menuTop:int=-8; /* menu top margin */
var tb:TextField;
[Code] .....
View 1 Replies
Mar 7, 2010
I am using AS2. The character, a robot, has machine guns that fire off bullets. I am trying to get the bullets to disappear when they hit an enemy. They do dmage, but for some reason they are still there. Here is the code I use to attach and delete them.
Actionscript Code:
if (bulletReady == true && dead == false && Key.isDown(1) == true) { for(x = 0; x<machGuns.length;x++){ bulletReady = false;
[code].....
View 2 Replies
May 26, 2010
I'm trying a shooting game from an incomplete tutorial online. I'm trying to finish it off myself and hopefully learning more in the process but straight away I've hit a brick wall.The stage is 900 x 350. Bullets are fired from a turret near the center of the screen and will travel and eventually leave the stage at some point. I want to remove the bullet from memory and the display list once it has left the stage and can no longer be seen.I'm using a conditional if statement to check the x and y position of the movieclip, and if it outside the width or height of the stage then I want to remove it completely.
PHP Code:
stop();var angle:Number=0;var radiansToDegrees:Number=180/Math.PI;var degreesToRadians:Number=Math.PI/180;var currentTurretRotation:Number;var
[code]......
View 4 Replies
Nov 24, 2010
I have some odd behavior while removing a MovieClip. I create a MovieClip (character) in an empty project on an empty stage (the movieclip is made up of several other clips for arms, legs etc.)[code]Then it keeps climbing for a while and then jumps back down to:126095360.Then it keeps climbing again -> jumping back -> climbing - jumping back. But each time it jumps back it has a little extra memory added. I can understand the first time memory increases after adding and removing the movieclip. Obviously the Garbage Collector needs some time before kicking in. However, why does it start to increase again and again?I noticed the memory usage instantly jumps back once I remove the MovieClip. However, It will still be increasing afterwards.
View 4 Replies
Jun 26, 2009
I've got a movieclip animation which is added to the stage at the start of the .swf.Its an introduction to the game, and the user is encouraged to click on the movieclip to start the animation.Once the animation is finished I'd like the movieclip to be removed from the stage.Do I need to setup some sort of event handler which listens out if the movieclip has finished then start a function once its finished to remove it from the stage? Which methods look out for movieclips finishing?
View 1 Replies