ActionScript 3.0 :: HitTestObject On A Tweening Movieclip?
May 11, 2011
I'm trying to make a fish controlled by direction keys catch some random color shapes thats falling on screen... i made the fish move and the shapes fall but when now i cant do it catch the shapes.. looks like it doesn't make the hitTestObject
there is my code:
Code:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
[Code].....
View 8 Replies
Similar Posts:
Jun 23, 2009
I have been using TweenLite for all of my easing. I was wondering what the code is for having a button inside a movieclip not active while the movieclip is tweening.Then when the movieclip does finish tweening the button then becomes active.
View 2 Replies
Sep 25, 2009
I'm trying to make a simple maze game. I have movement working, and now I'm trying to implement collision. Here's what I have:
An 8x8 grid, with walls of length 1 to break the grid up into a maze. the walls are instances of a movieclip I've named "mc_wall" a guitar-pick-shaped chip I'll control the movement of a cross-hair called "arms" that will check if there are walls immediately surrounding my chip by way of collision. "arms" is a movieclip made up of four individual movieclips: "uparm", "leftarm", "rightarm", and "downarm"
I have currently named each instance of "mc_wall" to be "wall" this is the code I have now (using only right as an example):
function moveRobot(event:KeyboardEvent):void
{
doslide = true;
if (event.keyCode == Keyboard.RIGHT)
[Code]....
this will work, causing the chip to remain in place if the rightarm detects "wall", and move if the rightarm does not detect "wall". My problem is that, although I have named every instance of "mc_wall" to be "wall", the only "wall" flash will recognize is the last one.
Is there a way to adjust this code to look at all 70-or-so instances of "mc_wall" instead of only the last one?
View 1 Replies
Nov 5, 2010
I would like to detect a collision between a named MovieClip on the stage and an instance of a MovieClip from the Library which is created dynamically.
at the moment I'm putting all the dynamic instances in an Array and then I loop through all of them to see if I'm colliding with any of them, which I think is not great:
for each (var zz in corridors){
if((map_player.Ndist1.hitTestObject(zz) == true)&&(zz is brick)){
...
I'd like to remove the loop and do the hit test and do something like
if(map_player.Ndist1.hitTestObject(is brick) == true){
...
but of course that does not work
View 5 Replies
Jun 5, 2009
I have two movieclips that I would like to interact with eachother (in this case, lets just say its a ball that I throw, and the ground). The problem that I am having is that the ball has its own .as file that determines its gravity and x/y directions depending on mouse position (those values are called in the main actionscript)
Is seems like hitTestObject can not find the Ball movieclip because it is not added to the stage or display list until I click the mouse.
[Code]...
View 5 Replies
Jan 14, 2009
Is there ant way to run a hit test on any child within a MovieClip. I am trying to create a maze MovieClip which contains a number of Wall children. I have an object that needs to know when it hits a wall. This is the code within the object:
package {
import flash.display.MovieClip;
import flash.events.Event;
public class Mousey extends MovieClip {
private var Root:MovieClip;
public function Mousey(m:MovieClip) {
[Code] .....
View 14 Replies
Sep 11, 2010
Trying to do hitTestObject on instances that are dynamically placed on the stage. Receiving an error:
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/_hitTest()
at flash.display::DisplayObject/hitTestObject()
[code].....
View 1 Replies
Jun 3, 2009
I have a circle_mc on the stage. Then I create randomly placed 20 squares (square_mc) on the stage. I can move my circle on that stage, and all I want is to check hitTestObject(or any *yet unknow for me* method that gives a result) if circle touches any of squares. Then I need to remove that touched movieClip (square) from the stage. hitTestObject checks if 2 specific objects are touched. My question is how to know which square is which, and then if it touches with circle_mc to remove it from the stage.
Code:
Select allif (circle_mc.hitTestObject( ?whatHere? ) ) {
?whatHere?.removeChild( ?whatHere? );
}
View 2 Replies
Apr 28, 2011
I have a bullet object and a boulder object (both movieclips originating from JPEGs) in my AS3 game. The trouble I'm having is with hitTestObject for the collision detection, as it's taking in to account the transparent areas and basing the collision on the bounding boxes surrounding the movieclips. This is a problem because the collisions are not accurate and if the bullet (long and thing line shaped) is at an angle...the bounding box is quite large around it...and it's "colliding" with the boulder even though it's visibly many pixels away. Is there a way to detect MovieClip collisions that ignore transparent areas?
View 2 Replies
Mar 19, 2011
I have a main.fla and few movieclips inside it.Lets take t1_mc for instance which has a button called next inside it
Code:
next_btn.addEventListener(MouseEvent.CLICK, goNext);
function goNext(event:MouseEvent){
[code].....
View 8 Replies
Apr 13, 2012
i want my character to walk down the screen and hit the objectWall and then a movieclip then gets added to the stage and plays but it doesnt seem to work and ii dont know why.
[Code]...
View 1 Replies
Aug 19, 2011
I'm filling arrays from a XML. These arrays have dynamic textFields inside them, and these textFields are childs of a movieclip.
I tween this movieclip, therefore making the array of textFields animate on the stage one by one. There are two sources of XML, one from an actual site, and another from a XML stored in the hdd. First i fill the arrays of textFields, and then animate the movieclip. I do this for the first one, then animate it, do it again for the 2nd one, animate it, again for the 1st one, animate it, so on so on.
myTween = new Tween(mc,"x",None.easeNone,sizeOfStage,0 - mc.width,mcSpeedAuto,true);
my tween ends at 0 - mc.width, the problem is, if i tween first the
"bigger" XML, when the next one which is smaller gets tweened, there's loads of empty space before it tweens the big one again (tweening whitespace?).
myTween.addEventListener(TweenEvent.MOTION_FINISH, onFinish);
onFinish i clear all the arrays (otherwise the tweening of the 2nd one would still have information of the 1st one e.g: 1st has 25 fields, second has 10, 1st shows it's 25 fields, 2nd shows 10, and the 15 that were left from from the 1st one) and call the tween on the 2nd one. I thought that by doing this i'd be clearing all that white space too, apparently not. I think the mc.width just keeps the "bigger" value and always tweens with that, taking longer to end in the 2nd case. I've tried setting the mc.width as the sum of textfield width's everytime i fill the arrays, but this hasn't worked either
View 1 Replies
Oct 22, 2009
First of all: this is my first post at actionscript.org *happysound*. I'm working on this flash gallery since a couple of days and something is drinving me crazy in actionscript.
The concept: in this part of the flashfile i'm loading thumbnails in dynamicly created movieclips on stage (1.jpg, 2.jpg, 3.jpg). Everything is working fine, but now I wanted to add some fancy fading when the loading of a single thumb completes. For some reason I can not get the tweening class working and I'm sure it's a problem with the referencing to the clip. I know this cause when I change "thumb"+i to thumb1 it is working. Googled for hours without result..
[Code]...
View 5 Replies
Mar 31, 2010
the mouse_over state im doing tweens the alpha of a button to reveal more buttons underneath.The only problem with tweening the alpha of a MC is that I cant click on the buttons underneath, only a graphic. However, I cant figure a way of just using a graphic symbol instead of a movieclip.And I really dont feel like using more than one frame, that is accepting defeat in my oppinion. ha
View 11 Replies
May 7, 2005
I would like to make a movie clip's height change when it is clicked. However, I can't figure out how to do it so that it smooth like a tweening.
View 4 Replies
Feb 4, 2010
Is anyone else having trouble with the new tweening in CS4? Every time I enter a numeric value to position a movieclip it changes it! I'm getting very frustrated trying to do the simplist things - even when I move the clip manually it puts it back where it was. Am I missing something here?
View 5 Replies
Jun 29, 2008
I am trying to animate a navigation menu so that when you roll over an item (say "Contact Us"), it moves up a bit, and the rest of the items blur.
I allllmost have it working but there is one piece of code that is no longer working (blurTween.onMotionChanged) since I put it into a for each loop in order to go through the array and apply the blur filter to each item.
So my code is as follows:
Code:
import caurina.transitions.Tweener;
import flash.filters.BlurFilter;
import mx.transitions.Tween;
[Code].....
View 8 Replies
Oct 7, 2009
I'm trying to tween a large image 6917x1500px. I'm moving the x,y and scaling this image. It's a jpeg, and the image really chuggs at certain sections. Has anyone tweened an object this large before? Should I be trying tween lite? I don't think that will work, because it just has less settings.
View 5 Replies
Jul 27, 2009
I'm getting the following error: Motion tweening will not occur on layers with ungrouped shapes or on layers with more than one group or symbol. I don't have any ungrouped shapes (it's all text), each layer has 5 instances of only one symbol (keyframes), no objects are grouped and text is all static text.
When watching the animation, the first word (web) looks fine, on the second word (design) the tween fails on the last couple of frames of that clip (the blur filter disappears), the third word (and) is OK, and on the forth word (development) the blur filter is not applied to the last 16 frames of that clip.I broke each animation into its own MC thinking that was causing the issue, but that didn't fix anything.
View 5 Replies
Apr 27, 2011
I have a function that states when movieclip1 is dragged and hits a line then it stops the drag, however it seems to stop the entire drag function in the swf on the other movieclips even though they arent called in the function.[code]
View 1 Replies
Apr 8, 2010
In my program, the movieclips are randomly added on the stage, If I want to check whether two movieclips from different classes is colllided.As far as all the moveclips are of the different classes which are randomly added on the stage in my program,for the use of hitTestObject(), I find that I need to have two movieclips identified so that the command will be:
mc1.hitTestObject(mc2)
maybe I may ask, before I add a mc on the stage "addChild(mc)",I will call a function to do the hitTestObject command "mc.addEventListener(Event.ENTER_FRAME, hitTest)"so that I can call evt.target to be mc1, is that true or not?
View 14 Replies
Jan 5, 2012
Im've created a timer that starts every 1 second. This is the code what's happening every 1 second.
var Random_Value_X:Number = Math.ceil(Math.random() * 1500);
var Random_Value_Y:Number = Math.ceil(Math.random() * 2000);
var enemy:MovieClip = new AI(stage);
addChild(hero);
enemy.x = Random_Value_X;
enemy.y = Random_Value_Y;
Ok. Then I got the class called AI where I've made it so the AI follows my player. The thing is, I need to make a hitTest that testes if an AI hitting another AI? Is there a way I can give every new AI a ID? Like the first gets called "AI1" and second AI2" and then I can make a code that says like If(AT1.hitTestObject(AT2 || AT3))
View 1 Replies
Sep 12, 2009
I am trying to develop a basic game engine for a slime soccer style game where a player can move around and jump. I am still fairly new at AS3 but managed to put together this working bit of code that the game currently runs on:
Code:
stop();
//vardefs
var runSpeed:Number = 10;
var blueGoals:Number = 0;
var redGoals:Number = 0;
[Code]...
View 4 Replies
Jan 9, 2012
I have children being added to the stage, and they all have the same name:
[Code].....
and then inside them I have them looking for a hit test of any movieclip with the name art_crab, but I keep getting a null response...
[Code]....
how i can make sure that they collide and i dont get this response?
View 7 Replies
Nov 13, 2009
I have a project with four circles moving randomly on stage (ball_mc1..ball_mc4). There are four walls making a box (wall1..wall4).I've created arrays for both myCircles and walls.When myCircles hit walls, I would like to change the direction of myCircles depending on which wall they hit.
stop();// walls or limits and their arrayvar walls:Array = new Array (wall1, wall2, wall3, wall4);for (var j:Number=0; j<walls.length; j++);
// circles in arrayvar myCircles:Array = new Array (ball_mc1, ball_mc2, ball_mc3,
[code].....
View 11 Replies
Feb 7, 2011
I have section of code which works for bouncing some fish movie clips off of the 'ceiling':[code].....
However, I would like to find a more succinct way to program this using a 'for loop'. I tried the following, which did not work and gave me an error (posted at the bottom). [code].....
TypeError: Error #1010: A term is undefined and has no properties.at Function/<anonymous>()
View 3 Replies
May 12, 2011
Im trying to get Flash to rember if the logo_mc has been hitTested with the holder, and if it has when the movie is played again it appears in the box and not the original spot
var mySO:SharedObject = SharedObject.getLocal("ObjectPlace");
var logo_mc:Sticker = new Sticker ;
addChild(logo_mc);
[code]....
View 1 Replies
Nov 30, 2011
How do I get the x,y position of hitTestObject? Since I want to obtain the x,y position where the hit test occurs and add a movieclip on that specific point....
View 2 Replies
Jan 16, 2011
I have a MC called 'playerP" and inside of it with 7 different MC. I can't seems to hit test on the children MC, it always show [object position_2]
private function cMove(e:MouseEvent):void
{
trace(MovieClip(playerP.RR), playerP.PT)
[Code]....
View 1 Replies
Feb 8, 2012
I am building a pacman style game, and I am looking to shorten my code.The stage contains 92 instances with instance names of food1, food2, etc.When the player(pacman) hits one of the instances Im wanting to call a funcion.I started writing it out like this... it works but I don't want to duplicate this 92 times!
if( player.hitTestObject(food1) ) {
updateScore();
}
if( player.hitTestObject(food2) ) {
updateScore();
}
Now I'm trying something along these lines, but with no success yet.
function collectFood() {
var i:Number;
var pGroup:String
[code]....
View 1 Replies