ActionScript 2.0 :: HitTest And Changing Scales And X-y Positions Of Parent Clips?
Sep 29, 2005
I'm just wondering if hitTest can be affected by the changing x,y coordinates or the changing scale of the parent clips. My platform engine doesn't seem to work everytime I try to add a script to a parenting clip (of a playable character and a computer character) that changes the x and y values of that clip as well as the scale (simulating a camera that keeps both characters in focus).
View 2 Replies
Similar Posts:
Nov 23, 2010
I have created a custom component - MyImage - that has two children including a Bitmap as well as a Sprite.My display object hierarchy is as follows -
mx:Canvas
view:MyImage
mx:Bitmap
[code].....
View 1 Replies
Sep 16, 2011
For some reason the "scaled.width" - the movieclip that have scaled already - after scaling it even more with TweenLite.to function by factor .3 aren't equal with the predicted result => scaled.width * .3. Orginal width is something I don't know but scaled width is something like 420. Now multiplying it by factor .3 the result should be something like 140, now when I put TweenLite.to function to scale my scaled movieclip by factor .3 the width in the end is something like 267.And frankly speakin I really can't imagine where the result came from.
Some back ground:I import three images dynamically. Each of them to their own MovieClip containers. I don't know the dimensions of images so I need to scale them proportionally to their dimensions to fit to the desired size.That was intuitively easy. I managed also to align them horizontally in the center of the screen after the first scaling by the knowledge that their registration point can be found from the top left corner. I also managed to align each of them on vertically in the middle of the 1/3 part of the empty stage with desired marginals: in the top there are 20 pixels space, between the images there are 20 pixels space and in the bottom there are 20 pixels space.
Now the problems comes when I need to tween them to their final positions. Each of them to the top of the stage and each of them in 1/3 part of the empty space horizontally scaled at the same time smaller with factor .3.Intuitively when I think the x position can be found by same way than the way I found y positions (related to the space left after the middle image is positioned). So in theory I thought the x position for the image that comes in the center should be as much as finalX = stage.stageWidth / 2 - current.width * .3 / 2(the center point of the stage minus the half of the width of the image after the scale)but when I give finalX for the tweenLite as a x position and .3 as a scaling factor the result is something different.
View 1 Replies
Dec 6, 2010
I won't pretend like I'm really at all familiar with Flash. I'm making a project where I'll have several movie clips on the scene. When you click each movie clip, I want it to scale larger. I got the code working and it does do that. Trouble is, now when I click any one of the clips, it scales all of the clips at the same time.
This probably has to do with the fact that I'm using the exact same code for each script and only changing out the MC name. What do I need to add to the code to make it so each MC is working individually from one another?
[Code].....
View 2 Replies
Oct 18, 2010
I have a symbol of a shape with a gradient drawn in Illustrator that I copied-and-pasted into Flash CS5. I created a simple motion tween by making the symbol move around the stage and scale. How do I now change the color of the symbol as it is moving on stage?
View 4 Replies
Feb 18, 2005
I have a sliding menu, and need to loadMovies when specific clips are in specific positions.
For gallery, for example, the code I'm using is:
if (xTargetSLI = 350){
loadMovie ("gallery.swf", 1);
}
But with that code, gallery.swf loads by itself, regardless of the position of SLI.
View 7 Replies
Mar 24, 2010
I have three movie clips on my stage. Their names in my library are a1_mc, a1_mc2, and a1_mc3. Each of those movie clips on my stage has a different instance name. All of these are connected with an actionscript in the same file.Now, I'd like the movie clips to appear at a random position every time, they are loaded.
I already tried to make a new array and solve this issue with the sort() command. However, that did not work out properly. The positions and instance names of the movie clips on my stage are as follows:
a1_mc
instance name on stage: a1
position on stage: X = 20.0 | Y = 140.0
[code]....
View 1 Replies
Jun 29, 2008
As you can see I am attempting to assign x,y positions to clips that are being "attached."
var clipArray = new Array();
clipArray = [189, 275, 361]; // x positions
for (var i:Number = 1; i < 4; i++) {
this.attachMovie("clip"+i,"butt_"+i,i,{_x: [clipArray(i-1)], _y: 142});
}
View 4 Replies
May 6, 2010
I have a MC with an instance name MovieClip_1 and I create another like this:[code]So basically, what I want to know is how to nest MovieClips using code, display them, and change their positions reletive to their parent MovieClip, and not the root/stage.
View 1 Replies
Dec 13, 2009
I have a stage with instances of bauble_mcs on it that are attached by the document class of the main timeline (can someone tell me what the right term is here? I don't know what I call the main time line in AS3).I then have instances of snow_mc attached by the same class. Inside the snow_mc I want to test to see if it is hitting any bauble_mcs but I don't know how!
inside snow_mc I am trying:
PHP Code:
if(this.hitTestObject(this.parent.bauble_mc)){
}
to which flash says:
1119: Access of possibly undefined property bauble_mc through a reference with static type flash.displayisplayObjectContainer.
View 1 Replies
Feb 2, 2004
say I have 3 movie clips I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work
[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three;
}
onClipEvent (enterFrame) {
[Code]...
It's just a quick example of what im trying to do. one, two, and three are movieclips. Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?
View 5 Replies
Feb 2, 2004
I have 3 movie clips... I want the easiest way to do a hitTest with them... The easiest way I thought of was this but it doesn't work
[AS]
onClipEvent (load) {
mouse.hide();
walls = _root.one or _root.two or _root.three; [CODE]....
one, two, and three are movieclips.Is the way I am trying possible? Or is there some easier way I could go about doing this besides writing it out for each movie clip?
View 5 Replies
Aug 9, 2010
Ive created a project that creates random movies clips with text in them, everything works fine except that movie clips will overlap each other due to the random nature of the project.I've looked everywhere tips on hitTest methods but I cant seem to get it right, the major problem is that the clips have similiar names, if I try a hit test the movie clip will just detect itself and not look for the other clips.
View 3 Replies
Apr 21, 2004
i am currently making a game , and for some reason the hittest on my duplicated movie clips isnt working i know how to do them , and know it should be working , because it works on one of the movie clips but none of the others so im guessing it something to do with depth?
View 2 Replies
Nov 20, 2005
I have this "point" movie clip that starts on a random hitpoint. I can drag around, on the stage and there are more than 10 small invisible movie clip.How do i create any sort of algorithm where it can somehow "loop" thru all the movie clips to test if it hits any?If so, it will snap to it, else it will revert back to the previous hit point?
View 2 Replies
Jun 24, 2007
I've built an array of movieclips - all of them sitting static on the stage. I'm trying to trigger the clips to play as they are hit by an invisible/alpha 0 bar which sweeps across the stage... kind of like a mexican wave? I'm still a bit crappy with arrays - here's my code:
[Code]....
View 3 Replies
Mar 21, 2007
I am making a small game in which you are a little shooty spaceship type thing, and there are duplicated mines falling around you. When you press space, the shooty spaceship type thing fires duplicated bullets. How do I check a hittest between any bullet
View 3 Replies
Apr 21, 2004
i am currently making a game, and for some reason the hittest on my duplicated movie clips isnt working i know how to do them , and know it should be working , because it works on one of the movie clips but none of the others so im guessing it something to do with depth? i will give the code if any1 replys
View 2 Replies
Jan 22, 2007
I have thumbs placed on the stage. I create an empty mc to load swf. But my thumbs disappear from the stage when I test the movie ( html or swf) if I settle the _ and _y position of the empty mc.why the emptymovieclip positions affect the positions of my thumbnails?
View 2 Replies
Mar 19, 2010
I am working on doing a hitTest using one attachMovie and one repeating movieClip. I am running into trouble because the movie clip is changing it's name every time it's created (panda1, panda2, panda3, etc...) and the attachMovie, fire, is not recognizing the created MC's. here is the code to create the movieClips:
[Code]...
View 3 Replies
Nov 26, 2004
How do I detect collisions between movie clips and a line created through actionscript (with the lineStyle, lineTo, etc. commands). I tried making the line inside a movie clip and doing a hitTest with that movie clip, but it did nto work.
View 1 Replies
Feb 18, 2005
I have a sliding menu, and need to loadMovies when specific clips are in specific positions. For gallery, for example, the code I'm using is:
if (xTargetSLI = 350){
loadMovie ("gallery.swf", 1);
}
But with that code, gallery.swf loads by itself, regardless of the position of SLI.
View 7 Replies
Jan 5, 2010
say I have a clip with an onEnterFrame running on it with a hit test to check if the user has rolled off the clip . . . Then i create an empty clip within that clip and attach clips to it. Will my .onEnterFrame and hitTest now apply to the clips i have attached to the original clip?
View 2 Replies
Apr 26, 2005
i am working on a game called "virus". you click somewhere on the screen and the virus goes to where you click. you have to dodge random moving white blood cells, and if you hit them you lose. everything is working. except for one thing. scoring.
i have made a movieclip with a dynamic textbox in (score), and in the movie clip there is a section where the number in the score textbox goes up really quickly, a section where is goes up medium, and a section where it goes up slowly. i want to make it so that when you get closer to the center of the movie, for the score to go up quicly, and slower as you get further out. i have tried hittest with movie clips in the centre of the stage, but it doesnt seem to work.
View 3 Replies
Jul 11, 2007
There's no way to directly change a MovieClip's parent MC? That is, move it from one MC to another?
View 5 Replies
Feb 16, 2010
ok I have a subclass of TitleWindow with this method:
public function launchInNewWindow(e:Event):void
{
this.parent.removeChild(this);
[code].....
View 1 Replies
Sep 6, 2011
I have a ball MC that is a child of a ship MC, and when the ship fires the ball I need to make the ball MC a child of the stage instead of the ship. Here's the code I have (contained in ball.as, this function is called when the ball is fired)
public function prep():void {
ship.removeChild(this);
screen.addChild(this);
[Code].....
View 4 Replies
Jun 25, 2009
I have my flash website set up with the following structure:
Scene 1:
- Menu buttons located in Scene 1 -> navigation_mc
- Page 1 (Company page) located in Scene 1 -> companypage_mc
- Page 2 (Portfolio) located in Scene 1 -> portfoliopage_mc
- etc... a total of 4 pages.
As you can see, I have each function of the website in its own layer and movie clip, so my question is how do I access a movie clip outside of the current movie clip?
I want my company_btn (company button) in navigation_mc to navigate back outside to scene 1 and proceed to play the contents of companypage_mc. companypage_mc is visible = false, and I would like to make its visibility true and start its tweens from frame 1.
Inside navigation_mc:
company_btn -> On Click, go to scene 1 and play frame 1 of companypage_mc, making visibility = true.
View 1 Replies
Nov 4, 2005
got a bit of a tricky one here [well, it could be an easy one, but I have no idea where to start on this one]
Lets say I have two objects on a stage, one named mcA and mcB, within mcA I have another object [called subA] which contains a few small objects, a AS class and some other stuff like components etc...
Is there a way for me to replicate that exact object [subA] inside mcB without loosing any data and such? is this posible?
So basically I want to make a copyClip function, that has the ability to copy/move objects from one object/clip to another...
View 3 Replies
Aug 2, 2006
1) i have all my actions in its own layer on the main timeline, so all is well there
2) i have a movie clip with a rollOver and rollOut events attached to it
3) inside the movie clip when the rollover happens and the movieclip stops at a certain frame, i have another movieclip that appears. the movie clip is a link to a website, it works properly on the main timeline but without the proper actionscript it of course will not work inside its parent movie clip
View 1 Replies