UILoader component

drag doesn't update properties

Page 1 of 1

5 Replies - 3515 Views - Last Post: 29 August 2007 - 04:40 AM

#1 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

UILoader component

Post icon  Posted 26 August 2007 - 01:32 AM

Assuming a UILoader instance named "myLoader" is on the stage, consider the following code:

myLoader.load(new URLRequest("http://www.colegrp.com/DI_Avatar.jpg"));

myLoader.addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown);
myLoader.addEventListener(MouseEvent.MOUSE_UP, handleMouseUp);

function handleMouseDown(evt:MouseEvent):void {
	trace("b1: " + myLoader.x + "," + myLoader.y);
	trace("b2: " + myLoader.content.x + "," + myLoader.content.y);
	myLoader.startDrag();
}

function handleMouseUp(evt:MouseEvent):void {
	myLoader.stopDrag();
	trace("a1: " + myLoader.x + "," + myLoader.y);
	trace("a2: " + myLoader.content.x + "," + myLoader.content.y);
}

Dragging the component around doesn't update the properties. The x & y properties have clearly changed, though their values do not reflect the change.

Any ideas as to how I might obtain the new values?

This post has been edited by DilutedImage: 26 August 2007 - 02:26 AM


Is This A Good Question/Topic? 0
  • +

Replies To: UILoader component

#2 theRemix   User is offline

  • D.I.C Regular

Reputation: 15
  • View blog
  • Posts: 440
  • Joined: 19-October 05

Re: UILoader component

Posted 27 August 2007 - 02:17 PM

so you do get output, but the output doesn't change accordingly?

like
b1: 100,100
b2: 100,100
a1: 100,100
a2: 100,100
b1: 100,100
b2: 100,100
a1: 100,100
a2: 100,100
b1: 100,100
b2: 100,100
a1: 100,100
a2: 100,100
b1: 100,100
b2: 100,100
a1: 100,100
a2: 100,100
b1: 100,100
b2: 100,100
a1: 100,100
a2: 100,100


?
Was This Post Helpful? 0
  • +
  • -

#3 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: UILoader component

Posted 27 August 2007 - 03:06 PM

Correct.

And I can get correct output from a Loader object within a MovieClip or Sprite object. I just can't seem to get it out of a UILoader.
Was This Post Helpful? 0
  • +
  • -

#4 pioSko   User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: UILoader component

Posted 28 August 2007 - 03:28 AM

isn't it supposed to be _x not x??
Was This Post Helpful? 0
  • +
  • -

#5 DilutedImage   User is offline

  • D.I.C Addict
  • member icon

Reputation: 15
  • View blog
  • Posts: 646
  • Joined: 20-November 06

Re: UILoader component

Posted 28 August 2007 - 12:12 PM

No, I'm using AS3. I probably should have mentioned that though. :D
Was This Post Helpful? 0
  • +
  • -

#6 pioSko   User is offline

  • still.dreaming
  • member icon

Reputation: 23
  • View blog
  • Posts: 1,888
  • Joined: 06-June 03

Re: UILoader component

Posted 29 August 2007 - 04:40 AM

That's why I don't like using startDrag(). There's always problems with it when dealing with updating, co-ordinating co-ordinates and snap.

My suggestion is to use an onEnterFrame() script that will basically update the x and y values depending on _xmouse and _ymouse.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1