Solved

Realtime update of coordinates while moving an object

Posted on 2008-10-19
6
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:blue-genie
ID: 22756194
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
ID: 22756820
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
ID: 22757400
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
ID: 22757520
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
ID: 22757778
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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…
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…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

695 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