How to display xy coordintes of drag and drop movie
can someone tell me how to display the coordinates of the red
cirle shown in the drag and drop tutorial found here:
http://www.flashvalley.com/fv_tutorials/advanced_drag_and_drop_in_Flash/
I have done this tutorial just fine but dont know how to
display its x and y coordinatetes in a dynamic text box as i move
the red circle around the screen.
thank you for any assistance you may give.
steve
Hi kglad,
I dont suppose you could show me how to create the loop? My
own research seems to indicate the onEnterFrame method would be
easiest.
I am just a beginner and even this is still beyond me.
thanks
Similar Messages
-
How do I set up my drag and drop questionaire to export to a XML file?
How do I set up my drag and drop questionaire to export to a
XML file?
I have a 70 seperate SWF files that pose a question and
contain a drag and drop rank order response of 1,2,3,4.How do I set
up a XML file that receives the responses.I don't understand how to
do the Actionscript
and get my responses to connect to the XML.Please
Help!Thanks!
Here's an example of my XML.
<assessment>
<sessionid>ffae926ea290ee93c3f26669c6c04a92</sessionid>
<request>save_progress</request>
<question>
<number>1</number>
<slot_a>2</slot_a>
<slot_b>1</slot_b>
<slot_c>4</slot_c>
<slot_d>3</slot_d>
</question>
<question>
<number>2</number>
<slot_a>4</slot_a>
<slot_b>3</slot_b>
<slot_c>2</slot_c>
<slot_d>1</slot_d>
</question>
<question>
<number>3</number>
<slot_a>1</slot_a>
<slot_b>2</slot_b>
<slot_c>3</slot_c>
<slot_d>4</slot_d>
</question>
</assessment>Use XML.sendAndLoad.
http://livedocs.macromedia.com/flash/8/main/00002879.html
You will need a server script to receive the XML structure
and it depends on
the server scripting language how you obtain that data. Then
you can either
populate a database or write to a static file or even email
the XML data
received from Flash.
For a basic example, I have two links I use for students in
my Flash
courses:
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLASP/Ex01/XMLASPEchoEx01_D oc.php
http://www.hosfordusa.com/ClickSystems/courses/flash/examples/XMLPHP/EX01/XMLPHPEchoEx01_D oc.php
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
"kenpoian" <[email protected]> wrote in
message
news:e5i9hp$cs6$[email protected]..
How do I set up my drag and drop questionaire to export to a
XML file?
I have a 70 seperate SWF files that pose a question and
contain a drag and
drop rank order response of 1,2,3,4.How do I set up a XML
file that receives
the responses.I don't understand how to do the Actionscript
and get my responses to connect to the XML.Please
Help!Thanks!
Here's an example of my XML.
<assessment>
<sessionid>ffae926ea290ee93c3f26669c6c04a92</sessionid>
<request>save_progress</request>
<question>
<number>1</number>
<slot_a>2</slot_a>
<slot_b>1</slot_b>
<slot_c>4</slot_c>
<slot_d>3</slot_d>
</question>
<question>
<number>2</number>
<slot_a>4</slot_a>
<slot_b>3</slot_b>
<slot_c>2</slot_c>
<slot_d>1</slot_d>
</question>
<question>
<number>3</number>
<slot_a>1</slot_a>
<slot_b>2</slot_b>
<slot_c>3</slot_c>
<slot_d>4</slot_d>
</question>
</assessment> -
How come in Pages, i cannot drag and drop images?
how come in Pages, i cannot drag and drop images?
Yes you can in all versions.
It helps if you actually describe what you are doing.
Where are you dragging it from and where are you dragging it to?
In what version of Pages?
I suspect you are trying to drag an image into a Table, Header or Footer in Pages 5, which is no longer possible. Feature removed by Apple.
Peter -
Why cant i drag and drop movies into itunes?
why cant i drag and drop movies into itunes?
To make it display on the desktop, Finder > Preferences > General tab > check external disks.
The drive might be formatted NTFS for Windows which is treated as read-only on the Mac. Need to reformat it using disk utility. -
I can't drag and drop movies from my hard drive onto my iPad.
I just recently upgraded from an iPad to an iPad 2. I still have the old iPad. I have no problem dragging and dropping movies and TV shows from my external hard drive onto my old iPad, but I can't seem to do it with the iPad 2. It syncs movies and TV shows from iTunes, but I don't want to have to load everything into iTunes just to get it onto my iPad. Again, no problems doing it with the old iPad. Any suggestions? Thanks in advance.
No I didn't - checked it, and now it works! I guess I forgot about setting that feature up when I got my first iPad. Thanks Allan!
-
Drag and Drop Movie Clips onto Plugin
Hi All,
We've built a plugin for Adobe Flash CS5.5, with a tree control in the plugin.
We wish to be able to drag and drop movie clips from the canvas onto the plugin. Wondering if anyone could point me in the right direction?
regards,
-amitHi,
If you are developing the plugin in Flash, have you tried to listen to NativeDragEvent.NATIVE_DRAG_ENTER and NativeDragEvent.NATIVE_DRAG_DROP ?
Once the plugin behaves like an AIR Application, you should have access to its API.
I hope it helps ! -
how do i drag and drop files from one external drive to another, i cannt get both drives to open up. only one at a time.. i have alot to learn i know but that is where i am at the time...
You posted here so would assume you are also talking about running Windows.
Are the drives NTFS and use on Windows?
Are they Mac HFS formatted?
You likely will need NTFS for OS X in one case. to mount PC and use under Mac OS Lion
MacDrive to mount and WRITE to HFS drives under Windows -
How to outline selected cells during drag and drop in the jtable
Hi,
I have spent a lot of time to find out how to outline selected cells during drag in the jtable, but I did not find the answer.
Can anybody give me a tip, where to read more about this problem or even better, give an example...
I have the following situation:
1.Table has 10 rows and 10 columns
2.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION) and setCellSelectionEnabled(true)
3.user select 5 cells in 4th row (for example cell45,cell46,cell47,cell48 and cell49)
4.user starts dragging. During dragging an outline should be drawn. Outline should be a rectangular with width of 5 cells and height of one cell. Outline should move according to the mouse position.
5.rectangular disappears when dropped
Regards,
PrimozIn "createTransferable" you can create a drag image
which you can paint in "dragOver" and clear in "drop" method of DropTarget :
package dnd;
* DragDropJTableCellContents.java
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
public class DragDropJTableCellContents extends JFrame {
public DragDropJTableCellContents() {
setTitle("Drag and Drop JTable");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
getContentPane().add(createTable("JTable"), BorderLayout.CENTER);
setSize(400, 300);
setLocationRelativeTo(null);
private JPanel createTable(String tableId) {
DefaultTableModel model = new DefaultTableModel();
for (int i = 0; i < 10; i++) {
model.addColumn("Column "+i);
for (int i = 0; i < 10; i++) {
String[] rowData = new String[10];
for (int j = 0; j < 10; j++) {
rowData[j] = tableId + " " + i + j;
model.addRow(rowData);
JTable table = new JTable(model);
table.getTableHeader().setReorderingAllowed(false);
table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
table.setCellSelectionEnabled(true);
JScrollPane scrollPane = new JScrollPane(table);
table.setDragEnabled(true);
TableTransferHandler th = new TableTransferHandler();
table.setTransferHandler(th);
table.setDropTarget(new TableDropTarget(th));
table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
JPanel panel = new JPanel(new BorderLayout());
panel.add(scrollPane);
panel.setBorder(BorderFactory.createTitledBorder(tableId));
return panel;
public static void main(String[] args) {
new DragDropJTableCellContents().setVisible(true);
abstract class StringTransferHandler extends TransferHandler {
public int dropAction;
protected abstract String exportString(JComponent c);
protected abstract void importString(JComponent c, String str);
@Override
protected Transferable createTransferable(JComponent c) {
return new StringSelection(exportString(c));
@Override
public int getSourceActions(JComponent c) {
return COPY;
@Override
public boolean importData(JComponent c, Transferable t) {
if (canImport(c, t.getTransferDataFlavors())) {
try {
String str = (String) t.getTransferData(DataFlavor.stringFlavor);
importString(c, str);
return true;
} catch (UnsupportedFlavorException ufe) {
} catch (IOException ioe) {
return false;
@Override
public boolean canImport(JComponent c, DataFlavor[] flavors) {
for (int ndx = 0; ndx < flavors.length; ndx++) {
if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
return true;
return false;
class TableTransferHandler extends StringTransferHandler {
private int dragRow;
private int[] dragColumns;
private BufferedImage[] image;
private int row;
private int[] columns;
public JTable target;
@Override
protected Transferable createTransferable(JComponent c) {
JTable table = (JTable) c;
dragRow = table.getSelectedRow();
dragColumns = table.getSelectedColumns();
createDragImage(table);
return new StringSelection(exportString(c));
protected String exportString(JComponent c) {
JTable table = (JTable) c;
row = table.getSelectedRow();
columns = table.getSelectedColumns();
StringBuffer buff = new StringBuffer();
for (int j = 0; j < columns.length; j++) {
Object val = table.getValueAt(row, columns[j]);
buff.append(val == null ? "" : val.toString());
if (j != columns.length - 1) {
buff.append(",");
return buff.toString();
protected void importString(JComponent c, String str) {
target = (JTable) c;
DefaultTableModel model = (DefaultTableModel) target.getModel();
String[] values = str.split("\n");
int colCount = target.getSelectedColumn();
int max = target.getColumnCount();
for (int ndx = 0; ndx < values.length; ndx++) {
String[] data = values[ndx].split(",");
for (int i = 0; i < data.length; i++) {
String string = data;
if(colCount < max){
model.setValueAt(string, target.getSelectedRow(), colCount);
colCount++;
public BufferedImage[] getDragImage() {
return image;
private void createDragImage(JTable table) {
if (dragColumns != null) {
try {
image = new BufferedImage[dragColumns.length];
for (int i = 0; i < dragColumns.length; i++) {
Rectangle cellBounds = table.getCellRect(dragRow, i, true);
TableCellRenderer r = table.getCellRenderer(dragRow, i);
DefaultTableModel m = (DefaultTableModel) table.getModel();
JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
lbl.setBounds(cellBounds);
BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
BufferedImage.TYPE_INT_ARGB_PRE);
Graphics2D graphics = img.createGraphics();
graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
lbl.paint(graphics);
graphics.dispose();
image[i] = img;
} catch (RuntimeException re) {
class TableDropTarget extends DropTarget {
private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
private Rectangle rect2D = new Rectangle();
private TableTransferHandler handler;
public TableDropTarget(TableTransferHandler h) {
super();
this.handler = h;
@Override
public void dragOver(DropTargetDragEvent dtde) {
handler.dropAction = dtde.getDropAction();
JTable table = (JTable) dtde.getDropTargetContext().getComponent();
Point location = dtde.getLocation();
int row = table.rowAtPoint(location);
int column = table.columnAtPoint(location);
table.changeSelection(row, column, false, false);
paintImage(table, location);
autoscroll(table, location);
super.dragOver(dtde);
public void dragExit(DropTargetDragEvent dtde) {
clearImage((JTable) dtde.getDropTargetContext().getComponent());
super.dragExit(dtde);
@Override
public void drop(DropTargetDropEvent dtde) {
Transferable data = dtde.getTransferable();
JTable table = (JTable) dtde.getDropTargetContext().getComponent();
clearImage(table);
handler.importData(table, data);
super.drop(dtde);
private final void paintImage(JTable table, Point location) {
Point pt = new Point(location);
BufferedImage[] image = handler.getDragImage();
if (image != null) {
table.paintImmediately(rect2D.getBounds());
rect2D.setLocation(pt.x - 15, pt.y - 15);
int wRect2D = 0;
int hRect2D = 0;
for (int i = 0; i < image.length; i++) {
table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
pt.x += image[i].getWidth();
if (hRect2D < image[i].getHeight()) {
hRect2D = image[i].getHeight();
wRect2D += image[i].getWidth();
rect2D.setSize(wRect2D, hRect2D);
private final void clearImage(JTable table) {
table.paintImmediately(rect2D.getBounds());
private Insets getAutoscrollInsets() {
return autoscrollInsets;
private void autoscroll(JTable table, Point cursorLocation) {
Insets insets = getAutoscrollInsets();
Rectangle outer = table.getVisibleRect();
Rectangle inner = new Rectangle(outer.x + insets.left,
outer.y + insets.top,
outer.width - (insets.left + insets.right),
outer.height - (insets.top + insets.bottom));
if (!inner.contains(cursorLocation)) {
Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
cursorLocation.y - insets.top,
insets.left + insets.right,
insets.top + insets.bottom);
table.scrollRectToVisible(scrollRect);
Edited by: Andre_Uhres on Nov 18, 2007 10:03 PM -
How to Create Table Using Column Drag and Drop Feature
Hi:
I am new to Oracle SQL dev Data Modeler tool and would like to know if there is a way to create a new table by re-using the existing columns or column groups. The idea is to maintain consistency and save table design time. If columns created previously can be re-used and require drag and drop of column in the right pane, then only new columns need to be manually created.
Any thoughts on this will be appreciated.
Thanks!Hi Kent
I checked out the video and tried it in Oracle designer, it works and works great!
My other question is that I may have several set of columns that I may want to group depending on the table requirements. Can I have multiple templates and choose which one to apply to?
Also, how do I choose the table where the table template needs to be applied. As I may be interested in applying the table template to selected tables only.
Thanks
Edited by: user648132 on Feb 20, 2012 10:47 AM -
I would like to archive hundreds of my emails that currently exist in my apple mail email filing system by moving them into file folders in the finder. I can do this easily with a single email but it wont let me do it with multiple emails or a complete folder. Is there any way of do this easily?
Thanks very much for this. However, I understand how dragging and dropping files normally works. It just seems the it wont work when you do it with emails when you are transfering them into a normal finder system folder. If you highlight one file and drag it to a finder folder it works, but when you drag multiple, it just wont let you do it.
Is there any work around for this? Thank you once again for your time. -
How can I build an animated drag and drop multimeter lead using Flash?
I am building a virtual multimeter for testing simulated circuits. I would like to be able to drag an animated multimeter test lead to a point in the circuit and drop it on a target. The static drag and drop is not my issue. I would like some suggestions on how I can animate the movement of the lead itself. Any suggestions would be appreciated.
you want something to "follow the mouse" but not be dragged?
if yes, use a loop (enterframe) and ease the object's position to the mouse:
object.x+=speed*object.x+(1-speed)*mouseX; -
How to use the palette or drag and drop functions in netbean?
Is there anyone who can help me out on using drag and drop function in netbean to design GUI inteface..??
Is palette is the tool that can be used to drag and drop.??
thank you in advance.I actually really like the GUI builder in netbeans. I used to be a big eclipse user so I am very familiar with coding GUIs by hand, and most of what I do involves GUI's or at least swing.
At first I hated netbeans, I hated that I couldn't edit the code most. Then I decided to take a deep breath and really examine the issue. What I discovered is that most of the edits I wanted to make but couldn't really weren't the right way to be doing it in the first place, for the rest the code is actually really easy to change you just have to know how.
Now my palette is huge, probably about 250 objects in it organized into sections that work for me. Basically if I want a object to do something that is not already in the palette I simply write a new object and add it to the palette. I started small like with rounded buttons/progress bars, and as I got comfortable I now have some fairly advanced objects like grids, isometric grids, alpha composits, an animated hourglass countdown timer, and an animated "loading/activity" indicator that is not tied to a progress indicator.
The main reason I stuck with the netbeans drag and drop GUI builder is it's layout manager is really a very nice layout manager, you couldn't pay me enough to go back to eclipse or codeing GUIs by hand, as I can now do in one day what used to take me several weeks.
So what I am saying is stick with netbeans and the drag and drop, it sucks at first, but once you get to a point where you are comfortable with it and adding to the palette it will become a great tool.
JSG -
How to change mouse cursor during drag and drop
Hi Guys,
Iam performing a Drag and drop from Table1(on top of the figure) to Table2(down in the figure).
see attached figure
http://www.upload-images.net/imagen/e80060d9d3.jpg
Have implemented the Drag and drop functionality using "Transferable" and "TransferHandler"using the java tutorial
http://java.sun.com/docs/books/tutorial/uiswing/examples/dnd/index.html#ExtendedDndDemo
Now My problem is that ,I want to make the 1st column in Table2(ie: Column2-0) not to accept any drops so that the cursor appears like a "No-Drop" cursor but with selection on the column cell during a drop action.
Also when I move my cursor between "column2-0" and "column2-1",want to to have the "No-Drop" and "Drop" cursor to appear depending on the column.
How can I achieve it using the TransferHandle class.Dont want to go the AWT way of implementing all the source and target listeners on my own.
Have overridded the "CanImort" as follows:
public boolean canImport(JComponent c, DataFlavor[] flavors) {
JTable table = (JTable)c;
Point p = table.getMousePosition();
/* if(p==null)
return false;
int selColIndex = table.columnAtPoint(p);
if(selColIndex==0)
return false;*/
If I execute the above commented code,The "No-Drop" Icon appears in "column2-0",but no cell selection.Also If I move to "column2-1",which is the 1st column,Still get the "No-Drop" Icon there,also with no cell selection.
for (int i = 0; i < flavors.length; i++) {
if ((DataFlavor.stringFlavor.equals(flavors))) {
return true;
return false;
Thanks in advance.....
Edited by: Kohinoor on Jan 18, 2008 3:47 PMIf you found the selection column based on the mouse pointer, then based on the column, you can set the cursor pointer as any one as below :
setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
setCursor(new Cursor(Cursor.HAND_CURSOR)); -
List display update labelfunction after drag and drop
I have two list boxes. I have drag and drop enabled and depending upon whether an item has been already dragged to the right box, I want its display in the left box to change (gray out). I have the label function working fine but it's always one item behind, i.e., when I drop an item in the right side box, it's not grayed in the left box until the next action.
I've tried after the drop things such as:
dp.refresh()
leftSideBox.validateNow();
Anything else I can do to get the left side box to re-run the label function for the dataprovider as soon as the drop is done?Wow. It's almost as if you knew the answer. Thanks.
-
How to add text to a drag and drop object
Hi everyone, I am quite a beginner with Flash so do excuse
me. First, I am not sure if what I want to achieve may actually be
impossible with Flash. I presently use MX 2004, but will shortly be
upgrading to CS3. But if you know the answer for MX 2004 that would
be really useful for now.
I am writing a digital fiction story, and I want to create
drag and drop objects. This I have managed to do. But I would like
these drag and drop objects to also reveal text when they are
actually pressed on. I have had no success so far in being able to
achieve the two effects together.
Does anyone know how I can achieve this? If, by chance, you
know the action script that would be great. If you can explain to
me in simple terms how I can achieve this I really would be
grateful.
Thanking you,
MaryThe script I posted would work on the main timeline - not in
the timeline of the clip itself.
So you made a movieclip out of the image and gave it the
instance name "myclip". That's good.
You edited that clip and added a dynamic text box with
instance name "mytext". Be careful not to confuse the "instance"
name of the text box with the "Var:" name. "myclip" should be the
instance name. Also be careful to make sure you uncheck the
"selectable" box. Edit your clip and click on the textbox to select
it and look in the properties panel. There should be a button with
Ab on it. If it is white background (highly likely), click it so it
is not white. If the text is selectable, it will interfere with
your button functions.
While there is nothing wrong with creating nested clips
within your movieclips, unless you plan to target them for
something, there is no benefit. The only thing that needs an
instance name inside the myclip is the textbox (based on what you
are trying to do).
You don't need any actionscript in the movieclip itself. If
you can learn to place all your AS on the root timeline, you will
be well ahead.
If you placed that AS inside the clip, Flash wouldn't know
what to do with it.
Technically you can place the AS inside the clip on the layer
you created but, if you did that, you would need to modify the
script to the following:
this.onPress = function() {
this.mytext.text = "stop pressing so hard";
startDrag(this);
this.onRelease = function() {
this.mytext.text = "";
stopDrag();
Maybe you are looking for
-
my family shares one apple id among 4 devices. how do i make it IMPPOSSIBLE for my children (i pad mini and i pod touch 5) to view my contacts and texts while still sharing my apps? please help. been working on this for hours.
-
What is DTP in BI 7.0 ?
What is DTP in BI 7.0 ? Please search the forum before posting a thread Edited by: Pravender on Sep 6, 2010 1:20 PM
-
How to call a concurrent program with some parameters in a stored procedure
Hi All, I have made two procedures, xx_nidhi_proc1 and xx_nidhi_proc2. xx_nidhi_proc1 takes four parameters from front end and is registered as concurrent program in oracle apps and running fine alone. xx_nidhi_proc2 calls the concurrent program of x
-
Hi all, when i am trying to run the below query it is hanging up the PC.I don't understand where i am doing wrong.Can someone kindly suggest me with a solution SELECT SUM (mmtt.primary_quantity) (SUM (moqd.transaction_quantity) + SUM(mmt.pri
-
Invoice Baseline Date = GR Doc. Date
Hi all, I have a requirement to fetch the GR Doc. Date into the Baseline Date Field in MIRO. What are the settings to be done. Regards, Baskar