ActionScript 3.0 :: Stage Boarder - Ball Hit And Go In Reverse Way
Feb 13, 2009
I tried to modify this code so:
1- The boarder of the ball hit exactly the the boarder of stage
2- When the ball hit any boarder of stage it go in reverse way in different directions
Code:
stage.frameRate = 30;
ball_mc.addEventListener(Event.ENTER_FRAME, moveBall);
function moveBall(event:Event):void {
if (ball_mc.x < stage.stageWidth - ball_mc.width + 40&& ball_mc.y < stage.stageHeight - ball_mc.height + 30) {
[Code] .....
View 3 Replies
Similar Posts:
Oct 25, 2010
Boarder is appearing in HTML page before the swf file gets loaded. Problem happens only in iexplore. Is there any ways to fix this issue.
View 0 Replies
Nov 3, 2010
I have this code to make a ball bounce. it works fine, however, everything on the stage bounces. I only want the ball to bounce.
Here is my code
/* Actionscript 3.0 Bounce Effect. ball = movieclip instance name*/
var velocity = 0;
var gravity = 2;
var speed = 0.03;
var ground = 300;
Object(this).ball.addEventListener(Event.ENTER_FRAME, fl_bounce);
function fl_bounce(event:Event) {
[Code] .....
View 5 Replies
Jan 5, 2010
When I bounce a ball off the walls of the stage using the following technique.[code]Not only is the ball jumpy and skippy. but after so often it begins to go either in a vertal motion y = 5; x = 0; or a horzontal motion x = 5, y = 0. And stays that way. Why is it that the first method works fine but the other method works terrible. Could it be because the Math.cos and Math.sin returns very large decimals.I really prefer to use the second method.
View 5 Replies
Mar 8, 2011
I have a ball bouncing on a paddle. I want the "stage" to move vertically in order to always keep the ball centered.
View 2 Replies
May 1, 2005
I haven't done much actionscript stuff ...and at the moment im trying to make a ball bounce across the stage, but im unsure how to go about doing that.
View 3 Replies
Jun 22, 2009
I have recently started Learning Actionscript 3.0 out of my own interest. I was trying on making a ball bounce off the edges of the stage using the Actionscript 3.0. But the code not working. The Ball happens to move on X and Y, till it hits the end of the stage, and then it just does not reverse its direction to give the effect of bounce, it gets stuck to the X axis and moves out of the stage. I tried to make changes, but failed.
Code:
function bounceBall(evt:Event):void {
var vx:Number=Math.random()*10+5;
var vy:Number=Math.random()*10+5;
var radius:Number=mcBall.height/2;
var top:Number=0;
[Code] .....
View 2 Replies
Nov 4, 2009
I have a movie clip on the stage with the instance name "ball". In my code, I addChild(ball) to a Ball object called "mainBall". After doing that, I want to remove "ball" from the stage. Finally, I add addChild(mainBall) to stage. The code takes place in my Document class:
var mainBall:MovieClip = new Ball()mainBall.addChild(ball)stage
.removeChild(ball)addChild(mainBall)
From the code, I get the error: "The supplied DisplayObject must be a child of the caller".
View 4 Replies
May 1, 2005
I haven't done much actionscript stuff ...and at the moment im trying to make a ball bounce across the stage, but im unsure how to go about doing that.
View 3 Replies
Oct 29, 2003
I cant figure out how to make the ball move and bounce around the stage. and i also need help on the paddle that the ball bounces off of. if u could help me out that would be awesome.
View 11 Replies
Nov 5, 2009
I have added full screen code on my movie so that the user can extend the size of the movie. eg If the user expands the browser window to 1200 X 900, then my movie will become 1200 X 900 without the movie deforming.
Code:
Stage.scaleMode = "noScale";
Stage.align = "TL";
[code]....
View 3 Replies
Sep 2, 2010
How do I assign incremental names as each ball instance is placed on stage?
/*
w = width of circ
h = height of circ
c = num or columns
[Code]......
View 9 Replies
Jun 20, 2006
i wanna ask how do i make a ball bounce off something like a ball bouncing off a bumper in a pinball game? i've tried a lot of times but everytime the ball get stucked to the box and it doesn't move anymore...will be grateful if anyone noes the actionscript of it..
View 3 Replies
Oct 29, 2003
how to make the ball move and bounce around the stage. and i also need help on the paddle that the ball bounces off of.
View 11 Replies
May 27, 2009
methood of telling the stage to continue playing in reverse, after a button is clicked, until it reaches a keyframe that will tell it to stop? I'm trying to make it so buttons will tell the stage to play a transition from beginning to end and then have it play in reverse when the "back" button is pressed. I'm currently searching online to find an answer but I haven't had any luck yet.
View 10 Replies
Jun 5, 2009
ball collision inside another ball using gravity.I have one large circle in the middle of the stage (its radius is 150 pixels). I have another circle inside of that one (20 pixels radius), this is the smaller ball that I would like to have bounce around inside of the larger one with gravity. When the small ball hits the edge of the larger circle, I would like it bounce inwards to the center of the larger circle. It keeps doing this until it eventually stops in the center of the larger circle at the bottom.
View 1 Replies
Mar 9, 2005
I can't with this, that AS put leafs in the screen and move them on X axis from left to right, and I want the opposite, from right to left, and I can't fix the code, I thought the key was to change this:
Code:
moveLeaf = function () { this._x += this.speed;if (this._x>SW+10) {this._x = -10;}};
into this:
Code:
moveLeaf = function () { this._x -= this.speed;if (this._x>SW+10) {this._x = -10;}};
with that the movement goes from right to left just as I want but, when all the leafs appears on the screen, it stops from creating more.Here is the entire code:
Code:
kNbrLeaves = 15;
kLeafLayer = 100;
SW = 760;
keep track of width and height of stage
SH = 300;
// move leaves to the right
moveLeaf = function () { this._x += this.speed;if (this._x>SW+10) {this._x = -10;}};
// Initial Leaf setup
for (i=0; i<kNbrLeaves; ++i) {[code].....
View 3 Replies
Jun 18, 2009
So I have this mc: this.slidingMenu it's a mc of a ring shaped menu, which turn around when 2 button get clicked. When the button on the right, mc goes forward until stop(), when the button on the left mc goes reverse until the stop(). In the first case i use gotoanplay, and everything goes fine. For the second I use prevFrame, like this:
[Code]....
View 3 Replies
Jun 12, 2009
I am trying to get a ball from left to right I click in 28 and insert keyframe then I right click and click on create motion tween nothing happens. When I do this same thing on the sample one with the car this is what I get. and when I do the ball one sample2 it don't have the blue bar.
View 9 Replies
Oct 1, 2009
I'm a AS3 noobie and have a simple question:Quote:var ball:MovieClip = new Ball();var inc:int = 0;stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, false);
View 2 Replies
May 27, 2011
I am trying to throw a ball in an arc, either an arc going left or right.
Here is my code:
var gravity = 2;
this.velocity.y += gravity;
_angle = 5;
[Code].....
It doesn't really look like the ball is "arcing" at all, it seems to be more of a diagonal line?
View 3 Replies
Dec 6, 2010
I need to get my movie clip to move across the screen from (30,100) to (600,100). I have a ball moveclip which loops and looks like it is rotating, therefore I need to create the actionscript code to just move the ball from the points listed above and then it will look like its rolling.[code]But I am getting this error; Access of possibly undefined property x through a reference with static type Class.I have the movie clip named ball with a class of ball_mc and it is exported for actionscript, I dont understand what the error is trying to say?
View 3 Replies
May 15, 2009
I'm working on integrating Omniture into an Actionscript 2 custom written video player.Omniture is not playing ball at all and their documentation for their Actionscript component is very poor, and they don't provide tech support for it.
View 1 Replies
Feb 16, 2011
In a game I'm working on, I'm using the ColorTransform class to the turn the 'enemies' red as they fall off the screen after they've been hit by one of the player's 'missles' with the following [code]...
Can I somehow undo the ColorTransform to an enemy once it has been applied, or does he have to stay monochromatic thereafter?
View 2 Replies
Aug 3, 2009
how to hit a brick more than once with my ball created, i just want it to happen to random bricks only.
here is the coding;
Code: Select allpackage {
import flash.display.*;
import flash.events.*;
[code]....
View 1 Replies
Nov 20, 2011
I'm trying to make it so that when the ball hits the wall, it bounces off of it.. this is my code
Actionscript Code:
var elastic:MovieClip = _root.createEmptyMovieClip("elastic", 1);var point1:MovieClip = _root.attachMovie("sling", "point1", 3, {_x:50, _y:200});var point2:MovieClip =
[code].....
View 3 Replies
Feb 7, 2012
I am trying to follow and create a tutorial which explains how to make a bouncing ball.I am really struggling with the Action Script 3.0 even though the teacher types it in.I am inserting the code so that you can view it.[code]
View 3 Replies
Aug 20, 2009
The ball created below is drawn as a red ball I want also to write its name "red" and place it on the ball whatever the ball position on the stage is
[Code]...
View 3 Replies
Jul 27, 2009
I'm running a hitTestObject for when ball hits target1 - The working code works great below.
Is there a way to have the ball hit multiple targets? Instead of hitting just target1 can it return when it hits target1, target2, target3..etc.
[Code]...
View 2 Replies
Mar 13, 2011
Maths was never my strong point and I have been attempting to speed the ball up that I have in flash. The ball is dispatched like this;
[Code]...
It almost works, however the results are not consistent. Sometimes the ball gets faster, and sometimes it becomes extremely slow.
View 9 Replies