ActionScript 2.0 :: Make Random Moving Object Disappear After A Certain Time?
Feb 26, 2006
I've just finished using this bit of simple code to get an object to move around randomly. What I want to do is try and get it to disapear or move off the stage after say a minute (with a countdown clock in the corner starting from a minute and counting down).
View 1 Replies
Similar Posts:
Jan 16, 2012
I have script like this to drag an object a1 to a different location for a matching exercise.
ActionScript Code:
a1.onPress = function():Void {
temp1 = a1._x;
[code].....
View 2 Replies
Jul 29, 2010
I have squares that make up the background on my stage. I would like to have the squares fade out one by one using code.
View 2 Replies
Jan 24, 2010
I am a learner. I am using one object which animates from a corner and comes to the middle of the stage (Using Motion Tween for animation). What I need is when it comes to the middle of the stage it should disappear from the stage. How it is possible?
View 1 Replies
Feb 15, 2012
So, here is what I'm trying to do. I have a page full of characters for a project I'm working on now, and I want to add some interactivity to the page by making each of the characters clickable and having a description of the character pop up that you can then close. I have included 3 images of what I'd ideally like tohappen.Picture 1: The page in just a normal state, nothing happening.Picture 2: On rollover, I would like the character to pop out and enlarge.I know how to make it enlarge on rollover, but I don't understand how you would make it come to the front above other layers. with understanding how to do.
Picture 3: I want a description like this to pop up when you click on the character. I have a layer at 50% opacity to fade the background out as well. I need to know how to:1. Make this image show up when you click on the respective character.2. Make this image disappear when you click on the red X button at the top right
View 10 Replies
Feb 8, 2010
I'm currently working on a game that has multiple 'scenes' located on each frame. In one scene, if you click on an object it disappears. I did this using the visible = false method. However, anytime you return the scene after, the object is visible again. How would I write the code so that it stays invisible permanently when you click it, regardless of whether or not you leave and later return to the scene?
View 4 Replies
Feb 24, 2011
a) A full moon is there on the screen in which Name and Password field is there.
b)The movement the user types his name and password and after pressing enter the moon should fade for some other animation.
Is action script needed for this?.
Am just a sort of general flash animator I don't know how to do things differently.
The animation further should continue where a steel door should open, two velvet ropes should be pulled aside which will make the bookcase wall swivels around to reveal the next animation
how to achieve point a and b.I will try pondering the rest on opening the steel door and pulling the velvet ropes that swivels the bookcase and goes to reveal another animation....
View 1 Replies
Aug 2, 2011
I have an object called point that I can move around the screen with my mouse. This object has a vector mapped through it (_v1) using the center of the stage and "point"s x,y location in order to draw the vector (note all of this is working fine). My problem is occurring when I set up was a button that simply sets a value to true if you press it. The idea behind this button is that when pressed, whatever location "point" is at, it will move 1 degree clockwise in a circle around the center of the stage (this is all happening in the frameHandler so I can keep clicking the button to make it continue around the stage).
The code I am using is based in an if statement listed below:
if(clockwisePressed) {
var v1angle:Number = _v1.angle;
v1angle++; //increase the angle by 1 degree
if(v1angle>180) {
v1angle -= 360; }
[Code] .....
So what is happening here is that clockwisePressed has been set to true so this fires off. My vector (_v1) is set up to tell me the angle (already converted from radians to degrees) but it's a read-only value. So I assign it (_v1.angle) to v1angle so I can mess with it and increase it by 1 so I'm moving clockwise around the center of the stage. Then I just check to make sure that it falls into a range between -180 and 180 (if I trace _v1.angle around the stage, 0 degrees is to the left, 90 degrees is straight up, 180 degrees is to the right, and -90 is straight down). Now using the formula I derived from this thread but converted to work with 0 degrees pointing to the left and the value for Y going up the further down the stage you go, I came up with
x = centerX - radius * cos(angle)
y = centerY - radius * sin(angle)
Now when I make a sample chart on paper and use these values on my calculator, this works like a charm. If I plug in an angle, the radius, and center I get a point right on my circle I draw on a sheet of graph paper. However, when I actually try this in flash, the "point" jumps all over the stage. (Note that _v1.m is just the magnitude of the vector between the center of the stage and "point" which is the same as the radius). So I trace everything and the values for cos and sin don't seem to be coming out right. For example, if my angle is -1.9581 and I take the cos of that on my calculator I get something along the lines of 0.9994 but flash traces Math.cos(angle) to be -0.3777. Isn't using Math.cos(-1.9581) the same as putting -1.9581 into your calculator and hitting cos?
Below is the corrected code that works:
if(clockwisePressed) {
var v1RadAngle:Number = Math.atan2(_v1.vy, _v1.vx); //get angle in radians
v1RadAngle += 0.0174; //increase the angle by ~1 degree more or less
//Now just move the crosshair and get it ready to be redrawn
point.x = centerX - _v1.m * Math.cos(v1RadAngle); //_v1.m = radius
point.y = centerY - _v1.m * Math.sin(v1RadAngle);
clockwisePressed = false; //remove button pressed boolean
}
View 1 Replies
Apr 13, 2011
Im working on a small project and it involves a guy which you move with the arrow keys. The arrow keys add to his x, y velocities and his position is updated accordingly. How can i get this man to grab onto an object and spin around it (like when you grab pole and letting your momentum swing you around) . I can make him grab the object but I dont know how to modify his x,y speeds to simulate the arc.
View 4 Replies
May 9, 2006
i'm using the an actionscript for random movement that i found here... [URL] but my problem is that i need the object to flip horizontally depending on the direction it is moving... the object that is moving around is a bug, and i need it to face left if it's moving left or face right if it's moving right.
View 1 Replies
Nov 5, 2010
I've been trying to use random to make something happen a certain percentage of the time. For example, for making the scientist go to frame 91 half the time and 181 the other half, I was using this code:
[Code]...
View 2 Replies
May 14, 2003
How do you make a movie clip play at a random time? And keep on playing at random times until the flash movie is over.
View 1 Replies
Jun 27, 2010
Currently I'm trying to make a basic game (using AS 2) but I'm having trouble getting the basic physics to behave. I have a ball which is supposed to fall until it touches the ground. It can also be dragged around the screen by the cursor.I want the ball to fall only if it isn't being held, but for some reason the condition isn't working properly. No matter how I structure the condition, the ball still falls even when it's being held (in fact I can move it from side to side, it is still being held even though it's falling downward).I've tried putting this on the ball to make it fall conditionally:
Code:
onClipEvent(enterFrame){
if(hitTest(_root.ground1) == false){
[code].......
View 2 Replies
May 12, 2010
I have a photon particle moving across the screen the disappear when it gets to a certain point, but when the photon goes to call its Destroy () function it throws this error: ypeError: Error #1006: value is not a function.Here is the class:
ActionScript Code:
package
{
[code].......
View 3 Replies
Nov 28, 2010
I have some simple script that has 2 "movie clips". What I want to do is to start moving the second movie clip at the same time when the 1st starts moving. (both start moving at the same time) I tried the following script but it never works:
[Code]...
View 3 Replies
Dec 25, 2002
how to stop the script when it's running.To make the sky no more snowy and make snow disappear.
View 1 Replies
Jan 20, 2010
If I have a button on my screen that I want to make a box appear when clicked, how would I go about doing that? It also needs to disappear after 10 seconds. I am not sure if this is an issue, but it needs to appear on the screen while everything else is happening underneath it. So the rest of the animation must continue on as this appears above it.
View 7 Replies
May 3, 2010
What I want to do is to get the movie to display random images (from a selection) for random amounts of time (subject to minimum and maximum times).
View 3 Replies
May 4, 2010
This is something I used to know how to do in the first versions of actionscript, but I've been away from flash for a few years and am utterly lost. What I want to do is to get the movie to display random images (from a selection) for random amounts of time (subject to minimum and maximum times).
View 2 Replies
Jun 5, 2010
I could use some help on a bit of code for a shooter game I'm working on. I have enemy objects that appear on screen or move around on screen and I need help with code so that when you click on the object is disappears from the screen.
View 3 Replies
Jul 22, 2009
I have a map application where the user mouses over the various counties, and clicks on it to zoom in. I am having a problem synchronizing the background change with the county zoom.referably, I would like the background to zoom out with the counties as they zoom, but having the background fade to white would work just as well. I created a movie clip of the main map (background) to zoom in, but I don't know how to play 2 movie clips at once.You can see it in action here:
View 1 Replies
Dec 12, 2011
I have a rectangle drawn on the screen. I exported the center of the rectangle for action script. I have an instance of the center exported rectangle overlaying my main rectangle. I do this so that I can change the back color with actionscript. I have the blending property of the overlaying rectangle set to overlay so that borders of my original rectangle are visible.
My problem is when I scale the flash window the borders of my rectangle sometimes dissappear.
View 6 Replies
Jul 23, 2011
I have a grid of objects that have been added to the stage dynamically, the objects are either of a Class Red or Class Blue, how do I perform a hit test on the Classes? I want the Blue object to disappear once it hits a Red one.
View 3 Replies
Dec 1, 2011
I'm not real sure what I'm doing wrong, but once the array is validated the movie should go to the next frame(3)--which it does however my objects disappear. The AS below is in the actions frame 2. The objects span from frame 2 to frame 3, so I'm not real sure why they'd disappear.
[Code]...
View 0 Replies
Sep 16, 2003
I want the cursor to disappear when it rolls over an object, then reappear when it rolls off. It works when I run it in Flash, it works when I view the html in Internet Explorer, it DOESN'T work in Netscape. The cursor disappears and doesn't come back till you move it out of the navigator window. Here's the code:
on (rollOver) {
loadMovie("movie.swf", place);
mouse.hide();
} on (rollOut) {
loadMovie("blank_movie.swf", place);
mouse.show();
}
View 3 Replies
Nov 7, 2008
I have a movieclip - instance name "popup clock" . The frame on which it is on has the following code:
Code:
popupclock._visible = false;
The movieclip starts off invisible like it should. I also have a button which has the following code:
Code:
on (release) {
if (popupclock._visible=true) {[code]..
The code should allow the button to make the moveclip appear and disappear but it doesn't work?
View 4 Replies
Sep 7, 2009
I basically am suppose to make "scarf" drag over to a movie clip named "winter_mc" and when it is on it, it is suppose to disappear but it's not disappearing. Here is my code used in the scarf:
Code:
on (press) {
startDrag(scarf, true);
}
[code]....
View 5 Replies
Oct 5, 2010
I have a project that has 6 movie clips across the stage that are triggered by mouse click. The trouble I'm having is getting them each to dissapear when the next movie clip is triggered. You can click out w/ an "x" box but I want them to dissapear when the next mc is triggered also.
Code:
var mc:handfade;
hand_mc.addEventListener(MouseEvent.CLICK, handPage);
function handPage(e:MouseEvent):void
[Code]....
View 21 Replies
Feb 4, 2011
I have a Flash website that consists of 6 different Scenes. The Home scene and the Videos scene each have a FLV player that I dragged from the library and I called it "vid". So I'm basically using the same player for both scenes. I'm also using the caption component and am assigning the xml via actionscript when the user clicks on a link, so it reloads the player with the correct video and the correct captions. The problem I'm having is that say they are watching the video on the Home scene with captions. If they click on the Contact Us scene, the video player disappears, but the captions stay on the screen by themselves. Looks really odd. I need a way to turn off the captions (called the component "myCaps") so they disappear both when changing scenes and changing movies. On the Videos scene, if you click a different movie's link, the old captions form the last movie stay on screen and just move up a line and the new movie's captions appear below that one. So, how do I get rid of the captions when I don't want them?[code]...
View 15 Replies
Jan 12, 2012
I have Google Map working just fine. When I click "where we are" Google openes up no problem but when I click on another button let say "about us, Google stays in the background [code]...
View 2 Replies