ActionScript 3.0 :: Flash - Play A Movieclip When Dragable Object Hits Its Target

Aug 15, 2011

I've got tree movieclips called: greenpip(this is the dragable object, which is visable), greenpip_target(which is invisible, but becames visible when greenpip hits it, and grrenpip is becaming invisible) and then the third one: greenpip_flask (which is the animation I want to play when the greenpip hits the greenpip_target).
Everything works but I don't know how to make the greenpip_flask play, when grrenpip hits the greenpip_target. This scenario takes place three times with three sets of objects

View 5 Replies


Similar Posts:


ActionScript 3.0 :: Game Loop - Detecting When Object Hits MovieClip

Jul 17, 2010

I'm trying to program this code:
public function enemiesDie(){
enemyLoop: for (var k:int = enemies.length -1;k>= 0; k--){
bulletLoop: for (var i:int = bullets.length -1; i>=0; i--){
if (enemies[k].hitTestObject(bullets[i])){
trace("hit");
[Code] ....

To detect when a bullet hits an enemy in a game I'm trying to make and I get this error:
TypeError: Error #1006: hitTestObject is not a function.
at Space_Hooligans/enemiesDie()
at Space_Hooligans/gameLoop()

View 2 Replies

ActionScript 3.0 :: HitTest Only Hits One Target?

Apr 29, 2009

Basically the code creates 3 sasquatches. When you click on the sasquatch it displays "you be dead sucka!", well, only ONE of the 3 sasquatches are registering hits, and the one that does traces "you be dead" 4 times.

package{
import flash.display.*;
import flash.events.*;

[code].....

View 9 Replies

ActionScript 3.0 :: Make A Bullet Disappear When It Hits A Target?

Jul 30, 2011

I have created a class named Bullet() and I create a child named bullet_mc every second.This bullet_mc moves to a direction on the stage.I also created a class named Plane() and I create a child named myPlane_mc every two seconds. Also, every myPlane_mc moves to a direction on the stage.

View 5 Replies

Flash - Get The Blue Object To Disappear Once It Hits A Red One?

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

ActionScript 3.0 :: MovieClip Play Animation And Goto Real Target Of Button

Jul 27, 2009

I have a movieclip playing and when I click a certain button I want the movieclip to first play an "outro" animation (which is also inside the movieclip) then go to the real target of the button. For example, I am at the Homepage of my website then I click on the Contact button. The homepage will first go to Homepage's outro animation then go to the Contact page. I need the button to recognize the page/clip being played and the page it will go to.

View 6 Replies

ActionScript 3.0 :: Drag Object Onto Target MovieClip?

Sep 14, 2009

I have been working with a very simple tutorial over at [URL], where you drag objects onto a target movieClip. My question is this, how do you target a movieClip inside a movie clip? What I have are 4 color squares that I want to drag and drop onto a pattern_mc. I put the target mc's with in the pattern_mc. In the tutorial the target mc's are not in a movie clip. I put my target mc's in a movieClip because I want to use the pattern_mc as a material.

View 7 Replies

Flash8 :: Getting A Line To Follow A Dragable Object?

Mar 30, 2009

I have a box that i made dragable by clicking at it. I would like a green line attached to a point in the frame and the other end of the line attached to the movieclip being dragged. Hope i made it clear lol.

How would i go about to achive this effect? If possible without having the line itself being within the dragable movieclip (because the dragable box is in more than one frame and i only want the line in one frame)

View 5 Replies

ActionScript 3.0 :: Recreate A Dragable Object That Will Blur Anything Behind It?

Feb 12, 2009

I have flash and i wat to recreate a dragable object that will blur anything behind it.

View 3 Replies

ActionScript 2.0 :: If Object 1 Hits Object 2 With A Speed Greater Than 10?

Dec 19, 2010

I wonder if there is a way in actionscript 2 that makes something happen if an object hit another object with a specific speed. For exemple: If Object 1 hits Object 2 with a speed greater than 10 I want something to happen.

View 5 Replies

ActionScript 3.0 :: Dragable Movieclip With Buttons?

Jun 1, 2010

I am basically trying to create a menu which can be dragged across the stage. I have created a main movieclip which acts as the holder. This is the movieclip that gets dragged around.Within that movieclip there are 6 buttons. I am using the MouseEvent.MOUSE_DOWN and MouseEvent.MOUSE_UP eventlisteners to control the dragging however it is not working correctly.When i compile to SWF it is fine. I click down the mouse button on the movieclip and It will start dragging however if i let go of the button it registers a click. Obviously i don't want it to do that but i'm not sure why it is registering a click as i thought that i was just releasing the button...

The second problem is if i move the mouse cursor off of the movieclip but i still have the mouse button pressed it will continue dragging the movieclip about, even if i then let go of the button.... The elements i have are:main holder movie clip whose dimension is 1800x280 and it is called : container_mcwithin this movie clip i have 6 buttons whose dimensions are each 300x270 and the names of the buttons are:

linkbtn1
linkbtn2
linkbtn3

[code]....

View 6 Replies

ActionScript 2.0 :: Dragable Movieclip With TextField?

Feb 5, 2010

I wanted to create a dragable Mc with an "attached" Textfield (which will also be dragged together with the Mc). Below my script. The logo.gif is dragable but no TextField visible (or attached). What am I doing wrong???

var imag:MovieClipLoader = new MovieClipLoader();
imag.loadClip("logo.gif",
this.createEmptyMovieClip("myHolder", this.getNextHighestDepth()));

[code]......

View 2 Replies

ActionScript 2.0 :: Get A Movie Clip To Play Once When My Character Hits It?

Aug 24, 2007

I've got a problem with a game I am creating, I want a movie clip to play once when my character hits it, it has a stop function at the end of the movie clip, but as long as the character is on top of it, it continues to loop, how do I get it to stop at the last frame?
Here is the script applied to the movie clip:

onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play();
}
}

All I've been able to do was make the last frame extremely long and load an alternate movieclip without the hittest function applied that runs the animation.Essentially, I am asking, "How do I make a piece of actionscript run only once", like:

onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play(ONLY ONCE BUT AFTER THAT DON'T DO IT AGAIN);
}
}

View 1 Replies

Object - Two Movieclips In CS5 Hits?

Dec 5, 2010

I have two movieclips A and B when the movieclip A hits the movieclip B , I want the movieclip A to be removed what code should i write for this flash problem ?

View 1 Replies

ActionScript 3.0 :: Trace When Play Head Hits A Frame Label?

Mar 24, 2009

would like flash to trace something when the play head goes over a frame label named "test" I would also like to have the code placed on the first key frame. I realize that the easiest way out would be to place the trace statement on the frame with the label on it but I'm trying to run this with a listener.

PHP Code:
stage.addEventListener(Event.ENTER_FRAME, checkFrame,false,0,true);
function checkFrame(event:Event):void

[code]....

View 2 Replies

ActionScript 3.0 :: Stop An Object When It Hits Another?

Nov 12, 2009

Im making a sort of maze game and have a ball that moves up, down, left and right when the corresponding arrow key is pressed. What I want to do now is introduce some walls, how do I make the ball stop moving when it touches a wall? (so it doesnt pass through the wall)

View 1 Replies

ActionScript 2.0 :: Playing Sound When One Object Hits Another?

Jul 30, 2008

I am creating a kids game in AS 1 and want a "good" sound to play when a "good" object falls into the beavers basket and a "bad" sound to play when it falls into the basket. What is the best way to handle this in AS 1?

View 3 Replies

Flash :: Play Forwards/backwards To Target Frame?

Feb 10, 2012

I need to play forwards/backwards to target frame(or second) on my videoPlayer when I push a button. How would I do this?

Not sure how to tween the seek() property. I have TweenLite, which normally works great! But just not sure how to do it here..

View 1 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It?

Mar 23, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

at flash.display:isplayObjectContainer/removeChild()
at grid/ball_movement()// my function in enter frame event
The code I wrote in ENTER_FRAME is

[code].....

View 3 Replies

ActionScript 3.0 :: Remove A Sprite Object When Another Sprite Object Hits It

Mar 24, 2011

I have a brick class where I have created a rectangle using flash.display.graphics.I am using this brick class to create a grid of 10 X 10 in another class called grid using new brick() in a for loop.I have another class called ball where I have created a circle with flash.display.graphics.The problem is that I want to remove / destroy individual bricks when the ball hits the bricks on Event.ENTER_FRAME which is not happening.the error I get is shown only for the last brick that is created in a for loop.[code]

View 1 Replies

Flash :: Get The E.target.name From A Movieclip?

Jan 21, 2012

I am trying to trace the name of the button that started the eventListener. But instead I keep getting

instance11 instead of the name of the movieClip which should be a number between 0-5

below is part of my actionscript.

import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;

[Code]....

View 2 Replies

ActionScript 3.0 :: Target Movieclip With E.target?

Aug 30, 2010

qi have a movieclip which is added to the stage:

var profileholder:profileHolder=new profileHolder ;

inside of profileholder is another movieclip(infoBtn) that acts as a button.when the mouse is over profileholder i want to do something with infoBtn like:

//profOver is the over state of profileholder
function profOver(e:Event) {
e.target.infoBtn.alpha=1;
}

this doesn't work and brings up this error:ReferenceError: Error #1069: Property infoBtn not found on flash.display.Loader and there is no default value.
at main_fla::MainTimeline/profOver()

i also tried:
function profOver(e:Event) {
var item:profileHolder=e.target as profileHolder;
item.infoBtn.alpha=1;
}

and get this error:TypeError: Error #1009: Cannot access a property or method of a null object reference.

View 1 Replies

Professional :: Sound Play One Time When The Movie Is Tested BEFORE The Mouse Is Even Over The Movieclip Object?

Apr 17, 2010

I am using Flash CS4. To illustrate, I created a new flash file and added a short tick sound to the library. I set the properties of the sound to export to Actionscript and named the class "overSound". I added a Movieclip object to the stage to represent a button and gave it an instance name of "overButton". On frame 1 of the main timeline I added the following code:

[Code]...

View 5 Replies

ActionScript 2.0 :: Stop The Object From Dragging When The Object Was Already Dropped To Its Target ?

Dec 27, 2011

how can i stop the object from dragging when the object was already dropped to its target =)

here is my code :

var pointsCtr:Number=0;
s1_mc.onPress = function()
{
s1_mc.startDrag(false);

[Code].....

View 3 Replies

Flash :: Use MovieClip Target Name To Pass Variable To Function

Feb 22, 2012

How can I combine the following functions and still pass a different string to the buildUI(); function?

I have two functions that do the same thing only at the end they both call a function and pass a String value to the function. This string value is the only thing different.

Below is are my eventlisteners and functions as they are now:

female_start.addEventListener(MouseEvent.MOUSE_DOWN, startFemale);
male_start.addEventListener(MouseEvent.MOUSE_DOWN, startMale);
//FUNCTIONS THAT DO THE SAME THING AND BOTH CALL buildUI BUT PASS A DIFFERENT STRING.

[Code].....

View 1 Replies

ActionScript 2.0 :: Return The Target Of A Tween Object From Within The Object?

Nov 7, 2006

Is there a way to return the target of a Tween object from within the object?

Code:
myTween.onMotionFinished = function (){
trace (this.target)
}

That's obviously not the way you do it, but that's what I want it to be...

View 9 Replies

Flash :: Creating An Instance Of A Movieclip With Event.target Information?

Jul 6, 2010

Is it possible to access the type of object being interacted with so I can create a new instance of the same object? So for example in the code below I have the movieclip myItem. After it's clicked it is removed from stage and then moved to the inventory. When I click on it there, is it possible to create a new instance of mcItemToDuplicate using the event information parameters? (while allowing myItem to be where it is).

My code looks something like this:

public function moveclip() {
var myItem:mcItemToDuplicate = new mcItemToDuplicate();
stage.addChild(myItem);

[Code]....

View 1 Replies

ActionScript 2.0 :: A Line From One Point Past Another Point And Whether It Hits An Object?

Aug 19, 2009

I am using AS2 with Flash 8 Professional So, my problem is that I currently have a man in the middle of the screen, who shoots a line towards the mouse when I click. However, when I use hitTest to see if the line collides with another object, Flash recognizes the line as a large box if it is diagonal, so the hitTest isn't very accurate. The line only satys there for one frame, so I can't have the usual moving-bullet-style. I am either looking for a way to create an imaginary line with AS from the starting point to the mouse and beyond, and tell whether or not this line intersects with an object... or some other way that I haven't thought of to fix my problem. Keep in mind that the line rotates from a center point towards anywhere around it for 360 degrees.

View 1 Replies

ActionScript 1/2 :: Movieclip In ButtonMode - Draggable To Different Movieclip Target?

Jan 8, 2010

I'm doing a project that makes a movieclip draggable in different droptarget movieclip. When it is dragged in the 1st target an animation is triggered and so as the rest of the droptargets.Here's my initial code that does'nt work:
 
btn1.buttonMode = true;
b1OrigX = btn1._x;b1OrigY = btn1._y;
//btn1btn1.onPress = function(){    startDrag(this);}//droptarget = box1btn1.onRelease = function(){    stopDrag();       //droptarge1t

[code]....

View 2 Replies

ActionScript 2.0 :: Movieclip - When It Hits The Enemy, It Goes To The Enemy's Second Frame?

May 31, 2004

i have one movieclip and i have another movieclip>enemy...okay so when the first movieclip goes over the enemy, nothing happens until i roll out! all i want to do is the movieclip, when it hits the enemy, it goes to the enemy's second frame and that's it ! there are no syntax error in this script, just something i want to do that apparently doesn't work right.here is my code:

Code:
onClipEvent (load) {
speed = 2;[code]...

View 14 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved