Setting and remembering _x _y of MC

FLASH

    Next

  • 1. sendAndLoad issues with FF and Safari
    Any ideas? I'm using a standard sendAndLoad to hit an ashx page, and the ashx page is returning two variables. I'm loading the returning vars into a result_lv and then parsing them from there. In IE this process works like a charm, but in Safari and FireFox, nothing is being sent back to the result_lv. Anyone else have this problem, and or solved it? Andrew
  • 2. Symbol Instance Names
    I can create a new instance by (please tell me if this is wrong) var myVar:MovieClip = new MovieClip(); How do I give that movie clip an instance name using only AS3? Thanks, Wayne
  • 3. button instance not performing correctly
    i have a button that when it is held down for over 2 seconds it will jump to a frame, and jump to a different frame if just pressed and not held down. I have the code working, I am trying to apply it to an instance of another button(named fwd1). If i drop the actionscript in the first frame of my actions layer it works, but not just for the frames where the button instance is defined as fwd1, but all frames of the button that aren't given an instance name. If I give the button an instance name other that fwd1 somewhere on the timeline, then the button wont work on any frame past that point, even if i setup a keyframe and add the fwd1 instance to the button somewhere farther down the timeline. Isn't the point of button instance names to allow you to code them differently on different frames but not have to create a different button?? Should I just create a new button?? thank you for any insight into this matter..
  • 4. LoadClip preload, but not a "preloader"
    I am trying to find a way to use LoadClip to load an external SWF into a main SWF, but not actually attach the loaded SWF to an instance til later in the timeline. Example: On Frame 5 of the main timeline, I want to use LoadClip to load the external SWF in to memory, but I don't want to initiate the loaded SWF til frame 50. Why, you may ask. Well, I'm making the flash EXE for a CD. The external SWF is small and loads fine, only problem is that when running from a CD, the loading of the external SWF causes a two second pause. Not enough time for a preloader, but enough to annoy me (also, the loading of the SWF causes audio in the main EXE to pause as well). I'm hoping that preloading the SWF earlier in the timeline will resolve this problem. Any help is appreciated! -dave
  • 5. loading problem
    hello everybody, i loading a image through loadmovie functio() which is of 100 kb.it's loading perfectly.but i want to attach a loader with this...that atleast user can know that how much percentage will loading.plz help me..thanks

Setting and remembering _x _y of MC

Postby Walloompoom » Fri, 14 Apr 2006 07:52:48 GMT

So, Im able to store the x, y position of a dragable mc in a var but how do I 
set the position of XMc when a user goes back to that screen? I need XMc to 
remember where it last was(I have that) and go there when you enter frame(I 
dont have that).




 XMc.onPress = function() {
 	XMc.startDrag("");
 	XMc.gotoAndStop(2);
 };
 XMc.onRelease = function() {
 	XMc.stopDrag();
 	XMc.gotoAndStop(1);
 	myX = _xmouse;
 	myY = _ymouse;
 	XmyXY = String(myX)+","+String(myY);
 	trace (XmyXY);
 };


Re: Setting and remembering _x _y of MC

Postby NSurveyor » Fri, 14 Apr 2006 08:19:26 GMT

if(XMc.ox!=undefined){
 	XMc._x = XMc.ox;
 	XMc._y =  XMc.oy;
 }
 XMc.onPress = function() {
 	this.startDrag();
 	this.gotoAndStop(2);
 };
 XMc.onRelease = function() {
 	this.stopDrag();
 	this.gotoAndStop(1);
 	this.ox = this._x;
 	this.oy =  this._y;
 };


Similar Threads:

1._x & _y of mc relative to stage and not parent mc

Good Morning all,

 I?m trying to get the _x and _y of a movieclip relative to the stage where 
said movieclip is nested inside several others, which have been dynamically 
rotated. 

 I?m hoping there is an easy way to get this rather then taking the route of 
reverse engineering the position and rotation of each parent movieclip in order 
to calculate it.

 Thanks in advance

 Will 


2.Image / MC height / _x and _y positioning

 To access height, width of image; you will have to wait till the image loads 
completely. You can use custom loader for this purpose. Or look for 
"MovieClipLoader" class. It provides all necessary events. 

3.Setting _x and _y properties on a loaded Movie

Title says it all. How can i set _x and _y properties to a loadedMovie? 

Thanks for helping.

4.Dynamic setting of _x and _y

Hi all,   Setup I have 4 questions(MC0-3_mc) on a page, when the student gets 
it wrong I want to suffle the questions from 0,1,2,3 to 3,0,1,2 then if they 
are really dense do it all over again 2,0,1,3 till they get it right.  I have 
the _x and _y I just can't re-shuffle the x/y  Thanks Bobby 

5.Set mc._x property value from an array

Im trying to import x and y points from a external file ("getDevices.txt") and 
use them to position a new MovieClip from the library in a loop.
 I know I could be using _root.attachMovie("box", "box_mc"+i, 110+i, 
{x:something, y:something});
 I've just been playing with this all day and tried many different methods, but 
still no luck. I think my problem may be in the setup of the array and not how 
its presented to _root["box_mc"+i]._y
 Because if I create a new array like ypos = new Array(20, 40); it worked

 The Actionscript code (Cant seem to find any tags, so I just used Quote)
 //get devices and loop through
 var mydevices:LoadVars = new LoadVars();
 mydevices.load("getDevices.txt");
 var ypos = [];
 mydevices.onLoad = function() {
         for (i=0; i<2; i++) {
                 //ypos = new Array([this["y"+i]]); //How is this different as 
oppose to the next line?
                 ypos.push([this["y"+i]]);
                 trace(ypos);
                 _root.attachMovie("box", "box_mc"+i, 110+i);
                 _root["box_mc"+i]._y = (ypos);
         }
 };

 I get the values 400 and 200 in the output screen, but need help assinging 
them to the objects x and y position.

 This is the contents of the text file

  &NumofDevices=5&animal0=cow&y0=400&x0=-50&animal1=horse&y1=200&x1=300
 Any ideas? where are the AS tags in these forums?
 -Jason.:confused;

6. _x and _y wrong

7. _x and _y coordinate question

8. attachMovie and _x, _y position in Flash Player5



Return to FLASH

 

Who is online

Users browsing this forum: No registered users and 94 guest