ActionScript 3.0 :: Perform A HitTest That Only Works On Children With A Certain Depth?

Feb 27, 2012

I have a problem with the getChildIndex() method. I have an array that stores multiple children and I want to perform a hitTest that only works on children with a certain depth, with one that is lower than the other hitTest "partner". Therefore I want to check the depth of that certain child.I tried to trace the depth, but I get crazy errors doing that. No matter if I do it from the child itself, or from the Document Class.

trace(getChildIndex(foes[7][1][1]))

[7] is the current level, [1] is the type of child and the second [1] is the child itself called [Object EnGob]. I put it there by the push() command.

View 3 Replies


Similar Posts:


ActionScript 1/2 :: Perform HitTest Between Mc Within An Mc?

Aug 17, 2010

how to perform hitTest between mc within an mc??i tried it in the same timeline and it works, but those two movieclips (BLUE COLOR) is inside different MC'sis there a way to perform a hitTest between them??

View 3 Replies

ActionScript 3.0 :: Tweening Object Perform Hittest?

Nov 15, 2009

Can an object that is tweening via TweeLite perform a hittest on another object?? I've looked in the documentation but can't find the answer.

View 1 Replies

ActionScript 2.0 :: Drag & Drop - Perform A HitTest The Item Is Supposed To Dissapear, But It Doesn't?

Mar 1, 2005

I'm having a problem with my dragOver function.The point of my project is that can drag the items that are on the table to the little bag (this is a button) on the left bottom of the screen.The thing is that the dragging works but when I perform a hitTest the item is supposed to dissapear, but it doesn't....

View 3 Replies

ActionScript 2.0 :: Set Depth On A Hittest?

Feb 25, 2009

i have this drag and drop thing basically when i drop the item on top of its slot i want it to do a hittest to set the depth to a number assigned to it. so lets say I drag an item called Item to a spot called slot i want it to do like item on hit test to slot set depth(2) lets say.

View 1 Replies

ActionScript 1/2 :: Replacing A Movieclip Without Changing It's Children/depth/tweens

Feb 5, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with a new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.
mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime.

View 5 Replies

ActionScript 2.0 :: [mc] Replacing A Movieclip Without Changing It's Children / Depth / Tweens

Feb 4, 2010

I would like to be able to draw a simple box as a background/placeholder, dress it up with buttons and movie clips at design time, and at runtime call a function to replace the simple box with the new design. How would I go about doing this? I have a graphic design that is too complicated to make with flash. So i made a piece of actionscript that can restyle any existing movieclip. This piece of code works. It basically gets the coordinates of the specified mc, creates a new one in it's place and deletes the original. Unfortunately this also removes any nested movieclips and buttons and breaks animation tweens of this mc. So if the original mc would have a button on it and animates from left to right, the new one doesn't.

mc.clear(); looked very promising, but it only clears stuff you put on it at runtime while I need to clear the stuff from design-time. (= the simple box drawing object)
Creating a movieclip with the same name, at the same depth doesn't seem to work. oldbox.parent.createEmptyMovieClip(oldbox._name, oldbox.getDepth()); The old movieclip keeps existing and neither of them animates.So I'm searching for a way to replace a movieclip or clear it's content at runtime. Or am I thinking in the wrong direction and are there other ways to restyle a movie clip?

View 1 Replies

Actionscript :: Remove Children As The HitTest Them But The Index Seem To Be Off?

Dec 11, 2011

when my lasers hit the enemies I want to remove the laser and the enemy but my loop somehow searches outside the index and crash the program.

package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;

[code]....

View 1 Replies

Button :: Setting Childindex For Depth Works Only Briefly ?

Jun 9, 2010

I am placing several AS3 buttons (actual buttons not event-laden MCs)on a Flash stage and want my enlarged rollover images to always come to the front of all other dormant buttons.My script-fu is weak,but piecing together the advice from several helpful posts I have generally learned how to set the childindex on a rollover event to be high enough to go to the fore.I plugged in the appropriate language in my action frame and was psyched to see that the coding worked...but only briefly.After just a few clicks (it seems that whenever a button is hit for the second time), not only did the childindex trick stop working, but the buttons (which  act to send the user to labeled frames later in the time-line) stopped working altogether.It seems that the issue is definitely related to the setting of the childindex, because when I remove those event listeners/commands,the buttons all work fine for an infinite number of clicks (but the enlarged  rollover images are stacked in one static sequence, blocking each other out).Is there something inherently incorrect about this approach?Something simple that I am overlooking? Some way to reset the process on  each click so it does not get gummed up (I tried re-setting childindex #s to 0 on rollout or on click, but it did not help)?

I have had it suggested that rearranging the order is destroying ability to recognize mouse events...but not sure if this is correct, what it would mean.The code that I am using for each button (for setting the depth and  for redirecting on click) is below,

View 3 Replies

ActionScript 2.0 :: Hittest Only Works Once?

Jan 26, 2010

when i make this script:

onEnterFrame = function(){
if(ss.hitTest(_root.c2)){
_root.ss._x = -49.4;
}
}

it only does go to cords -49.4 once, after ss have hit c2 once it doesn't react when it hits c2 again!

View 9 Replies

ActionScript 3.0 :: HitTest Works But Also Returns Error

Sep 5, 2009

Perhaps I should leave well enough alone, but it bugs me that my hitTest gives me an error message even though it seems to work as intended. I have two movieClips running side by side. The second clip, the hitTest object is actually in an array that I keep pushing every second.

[Code]...
 
I have tried to trace cars[i].name and it returns "instance XXX" instead of what I would have expected, which would have been something like cars1, cars2, etc... If that is creating the error, I don't know how to fix it. I have thought also that perhaps the array itself is being referenced, but again I wouldn't know how to change it.

View 11 Replies

ActionScript 2.0 :: HitTest Function Only Works On Y Axis

Oct 14, 2003

My hitTest function only works on the y-axis
This is the code....
onClipEvent (enterFrame) {
// _root.speed = speed;
if (Key.isDown(Key.UP)) {
speed += 3;
[Code] .....

View 1 Replies

Flash8 HitTest Works Wierd With Rotating Objects?

Dec 29, 2009

How would i make hitTest work better with a rotating object(AS2). Becase i have a circle and it if gets near the rotating object (actually pretty far away) it starts the script,(new x and y)

I think thats the rotation script, becuase i took a break for like 4 days becuase it was irritating.

View 1 Replies

ActionScript 3.0 :: Flash Hittest Only Works On Last Object In Array

Mar 24, 2012

For days now I have been trying to get this hit test to work and which ever way I try it, it always comes back to the same result. I get a hit on the last item I pushed into my array but none on the previous items I pushed in. Also if I put a .sort() on the array it only gives a hit on the last item of the array, no matter which one I push in.

The idea is that I want to drag and drop objects onto the stage, they may not overlap so I need a hit test on the objects so I can make them undroppable when the hit test is true.

This is the part I have for dragging the objects to the stage, and adding them to arrays for the hit test.

Code:
private function onClickDragBuilding1ToGameField(e:MouseEvent):void{
building1Placeholder.x = mouseX-25;
building1Placeholder.y = mouseY-25;

[Code]...

Now if I run this I can add the object to the stage just fine no errors or other issues but the hit test only works on the last object I added to the stage/array and not the previous object I added to the stage/array.

Sso I drag the first object to the stage. (no other object are available yet so nothing happens, this is as it should be) Then I drag a second object to the stage, this reacts to the first object and returns the hit test as true. (Also great and working as it should.) Then I drag a 3th object to the stage, this reacts to the 2nd object I dragged just fine and return a true value, but it does not react to the 1 object I dragged onto the stage. Then when I drag a 4th object to the stage it will react to the 3th object I added, but not the 1st ad 2nd object.

View 4 Replies

ActionScript 2.0 :: Hittest - MC Movement Works Only When The Y Position Of The Mouse Is Over The 300 Px?

Jan 21, 2004

Ive got a code to move a MC on the main stage together with the mouse, in the the X axis,. difficult to explain. But now the client wants that this MC movement works only when the Y position of the mouse is over the 300 px. I thought I need a hit test or something elese. Please help. Here is the whole code.

[Code]....

View 1 Replies

ActionScript 3.0 :: Xml.children() Returns Grand-children And Gr8-gran-children?

Nov 18, 2009

I'm making a OSX-finder-type file browser in CS4.The Structure for the folder and files is being generated by a PHP in a XML, heres an example:(sorry the xml is not sorted, but the command i'm using in php doesn't sort it)

Code:
<root>
<dir name="images">

[code]....

View 2 Replies

ActionScript 2.0 :: Putting A Movieclip Into Highest Depth Without Knowing Which Clip Is In The Highest Depth

May 11, 2004

putting a movieclip into highest depth without knowing which clip is in the highest depth

View 2 Replies

ActionScript 3.0 :: Multiple Children Spawned With Timer Makes Old Children Inactive?

Mar 24, 2009

In this game attached I need the old Children (rats) to hurt the character when he walks into them, however only the most recently added Child is active in that way... also the rats seem to appear above the character instead of below, is there any way to resolve these issues??

View 4 Replies

ActionScript 3.0 :: [CS4] Children Inside Children - 1119: Access Of Possibly Undefined Property NumChildren

Jan 12, 2011

I have a Sprite called pageContent. Inside pageContent are 12 more Sprites with unique names, a couple of Buttons, and some TextFields. Inside each of the 12 Sprites I have either one or two TextFields and one TextInput. My question is, since they are children inside a child of pageContent, how can I access them? Here is how I am trying to do it:

[Code]...

In my mind, this should totally work. But surprise, surprise, it doesn't. I have debugged it and it works fine for the first two lines, but when it tries to get numChildren of a Child of pageContent (line 3), I get this error: PHP Code: 1119: Access of possibly undefined property numChildren through a reference with static type flash.display:DisplayObject.

View 4 Replies

ActionScript 2.0 :: RollOver & RollOut In Children's Children's Movieclip?

Jan 11, 2010

I want to have a rollover effect of a movieclip (mo1) inside a movieclip (mo) of another movieclip (popup1).Is it possible to do that? I try calling it using this code in the frame 1 of my flash, am i doing wrongly?

Code:
popup1.mo.mo1.onRollOver = function() {
popup1.mo.mo1.gotoAndStop(2);

[code]......

View 9 Replies

ActionScript 2.0 :: Create An "hitTest" Script Inside A Movieclip That Is Actually Part Of That HitTest Code?

Jan 15, 2009

i just would like to know how to create an "hitTest" script inside a movieclip that is actually part of that hitTest code?I mean... I have mc A, and mc B. and the current hitTest code im using (that is on the timeline) makes mc A, destroy mc B when collide with it... but there are many mc B on the stage (with the same instance name) so, when mc A collide with one mc B, it destroys ALL mc's B... but i want it to destroy only the mc B that he collides, not all the others... maybe an hitTest script inside a movieclip B would work (somethig like "if MC A hitTest ME = i die" (not all the others)).

View 1 Replies

Data Integration :: Pulling In Children Of Children In XML

Sep 23, 2006

Newbie to XML here and I have what I *hope* is an easy problem, but I just don't know the answer. And as I have to try and show this by Monday, I'm sort of stuck. I am trying to pull in information about houses via an xml file. Each house has 1 address, 1 owner, 1 description, and about 6 photos. I have no problem accessing the address, owner, etc, and I can always access the first photo, but whenever I cycle through the photos, I seem to cycle through the first photo for every house, not every photo for each house.

Basically, I need the children <images> to go up by one, without the the parent going up by 1. I am hoping I am describing this well. My code looks like this:

[Code]...

View 4 Replies

Flex - Access Children Of Children Recursively?

Mar 10, 2010

I have a Canvas which has many components inside it and those again, have many components inside them.

getChildren() returns only the top level children. What is the best way to retrieve all the children (children of children of children and so on).

Well, I sorta know how to do this by iterating through the children, but the code is really messy. I'd prefer to use a nice recursive function. Has anyone written this before? Or is there a Util class to do this?

View 3 Replies

Data Integration :: Pulling In Children Of Children In XML?

Jul 24, 2010

I am trying to pull in information about houses via an xmlfile. Each house has 1 address, 1 owner, 1 description, and about 6photos. I have no problem accessing the address, owner, etc, and Ican always access the first photo, but whenever I cycle through thephotos, I seem to cycle through the first photo for every house,not every photo for each house.Basically, I need the children <images> to go up byone, without the the parent going up by 1. I am hoping I amdescribing this well.My code looks like this:

total = xmlNode.childNodes.length;
totalb =
xmlNode.childNodes[0].childNodes[5].childNodes.length;

[code].....

View 1 Replies

Actionscript :: Add Children To Accordion Children In Flex 4?

Oct 28, 2011

I have an ArrayCollection that is read to generate containers in an accordion programmatically:

<s:ArrayCollection id="_ac_ps">
<fx:Object label="Block and lot" data="_blocklot" searchType="districtblocklot"
info="" />

[code].......

View 1 Replies

ActionScript 3.0 :: Accessing Children Of Children

Jan 11, 2011

for some reason STORAGE[0].getChildAt(0) works whereas liner.getChildAt(0).getChildAt(0) does not. STORAGE is a movieclip and a child of liner. the error is something about not being able to use getChildAt on a display object. what's wrong? is there any other approach i could use? PS: liner.getChildAt(0) works and does indeed seem to refer to STORAGE[0]

View 2 Replies

ActionScript 3.0 :: Movie Clip ROLL_OVER Only Works Once But MOUSE_OUT Works Infinitely

Apr 11, 2011

I have a movie clip (with instance name rectangle_mc) on the stage. Within this movie clip there are two separation animations on the timeline. The ROLL_OVER animation starts on frame "over" and the MOUSE_OUT animation starts on frame "off." If I roll over the movie clip, the initial animation plays, and when I mouse out the other animation plays to restore it to it's initial state. However, once the rollover animation has played once, it will not play again when I roll over it again, but for some reason the MOUSE_OUT plays every time.

[Code]...

View 1 Replies

ActionScript 3.0 :: Do Something After Hittest " Remove Hittest After First Collsion"?

Feb 8, 2010

i am controlling a tractor mc with right and left keyboard keys and let the user move the tractor till it reach a certain point where it touch a mc i want to go to a certain frame and stop the keyboard event listener and also the hit test listenerso finally the tractor is moved by user till it touches the mc then we will jump to a certain framethis certain frame will not have both of the tractor and the mcPHP Code:

import fl.transitions.Tween;
import fl.transitions.easing.*;
import flash.display.MovieClip;

[code].....

View 1 Replies

ActionScript 1/2 :: Perform A HtTest Between Mc's Within Another Mc?

Aug 16, 2010

is it possible to perform a htTest between mc's within another mc, coz mine's not working...

View 7 Replies

ActionScript 3.0 :: Perform A Function After Another?

Jun 26, 2011

I have a function that load an image from web, and change the image size inside an iterative loop. There is a loder and a listener on the loader for the loading to be complete :
 
for (var i:uint=0; i<=10; i++)    { 
my_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteHandler);        function onCompleteHandler(evt:Event)        { .// change the size of the image//}
// other instructions...

}
I want the program execute " other instructions"  but only after the image is fully loaded and The size changed

View 5 Replies







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