Solved

Realtime update of coordinates while moving an object

Posted on 2008-10-19
6
311 Views
Last Modified: 2013-11-11
Im experiencing a problem with Flash, which im trying to learn still on very basic level...  Now to the question I have done a simple ball object and a simple dynamic textfield called coordholder.

What i've been trying to do is to constantly when the object is moving showing the coordinates of the ball in the coordholder as text,

Ive been trying a lot of stuff but I guess it's possible to use some kind of trigger that uses a timer and while the timer is on the coords should be updated and on drop stop it.  

Do you guys have any idea of how this could be done?
0
Comment
Question by:clooak
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
firstly, AS2 or AS3.
secondly. how are you doing the moving of the ball - or are you wanting to know how to do that.
then you're right about the timer you'll just get the coordinates of the object and display it in the textfield.

0
 

Author Comment

by:clooak
Comment Utility
well i've a onpress and on release event which triggers the ball to move, If i would implement it, then it will just get the coordinates when i drop and release or something. What i want is that it should as long as the object is moving(ball) then update the coordinates in the dynamic field
0
 
LVL 39

Expert Comment

by:blue-genie
Comment Utility
triggers the ball to move - is this a frame tween, a normal script tween?
when i drop or release or something - you need to be more specific. i.e. is the ball a drag and drop and when you release it you want the coordinates?
or is the ball going from left to right and at some point in time (when would be nice) - you want to show the coordinates.

the reason i'm asking these questions is to determine which solution to suggest to you.
for example how to determine if the ball is moving etc.

0
 

Author Comment

by:clooak
Comment Utility
Well i forgot to mention it's a drag and drop event and as long as the ball is dragged I want it to determine it's actual coordinates of the object and set it in the textbox as text.

No motion tween or anything just a drag and drop event

Tell me if there is anything else that which is unclear
0
 
LVL 39

Accepted Solution

by:
blue-genie earned 100 total points
Comment Utility
ok i'm assuming youre using AS2 since you're refering to onRElease events.
ok however you're doing your drag and drop you should be able to use setInterval to call a function every however many milliseconds you want to get the x and y of the object. you'll do this where you have the startDrag

just make sure when you have your onrelease which stops the dragging that you clear the interval.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now