ActionScript 3.0 :: Finding All Objects In The Movie?
Jan 30, 2011
Is there any way to find out about all the objects being on the stage?I mean, all nested in other movieClips or Sprites too.I can find children of specific object by looping it with getChildAt(), but of course I would have to do this for all the objects in their levels that they are nested in..
View 2 Replies
Similar Posts:
Nov 13, 2006
need a method of finding all the objects over the top of another object...
I realise I could use hitTest to check if something is intersecting, but I can't use it to find the names of the said objects. I also realise I could just cycle through all the objects on the stage and calculate it that way, but considering there's over 300 objects that could 'possibly' be covering this particular object, thats a lot to calculate, and i'd like it to be snappy...
View 1 Replies
Nov 30, 2009
I get the feeling the title is misleading... What I try to achieve is quite simple (at least it sounds like a simple thing to do). I am trying to find the intersection of 2 objects in relation to each other. One of them is the character for my game, and the other is the obstacle (the floor, a barrel, etc). I need to find the coordinates of the character in relation to the obstacle. Here's a picture to make it a bit clearer:
Here the coordinates (and the cross) represent the origin of my objects, and the two squares are my character (twice to better represent the multiple possibilities). The number after the slash for the square is what I should get as the .x when my character hits the obstacle. I tried using getBounds(), but I really don't know about it and tried stuff based on the little knowledge I have about it (I won't post the code here, first it was horrible, and it also didn't survive the rage I had trying to get this to work...).
[Code]...
View 4 Replies
Jan 6, 2010
I'm in the process of making a board game in Flash; as part of process of getting fully to grips with Flash AS3.
I have a JPEG of the original board. This contains ~ 1000 circles that players may move pieces between. Pretty standard board-game stuff. The circles are not in any way regularly spaced.
So far, I've drawn the circles in Flash, by hand, and positioned them where they need to be. This looks great - I can see all my places.
What I want to do now is create these circles programatically. I want to be able to do this so I can adjust how the spaces look (depending on game state). Eventually I'll want to be able to zoom / pan the entire game board as well.
My question is, is there a way of tagging each circle with a unique reference and then looping through and recording locations?
I'm thinking something a bit like the Javascript DOM "getElementsByTagName" or similar.
At the moment I can only see two options:
Convert each circle to a symbol and give it a unique class name so I can access it from code Go through and write down the X/Y of each circle (add to my DB of board locations that I already have) so I can plot them programatically
View 1 Replies
Aug 8, 2011
[Code]....
two balls are stationary on stage and I am dragging ball 1 between them. I want my program to deny the ability to do this (technical terms) and move the ball automatically to the closest point available that does not overlap either of the other two balls i.e. the left side of the dragged ball may touch but not over lap ball 3. I have a feeling the circular equation: (x-a)^2 + (Y-b)^2 = c comes into it but it may need pythagoras instead as the balls are all circular but not all the same size. The best way I can see for this is to write a multi-part equation for the bounds of boths balls and then finding the nearest point, but not sure how to do this in as3, perhaps using the 'for each' tag.
View 3 Replies
Oct 6, 2010
I want to find out how to find objects on stage in order to change their names, using actionscript in run commands.
View 2 Replies
Jun 5, 2006
Is there a way to have a function draw a box around an object by finding the objects instance name via a string?
such as:
Code:
function BoxObject(object) {
//code to draw a box around the object
}
and then juts have an object with an instance name, like "my_mc" and then call the function on a keyframe like:
BoxObject("my_mc");
View 10 Replies
Oct 4, 2009
Let's assume that I've got 3 instances of a movie, each labeled team1, team2, team3. In this movie is a BUTTON (named buttonTest) and a TEXTFIELD(teamReply).
I'd like to write a function in the root that the event listener from the button within the movie would call on, but how do I find out 'which button' was pressed dynamically in order to send a line of text back?
For example: if the team2.buttonTest button was CLICKed, how do I pass that information onto the function to tell the function to send the text BACK to that same movie?
View 1 Replies
Oct 5, 2009
Wat's the difference between to find angles of two points which is (x1,x2) and the other point be (_xmouse,_ymouse).
To find the angles we subtract from one point to the other
like
method 1:
target x = (_xmouse - mc._x)
target y= (_ymouse - mc._y)
[Code].....
View 1 Replies
Aug 31, 2006
how I can find the original stage size of an SWF that has been loaded into a parent clip via MovieClipLoader? In the child clip, there are a number of elements that extend beyond its stage, so when I check the _width and _height properties, then they include the stage overlap.
I tried using mc.getBounds(), but it doesn't seem to give me what I'm after.
View 3 Replies
Jan 8, 2010
Im making a game, where a player controls a character moving around the screen using the mouse.the player moves using a tween, using the current x y pos and the click x y pos to move the character around here's the thing, i have objects on the screen (such as rocks, etc) that i do not want the user to be able to walk through. i do not want to use hit test to simply chuck the character off the object in real time because that's messy and it would mean the tween continued and stuff.. instead, i want to add some code to the top of the "movePlayer" function that checks to see if an object (such as some rocks) is going to be hit, and if it does, i want the tween to only go to this point (yellow in the below diagram)
Here's what i mean:the player clicks on the screen ( the blue dot) and instead of walking straight to the blue dot, the code determines the point at which the player will hit the big orange block, and only tween to that point, if there are multiple orange blocks in the way, the tween will stop the closest block.
View 9 Replies
Apr 6, 2011
How do I find the total maximum width and height of a movie clip with respect to every frame of that movie clip?
So for instance if the movie clip was circles of radius 5 registered at their center at various positions where:
frame 1:circle.x=-30
frame 2:circle.x=0
frame 3:circle.x=30
The total maximum width of movie clip would be 30--30+5+5=70.
View 1 Replies
May 3, 2009
I am trying to get certain objects in my movie disappear or be removed from view when you enter full screen.
View 1 Replies
Sep 16, 2009
I am currently trying to design a small flash movie. I have a "Movie Clip" object (a short animation) that i wish to act like a static object until a certain frame on the main Timeline. Then i want it to play out, at it's own pace, just like normal, until it finishes (no looping).. What do i need to put into, and where do i put it? So in short, frame 30 of the main animation triggers the clip, whilst the main animation still runs.
[Code]...
A lot of solutions suggest a button, but I don't want to use a button, as it's not interactive - just a movie. i just want the damn movie clip to play in the damn movie when it reaches frame 30! it shouldn't be that hard..
View 2 Replies
Sep 21, 2009
I've been getting reports from users that certain objects are invisible in my flash banner.The browser culprit is IE 8 (but someone also reported seeing this in IE 6). I have been unable to duplicate this and therefore, find it very difficult to troubleshoot. I do have the Wmode set to transparent, but I've made it opaque and still had the "invisible" reports. Here is the site:
View 2 Replies
Oct 25, 2010
I have several objects in a separate movie and want to perform a hitTest with them and my other object 'knexman' which is noted below in the script. Basically what's happening is that when I trace the output of the hitTest, it increments about 5 or 6 at a time with each enemy collision running into the knexman object. All I want to do is when objects run into the 'knexman', to increment and trace it by one. Once I get it to increment by one I can accurately conditionalize how many lives are left etc.
onClipEvent (load) {
function reset(){
this._y=0;
this._x=random(600)+300;
enemySpeed=random(15)+5;
this.gotoAndStop(1);
[Code] .....
View 8 Replies
Sep 10, 2011
i want to referance objects in the level above the movie clip that i have the AS in. what i mean is that i have a movie clip on the stage, and that movie clip has some actionscript in it, and that AS needs to refer to an object on the main stage, how would i do that? i have tried parent and stage 1, but neither seem to work
View 4 Replies
Nov 28, 2011
I am adding a Timer object when my flv playback enters a Pause state and removing that Timer Object when playback starts again. I noticed that if I pause the movie and then drag the slider on the timeline the movie enters the Pause State again which adds another Timer Object....
How do I check to see if the Timer has already been added and if so remove it and add a new one.
See code below:
my_player.addEventListener(VideoEvent.PAUSED_STATE_ENTERED, pausePlay);
my_player.addEventListener(VideoEvent.PLAYING_STATE_ENTERED, startPlay);
function pausePlay(e:VideoEvent):void {
[Code].....
View 2 Replies
Oct 1, 2003
where I can find a tutorial to create resizable movie clips? The viewer should be able to resize movie clips during playtime... I tried a lot of things... the objects get resized but they just "blow up" from all sides...
View 3 Replies
Nov 19, 2005
the red ojects works nice i made another objects inside a movie and it has the same instance name and actions, but does not work
View 3 Replies
Apr 13, 2006
I know that I should use pythagore to calculate the distance, but I need to calculate distance between 2 objectfs that are contained within 2 different movie clips. Something in the line of :
xdist = Math.round(follow.p1._x - photo1_mc.p1._x);
ydist = Math.round(follow.p1._y - photo1_mc.p1._y);
distancefromthis = Math.round(Math.sqrt((xdist*xdist) + (ydist*ydist)));
But distancefromthis contains always the same value, maybe it's because _x is calculated within the movie clip, so I need to find the photo1.p1._x in the stage.
View 3 Replies
Dec 21, 2006
Anyway, I am having problems with storing movie clip objects in an array because when I try to access them, it kinda loses its properties as a movie clip. Say, i have mc_1 stored in the array,and in the course of the flash movie, a button is triggered to change its visibility to "false".. what i do is, arr[0]._visibility = false.So here's what I'm really trying to do with my school project: I have 24 movieclips, i named them field1, field2, ..., field24. I stored them in an array. Initially, they're invisible. Then, a button is clicked to show one field. If the button is clicked again, the second field is displayed, and so
View 3 Replies
Dec 22, 2006
How would I go about making my own functions for objects and movie clips?
Like:
Code:
onClipEvent(enterFrame){
this.setpos(10, 20);
}
[Code].....
View 6 Replies
Mar 19, 2007
I am fairly new to Flash and action script as a whole, and would like to know how one can write a script that allows users to rescale/ resize and rotate movie clip objects at runtime.I.e. When a user moves their cursor over an object on the floor plan, I would like for them to be able to either resize the object or rotate it.
After trawling the web, I am still yet to find an existing API that I can use to build my floor planner in Flash. However, I did stumble across the 'Space planner' created by Icovia for architects and interior designers alike. If you visit the icovia web site at http:[url].....and click on 'Test Drive' under Interior design and Home renovations section, you will see what I envisage for my project. However, all I would like to know for now is how I can manipulate objects on the floorplan using action script.
View 2 Replies
Sep 17, 2002
I know there is a way to manipulate the objects that are within a movie clip, but what's the syntax for it? For example, if i have a movie clip that consists of 4 squares, how would move just one of those at a time, separate from the other 3?
View 7 Replies
Aug 12, 2011
I am trying to setup a movie where the user can move objects with the arrow keys. I have several objects that can be moved. My problem is that they all move at the same time. How can I fix it so you can click on an object and only that one object moves?
View 4 Replies
Oct 18, 2009
I've been trying to figure out a way to have movie clip effects only operate WHILE the two objects are colliding with each-other. It seems after they collide, however, They no longer need to be in contact to execute the supposedly conditional command. In an attempt to get around "hit Test" I made a fake hitTest, below:
function zone(mc, zquestion){
if(man._y < mc._y +25 && man._y > mc._y -25 && man._x < mc._x +25 && man._x > mc._x -25){ mc.onRelease = function(){ trace(zquestion); } }else { null;} } onEnterFrame = function(){ zone(block1, "Insert Important Question here?"); if(Key.isDown(Key.LEFT)){man._x -= 5;} if(Key.isDown(Key.RIGHT)){man._x += 5;} if(Key.isDown(Key.UP)){man._y -= 5;} if(Key.isDown(Key.DOWN)){man._y += 5;} }
except my attempt at "null/do nothing" if coordinates don't equal all of the above has failed. I really don't understand the "else" command, and would like to know how to create a "if NOT X...then DO NOT do Y".
View 1 Replies
Apr 9, 2010
Unfortunatly im having to extend to more draggable objects. So they will be within another movie clip so i can have them scrolling. After making the scroll, the draggable objects dont register on the droptarget as they are within another movie clip. Below is i think the part of the code that needs to be changed so the draggable objects know where to find the drop target.
View 1 Replies
Sep 5, 2010
Im new to AS3 nd I just had a quick question. In the puzzle game below, How do I delete all of the puzzle pieces that have been generated?
[Code]...
View 1 Replies
Feb 16, 2011
IE 8 Flash CS4 v10 Windows XP Home SP3 (NOTE: The word "Resize" refers to an HTML change of the movie size; it does not refer to a Window resize)
Objective: Display a transparent 800x600 flash movie in IE, stretching movie to 100% width and height of webpage but keeping the objects within the movie from getting re-scaled. Objects are re-positioned at runtime via ActionScript with values meant to be relative to stage dimensions.
Problem: The movie resize is messing up the object re-positioning. The movie is indeed stretching to 100% of the width & height of the browser window's client area, but the objects are repositioned relative to something else (perhaps screen dimensions, but not sure). Result: Objects which were programatically positioned relative to original stage size are spaced way too far apart in IE, in some cases off the screen entirely, though they were not like this in the Flash editor.Question(s): Why are objects which were positioned within the original stage dimensions being kicked off the browser screen while the movie itself remains entirely on-screen even after resize? What dimensions/values are guiding the automatic post-resize repositioning of the objects? (These proportions appear to be different from the change in proportions of the movie itself.)
View 1 Replies