ActionScript 2.0 :: Position A Movieclip With Coordinates Inside A Xml File?
Feb 6, 2012what i need is to position a Movieclip with coordinates inside a xml file.
View 1 Replieswhat i need is to position a Movieclip with coordinates inside a xml file.
View 1 RepliesI have this XML that I want to use to set the position of movieclips placed dynamically on the stage but I am having a hard time figuring it out.This is what I have in my XML:
ActionScript Code:
<STARS>
<STAR XPOS ="93" YPOS = "44"> </STAR>
[code].....
How to position an mc on the center coordinates of another mc embedded inside. inside of my main mc I have an image and mcs above. I want to make a button that says something like: On release center main mc on coordinates of mc inside of main mc. So far I have some code for an on event function:
main_image_mc.onEnterFrame = function() {
main_image_mc._x;
main_image_mc._y;
speed1 = 8;
function moveIt(endX, endY) {
[Code] .....
I have a movie clip called "myMC". I set its x value as such:
[AS]
var myMC:MovieClip = new MovieClip();
addChild(myMC);
myMC.x = 100;
[Code]....
I know I could proboly acheive this with a math equation but is there a function that can get the exact global position of "myShape"? So that I can position another movieclip or sprite around that movieclip?
I have a mc on stage. I want to add a new mc inside it and position it at the bottom of the mc.
The code works fine when the container mc is 100% scaled, but when I scale it, the mc inside positions wrongly.
Heres my code:
PHP Code:
// Lage scroller:var o0LbScroll:Object = getChildByName("o0LbScroll");o0LbScroll.oppKnapp = new scrollKnapp;o0LbScroll.nedKnapp = new
[Code].....
how can i test the position of the mouse inside the area of a specific movieclip WITHOUT using rollover and rollout events?
the movieclip is the irregular shape (star)
i need to do some action according to the position of mouse (inside/outside of the movieclip area) but i can not use rollover event because i have a button placed over the movieclip.
This seems like it should be simple, but... I've been trying to figure out how to do the following, and I can't seem to make it work. It all works except for the hit test part. I have a working drag and drop application. I need something different to happen when the user drops an object while the mouse x,y is, or is not over a certain (very irregularly shaped) bitmap inside a movieClip. how to do this? I have found some complicated ways to hit test between 2 bitmaps, but not 1 bitmap and mouse x,y.
View 3 RepliesI am having difficulty with getting the playhead to move inside a movieclip based on the horizontal or vertical position of the mouse on the screen. I can get the horizontal motion to move the playhead, but I can't get the vertical movement to do the same. I have attached the document class .as file for it.
View 2 Repliesi have a pie chart with clickable sectors. when you click a sector it jumps to the next frame on a movieclip and changes colour. I want to use Local Shared Object to save the frame position so when i come back to the swf later on the sectors of the pie chart are saved.
View 16 Repliesthis concerns flash cs5 and the timeline.Everybody knows the effect you get when you use appendText() to add text to a multiline dynamic textfield, right ? Well, I have a movieClip as a container, and I would like dynamic textfields to populate this movieclip in the same manner as textStrings would populate the dynamic Textfield.
How would this work?I have buttons that trigger addChild() function so as to populate the movieclip with textfields, but how do I make sure that the textfields make up an arbitrary list as a menu user chooses which buttons to click?
Let's say this is the visible text when the swf runs.(I cut away some of the code to make this more to the point):
var buttonTrace:TextField=new TextField;
addChild(TextClip.buttonTrace); buttonTrace.x=0;
buttonTrace.y=0;
buttonTrace.text="Breadcrumbs";
Now for each time I click a button in the menu I've made, a new textfield appears with the name of the button. This is how I want it. BUT......... How do I control the display properties and positioning of dynamic textfields within a movieclip ? How do I control persistent visibility, and how do I make these textfields appear one after the other in the order they were clicked.
I have some little listener.
stage.addEventListener(Event.RESIZE,rozmiar1);
function rozmiar1(e:Event):void
{
ofertaBTN.oCenter.width=(14.59*stage.stageWidth)/100;
ofertaBTN.oRight.x = ofertaBTN.x+ofertaBTN.oLeft.width +ofertaBTN.Ocenter.width;
}
But only ofertaBTN.oCenter.width is changing. oRight is not responding and I get error #1010.
how I can access the coordinates of an mc, but its coordinates with respect to the stage.
What I am doing is using a dragging function, but while the mouse is moving I am also trying to trace the position of the mc itself with respect to its position on the stage, but it seems to keep giving me very small numbers, almost like numbers with respect to its original position. I am not sure yet though why this is. Here is my code:
[Code]....
I have also tried to get rid of the this.x = mouseX and the same for y, but then it returns the values as undefined when i trace this.x and this.y
Excuse the title, had no idea what to call this. I'm creating a simple game with the following components (added picture for clarity):
[URL]
1. Character - The symbol in the center of the stage.
2. Level - The bounds surrounding the stage. Everything in this picture is contained within the level except for the character.
3. Water - The blue square. The water symbol is located within the level symbol.
4. Water droplet - The blue dot floating above the water. This is also located within the level symbol.
Using the arrow keys the player controls the movement of the level. While the character symbol is always located at x=275, y=200 (center stage), the level symbol's coordinates change whenever the arrows are pressed. This gives the player the illusion that they are controlling the character.
When the player makes the character symbol touch the water symbol, I want to move the water droplet to the location of the character. The problem is, I can't for the life of me figure out the coordinates I need as they will always be different depending on where the character touched the water. It's important that the water droplet be inside of the level symbol because after the player drops the water I need it to act as if it's moving with the surroundings.
tl;dr: I essentially need to find the x and y distance from the character symbol to the origin of the level symbol, keeping in mind that the level symbol's location is always changing and that both symbols are located on the stage.
Okay without putting a million boxes around the circle, which i found laggs out my game alot. How can i use some sort of code to find all the coordinates inside a circle.
View 2 RepliesI have a Button that is inside MovieClip1 which is inside MovieClip2; yet when i click the Button it doesn't dispatch Event.
View 5 RepliesI'm figuring out a way to update my mouse x and y inside a loop. In this small test block, I'm tracing the mouseX and mouseY twice. The first one is outside a loop. The second one is inside a loop.
When I test the SWF, you can see that the first trace changes constantly and seamlessly. But when you hold your mouse down, the code starts tracing the 2nd trace. Even though the mouse is down and moving, the mouseX and mouseY traced is not changing.
Actionscript Code:
import flash.events.MouseEvent;import flash.events.Event;var mouseIsUp:Boolean = true;stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);stage.addEventListener(MouseEvent.MOUSE_UP,
[Code]....
Closely related to the main question, when you click the stage, you would get 100 lines of the 2nd trace. Is there a way to break the loop as soon as the mouse is up?
I googled for almost a day to find the answer to my question: [URL]. This almost works (and is a great solution), but the solution doesn't work when I do:
1). Copy and paste multiple-line texts.
2). Write long and scroll the texts.
I also found another working example at: [URL]. (The autocomplete prompt appears when you press ctrl+space right at the caret's position). But an email from its author says he uses monotype fonts to calculate individual character's location. Is there a way to get multi-line input from a textfield?
I have a Movieclip (MC1) with and moving object (OBJ1) inside it and using AS3. I want to do a hit test on it with another object (OBJ2) that is on the stage. Normally I would just do MC1.x + OBJ1.x to get my coords for the hit test. But how do I do it if MC1 has been rotated?
View 2 RepliesI added a Menu_mc on my stage. Initially, this should be at the center of the stage and when I click on it, it will tween on the upper left corner of the browser. However, when I resize the browser, the Menu_mc goes back to the center of the screen.
I have tried separating a different actionscript file where it is specifically for initialization of the object and another one for resizing. And then when I call it on my main AS file it goes like this:
Code:
// Add the symbols to stage
var Menu_mc = new Menu_MC();
addChild(Menu_mc);
[code]...
But it seems futile.
I'm hoping someone can solve this headache. Basically, I want a movieclip to move to the position of each of my buttons from any position along my x axis. Therefore, the movieclip needs to 'flip' to face the way it is traveling.At the moment I have the movieclip moving to the mouse x axis when I ROLLOVER the button and stop following the mouse when I ROLLOUT but the code won't flip the movieclip so I must have something wrong...
btn.addEventListener(MouseEvent.ROLL_OVER,followCa t);
btn.addEventListener(MouseEvent.ROLL_OUT,stopCat);
btn02.addEventListener(MouseEvent.ROLL_OVER,follow Cat);
btn02.addEventListener(MouseEvent.ROLL_OUT,stopCat );
[code]....
setting a position of movieclip called red x and y position within a movieclip called background
Code:
background.redsquare.x = 300;
background.redsquare.y = 300;
comes up with TypeError: Error #1010: A term is undefined and has no properties.
setting a position of movieclip called red x and y position withen a movieclip called background
Code:
redsquare.x = 300;
redsquare.y = 300;
This works fine but how can that be when surely you must access the red withen the background rather then just accessing red?
lets say i have a sprite on the stage and one movieclip inside it. now i want to tween or just set that movieclip x and/or y position according to stage position. so for example i want to set mc.y = - 100; (by which i mean -100 to stage, not sprite which mc is in.)
View 2 RepliesWhat i'd like to do is have a menu/site map that adjusts when you click on a certain icon. For example, I have a AS3.0 flash file with, say, 5 keyframes with 5 buttons that are in different positions on each key frame. The buttons are set to gotoAndPlay the various keyframes. I can set up a tween that links frame 1 to 2, 2 to 3 etc. but what I would like is a tween from, say, 1 to 3, then 3 to 5, then 5 to 1 - basically in a random order rather than sequentially through the key frames. I could set each of these tweens up individually but the site is for a portfolio that I would like to keep adding to and to do this individually would mean an ever increasing amount of tweens.Basically, is there a way to get a 'MovieClip' to move from Position A in keyframe 1 to Position B in another keyframe without a set of tween frames? I'm sure this is simpler than I am making it sound but I don't seem to be able to work it out.
View 1 RepliesI have a movieclip inside another movieclip.[code]...
I can get mc_inside._x and mc_inside._y properties relative to the container movieclip, but how can I get the mc_inside._x and mc_inside._y relative to the _root (the stage)?
I'm putting together a site, that has 3 pages and I'd like the content to move into position when the menu button is clicked. So, 3 buttons etc, 'Home, Portfolio, contact" and one movie clip that contains the info. I'm not really a programmer [URL].
View 1 Repliesfor some reason whenever i call or define a variable like this:
Code:
onClipEvent(enterFrame){trace(k); k = go._y;}
the trace results in "undefined". dose anyone know why and how to get around this issue? it
[code]....
Basically there's an object in a movieclip. I want to find the location of that object in relation to the movieclip, not of the object's symbol. So when i and look at the x and y of it, it wont show 0, it will show the x and y location in the movieclip it's in.
View 4 RepliesIs it possible? Has there been a thread on this..
View 5 RepliesI've been scouring the web to see how to do this, and now I'm not even sure it's possible. However, it seems there must be way. What I want to do is create a function that will take x,y coordinates and tell me what MovieClip or Sprite is at that location. I want it to happen automatically, without any MouseEvents or anything like that.
View 8 RepliesI have a problem regarding the x, and y coordinates on a flash project of mine. Whenever I set the x and y coordinates for a movieClip:
Code:
function setPos() {
with (mc1) {
_x = 400;
_y = 300;
}}
The MovieClip never gets sent to the proper coordinates.