How modificate this script from mouse click to release
how modificate this script from mouse click to release
package
* A Colorful Fireworks Demonstration in Actionscript 3
* from shinedraw.com
import flash.events.MouseEvent;
import flash.system.ApplicationDomain;
import flash.events.Event;
import flash.display.MovieClip;
import com.shinedraw.effects.ColorfulFireworks;
public class Document extends MovieClip{
private var _colorfulFireworks : ColorfulFireworks;
public function Document(){
this.addEventListener(Event.ADDED_TO_STAGE, on_added_to_stage);
private function on_added_to_stage(e : Event):void{
// place the object to the stage
_colorfulFireworks = new ColorfulFireworks();
addChild(_colorfulFireworks);
// add the cover to save CPU time
var coverClass : Class = ApplicationDomain.currentDomain.getDefinition("Cover") as Class;
var cover : MovieClip = new coverClass();
addChild(cover);
cover.addEventListener(MouseEvent.CLICK, on_cover_click);
// remove the cover after click
private function on_cover_click(e:MouseEvent):void{
var cover:MovieClip = e.target as MovieClip;
removeChild(cover);
_colorfulFireworks.start();
solved close pls
Similar Messages
-
Scripting a mouse click and drag
does anyone know how to script a mouse click and drag. I tried XTools. No luck. What about Cliclick. I had tons of success with TextCommands but I dont know how to get OSAX plugin code to work. Thanks in advance.
I am trying to move a desktop clock (QuartzClock) from the center of the screen to the side.I tried (unsuccessfully) to find a mouse move and click solution in Applescript.
My search brought me to this site: http://www.geekorgy.com/index.php/2010/06/python-mouse-click-and-move-mouse-in-a pple-mac-osx-snow-leopard-10-6-x/
The following python script will move an object from position 60.100 to 60.300
#!/usr/bin/python
import sys
import time
from Quartz.CoreGraphics import * # imports all of the top-level symbols in the module
def mouseEvent(type, posx, posy):
theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclickdn(posx,posy):
mouseEvent(kCGEventLeftMouseDown, posx,posy);
def mouseclickup(posx,posy):
mouseEvent(kCGEventLeftMouseUp, posx,posy);
def mousedrag(posx,posy):
mouseEvent(kCGEventLeftMouseDragged, posx,posy);
ourEvent = CGEventCreate(None);
currentpos=CGEventGetLocation(ourEvent); # Save current mouse position
mouseclickdn(60, 100);
mousedrag(60, 300);
mouseclickup(60, 300);
time.sleep(1);
mousemove(int(currentpos.x),int(currentpos.y)); # Restore mouse position
See also:
http://developer.apple.com/mac/library/documentation/Carbon/Reference/QuartzEven tServicesRef/Reference/reference.html
http://developer.apple.com/graphicsimaging/pythonandquartz.html
Tony -
How can I (neatly) control mouse click events in a multi-dimensional array?
Hello everyone!
I have a question regarding the use of mouse clicks events in a multi-dimensional array (or a "2D" array as we refer to them in Java and C++).
Background
I have an array of objects each with a corresponding mouse click event. Each object is stored at a location ranging from [0][0] to [5][8] (hence a 9 x 6 grid) and has the specific column and row number associated with it as well (i.e. tile [2][4] has a row number of 2 and a column number of 4, even though it is on the third row, fifth column). Upon each mouse click, the tile that is selected is stored in a temporary array. The array is cleared if a tile is clicked that does not share a column or row value equal to, minus or plus 1 with the currently targeted tile (i.e. clicking tile [1][1] will clear the array if there aren't any tiles stored that have the row/column number
[0][0], [0][1], [0][2],
[1][0], [1][1], [1][2],
[2][0], [2][1], [2][2]
or any contiguous column/row with another tile stored in the array, meaning that the newly clicked tile only needs to be sharing a border with one of the tiles in the temp array but not necessarily with the last tile stored).
Question
What is a clean, tidy way of programming this in AS3? Here are a couple portions of my code (although the mouse click event isn't finished/working correctly):
public function tileClick(e:MouseEvent):void
var tile:Object = e.currentTarget;
tileSelect.push(uint(tile.currentFrameLabel));
selectArr.push(tile);
if (tile.select.visible == false)
tile.select.visible = true;
else
tile.select.visible = false;
for (var i:uint = 0; i < selectArr.length; i++)
if ((tile.rowN == selectArr[i].rowN - 1) ||
(tile.rowN == selectArr[i].rowN) ||
(tile.rowN == selectArr[i].rowN + 1))
if ((tile.colN == selectArr[i].colN - 1) ||
(tile.colN == selectArr[i].colN) ||
(tile.colN == selectArr[i].colN + 1))
trace("jackpot!" + i);
else
for (var ii:uint = 0; ii < 1; ii++)
for (var iii:uint = 0; iii < selectArr.length; iii++)
selectArr[iii].select.visible = false;
selectArr = [];
trace("Err!");Andrei1,
So are you saying that if I, rather than assigning a uint to the column and row number for each tile, just assigned a string to each one in the form "#_#" then I could actually just assign the "adjacent" array directly to it instead of using a generic object to hold those values? In this case, my click event would simply check the indexes, one at a time, of all tiles currently stored in my "selectArr" array against the column/row string in the currently selected tile. Am I correct so far? If I am then let's say that "selectArr" is currently holding five tile coordinates (the user has clicked on five adjacent tiles thus far) and a sixth one is being evaluated now:
Current "selectArr" values:
1_0
1_1, 2_1, 3_1
2_2
New tile clicked:
1_0
1_1, 2_1, 3_1
2_2
2_3
Coordinate search:
1_-1
0_0, 1_0, 2_0, 3_0
0_1, 1_1, 2_1, 3_1, 4_1
1_2, 2_2, 3_2
2_3
Essentially what is happening here is that the new tile is checking all four coordinates/indexes belonging to each of the five tiles stored in the "selectArr" array as it tries to find a match for one of its own (which it does for the tile at coordinate 2_2). Thus the new tile at coordinate 2_3 would be marked as valid and added to the "selectArr" array as we wait for the next tile to be clicked and validated. Is this correct? -
How to access script from within Bridge
I have considerable experience scripting InDesign, but this is my first
Bridge script...
The following script does what I want from within the ESTK, but I have
no idea what to do to make it runnable from within Bridge... :(
Any pointers?
var brSel = app.document.selections[0].spec.toString();
var bt = new BridgeTalk();
//brSel = brSel.toSource();
bt.target = "indesign";
theScript = "var IDsel = app.selection[0]; \n";
theScript += "if (IDsel instanceof Graphic){ \n";
theScript += "var theGraphic = IDsel;\n";
theScript += "}else{\n";
theScript += "var theGraphic = IDsel.graphics[0];\n";
theScript += "}\n";
theScript += "var theFile = File(\""+brSel+"\");\n";
theScript += "theGraphic.itemLink.relink(theFile);\n";
theScript += "theGraphic.itemLink.update();\n";
bt.body=theScript;
bt.send()
Thanks,
HarbsHarbs,
There isn't anything like a scripts palette in Bridge.
Because your working on a selection, you'll need to add a menu item to bridge.
You can also navigate to the folder containing the scripts and double click it. But then the script is the selection...
Bob -
How-to Generate Script from the export dump file
Hi all,
Software : Oracle 10gR2/Windows 2003
=============================
Has anyone generated a Script from a export dump file ( exported via data pump export). I know it is possible to generate script from the regular export.
I want to know how to generate the script for various objects or is it possible to get the counts of types of objects in the dump file and / or generate the script from the export dump file exported via data pump utility on Oracle 10g.
Thanks,
SSI want to know how to generate the script for various objects.what do you mean by scripts? Assuming the metadata definitions of various objects.
First of all, you can generate the metadata definitions using import.
Use, Impdp with SQLFILE parameter to generate the SQL file for the metadata definitions.
Refer to
http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14215/dp_overview.htm -
How execute Unix script from java?
Can I execute Unix script from java?
Yes. Using ProcessBuilder. And read [When Runtime.exec() wont|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html]. It's old, but pretty much all of it is still true.
-
I can still load it with the script running or attempting to run in the background but it makes firefox tremendously slow. After I click on stop running the script then everything seems to be ok.
how do I get the script not to run in the first place.In Firefox the use of the term chrome refers to the user interface and other elements that are not part of the web pages.
See https://developer.mozilla.org/en/Chrome
Your problems seems to be caused by the GreaseMonkey extension.<br />
See [[Troubleshooting extensions and themes]] -
How to highlight Icon with mouse click ?
This program will open up a JFileChooser, Select one or more than one images from your computer. It will display them as Icons.
I am trying to highlight any icon with mouseclick from the program below but I am not able to do it. Please help. Thanks in advance.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.swing.*;
import javax.swing.border.Border;
public class IconIllustrate extends JFrame implements ActionListener, MouseListener
JLabel[] lblimage = new JLabel[10];
JPanel panAttachment = new JPanel();
JPanel panButton = new JPanel();
JButton bAdd = new JButton("Add");
Component comp = null;
Component c = null;
boolean bolVal = false;
public IconIllustrate()
// TODO Auto-generated constructor stub
panButton.add(bAdd);
bAdd.addActionListener(this);
this.getContentPane().setLayout(new BorderLayout());
this.getContentPane().add(panAttachment, BorderLayout.CENTER);
this.getContentPane().add(panButton, BorderLayout.SOUTH);
* @param args
public static void main(String[] s)
// TODO Auto-generated method stub
IconIllustrate ii = new IconIllustrate();
ii.setLocation(300, 200);
ii.setTitle("Testing Highlight Icon");
ii.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ii.setSize(400, 300);
ii.setVisible(true);
public void actionPerformed(ActionEvent ae)
// TODO Auto-generated method stub
if(ae.getSource().equals(bAdd))
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(true);
int answer = chooser.showOpenDialog(this);
File[] file = null;
String[] fileName = new String[10];
if(answer == JFileChooser.OPEN_DIALOG)
file = chooser.getSelectedFiles();
ImageIcon icon;
try
for(int i = 0; i < file.length; i++)
icon = new ImageIcon(file.toString());
ImageIcon thumbnailIcon = new ImageIcon(getScaledImage(icon.getImage(), 50, 40));
lblimage = new JLabel[10];
lblimage[i] = new JLabel();
lblimage[i].addMouseListener(this);
lblimage[i].setName("" + i);
lblimage[i].setBorder(BorderFactory.createEmptyBorder());
lblimage[i].setVerticalTextPosition(JLabel.BOTTOM);
lblimage[i].setHorizontalTextPosition(JLabel.CENTER);
lblimage[i].setHorizontalAlignment(JLabel.CENTER);
lblimage[i].setIcon(thumbnailIcon);
panAttachment.add(lblimage[i]);
panAttachment.revalidate();
catch(Exception ex )
ex.printStackTrace();
private Image getScaledImage(Image srcImg, int w, int h)
BufferedImage resizedImg = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = resizedImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(srcImg, 0, 0, w, h, null);
g2.dispose();
return resizedImg;
public void mouseClicked(MouseEvent me)
// TODO Auto-generated method stub
int clickCount = me.getClickCount();
if(clickCount == 1 || clickCount == 2)
Component comp = me.getComponent();
Component c = comp.getComponentAt(me.getX(), me.getY());
// c.setPreferredSize(new Dimension(100, 100));
c.setBackground(Color.CYAN);
System.out.println("clickCount");
repaint();
this.panAttachment.revalidate();
public void mouseEntered(MouseEvent arg0)
// TODO Auto-generated method stub
public void mouseExited(MouseEvent arg0)
// TODO Auto-generated method stub
public void mousePressed(MouseEvent arg0)
// TODO Auto-generated method stub
public void mouseReleased(MouseEvent arg0)
// TODO Auto-generated method stubHi,
phungho2000 wrote:
Thank you for the Code. Now I am able to set the label border. I need to figure out how keep track of the last selected component so that I can reset the border.**g**
No, you have still fundamental misunderstood how listeners are working. You add a listener to a component. From this time on, this listener is watching this component. It listens if something occurs with this component therefor it is competent. If so, then it will pay attention to this. So the listener always knows the components it is in charge of. There is no need for you to "keep track of the last selected component" because the listener is doing this for you already.
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.*;
public class FocusTesting extends JFrame implements FocusListener, MouseListener
// There is no need for JLabel fields here.
//JLabel labelA = new JLabel("Label A");
//JLabel labelB = new JLabel("Label B");
public FocusTesting()
super("FocusTesting");
JPanel paneFirst = new JPanel();
JPanel paneSecond = new JPanel();
paneSecond.setBackground(Color.gray);
//use simply FlowLayout for testing this
//paneFirst.setLayout(new BorderLayout());
paneFirst.setBorder(BorderFactory.createBevelBorder(2));
// pane.setBackground(Color.blue);
JLabel labelA = new JLabel("Label A");
// give the labelA a name only to show you, that the listener knows about the compontent it ist added to
labelA.setName(labelA.getText());
labelA.addMouseListener(this);
labelA.addFocusListener(this);
labelA.setFocusable(true);
JLabel labelB = new JLabel("Label B");
// give the labelB a name only to show you, that the listener knows about the compontent it ist added to
labelB.setName(labelB.getText());
labelB.addMouseListener(this);
labelB.addFocusListener(this);
labelB.setFocusable(true);
paneFirst.add(labelA);
paneFirst.add(labelB);
this.getContentPane().setLayout(new GridLayout(2, 1));
this.getContentPane().add(paneFirst);
this.getContentPane().add(paneSecond);
public static void main(String[] s)
//separate the initial thread form the event dispatch thread
SwingUtilities.invokeLater(new Runnable() {
public void run() {
FocusTesting ft = new FocusTesting();
ft.setLocation(300, 200);
ft.setSize(300, 200);
ft.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ft.setVisible(true);
public void focusGained(FocusEvent fe)
// TODO Auto-generated method stub
JComponent jcomp = (JComponent)fe.getComponent();
jcomp.setBorder(BorderFactory.createLineBorder(Color.GREEN, 5));
System.out.println("focusGained " + jcomp.getName());
public void focusLost(FocusEvent fe)
// TODO Auto-generated method stub
JComponent jcomp = (JComponent)fe.getComponent();
jcomp.setBorder(BorderFactory.createEmptyBorder());
System.out.println("focusLost " + jcomp.getName());
public void mouseClicked(MouseEvent me)
Component comp = me.getComponent();
comp.requestFocusInWindow();
System.out.println("mouseClicked " + comp.getName());
public void mouseEntered(MouseEvent arg0)
// TODO Auto-generated method stub
public void mouseExited(MouseEvent arg0)
// TODO Auto-generated method stub
public void mousePressed(MouseEvent arg0)
// TODO Auto-generated method stub
public void mouseReleased(MouseEvent arg0)
// TODO Auto-generated method stub
} You also should read again the Java Tutorial about Concurrency in Swing. Especially why and how to separate the initial thread form the event dispatch thread. [http://java.sun.com/docs/books/tutorial/uiswing/concurrency/initial.html]
Also have a look on [http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html], especially [http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html#focusable] for why use the MouseListener too.
And if you have understood that all, then you may think about in what way it would be much easier to use JButton's instead of JLabel's for your clickable and focusable thumbnails.
best regards
Axel -
Satellite U500-1E0 - how to switch off the mouse 'clicking' noise
Please can anyone tell me how to switch off the 'clicking' noise that the mouse buttons make when they're depressed?
Thanks.Im not U500 owner but Ive got a U400 notebook model.
As far as I know the touchpad buttons dont support any clicking sound which could be enabled or disabled by software.
Therefore I would say its a mechanical noise which cannot be disabled.
Bye -
11g: How to populate LOV from button click
Hi,
I want to populate a LOV when the user clicks a button (no af:inputlistofvalues is used)
How to do this?
regards
PeterI was looking something like what you've asked and found a solution for my requirement, it might help ..
Basically I have a RichInputListOfValues on my page but it is set to invisible and I am using a commandlink to popup the LOV ..
See the code below..
RichInputListOfValues lovComp = getPostingTemplate();
FacesCtrlLOVBinding.ListOfValuesModelImpl lovModel = null;
lovModel =
(FacesCtrlLOVBinding.ListOfValuesModelImpl)lovComp.getModel();
lovModel.performQuery(lovModel.getQueryDescriptor());
LaunchPopupEvent e = new LaunchPopupEvent(lovComp);
e.queue(); -
How to convert scripts from CS3 to CS5 ?
I made several scripts while using CS3. Now that I have got the CS5 version, how can I convert those previous scripts ? Thanks for your help.
Which OS are you using.
Windows XP/Vista/7 32 bit "C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts" and "C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts"
Windows 64bit "C:\Program Files\Adobe\Adobe Photoshop CS5\Presets\Scripts" , "C:\Program Files (x86)\Adobe\Adobe Photoshop CS5\Presets\Scripts"
Mac OS version ?? -
How to print Script from in Hindi
I need to print Sap-script Form in Hindi(India's national language). For this I have uploaded Hindi Font 'MANGAL.TTF' file to R/3 by SE73 as Font families 'ZHND'. I defined Paragraph 'P1' of Font family 'ZHND'. But my form still printing in English.
Can anyone help me as this form is required for Govt. of India PSU which do all the processing in Hindi.
Thanks in Advance,
Dinesh Singh.Dear Surya,
Thanks for reply. Even defining hindi font pragraph, script is taking only English characters. That's why I am not able to hardcode in Hindi.
Dinesh -
Mighty Mouse clicking and releasing randomly
Hello,
Its difficult to describe exactly what is happening but I'll try to be specific. I am running Mac OS X (fully updated) and Parallels 6. The only major change I've made was to install Adobe CS5 creative suite to the Mac side, and the mouse issues started perhaps a week or two after that. Basically, if I select something and try to drag it, whether it be objects in a design program, folders on the desktop, or even copy in a document, the mouse will deselect and reselect at random. This has gotten progressively more irritating to the point where I dread the click and drag wholeheartedly. Some days are definitely worse than others, and there is no rhyme or reason as to when this will happen. I could be organizing the desktop, working in Adobe Indesign, or simply editing copy in Microsoft Word. It also has no qualms as far as whether I am working on the Mac or PC side. It is obnoxious on both platforms.
So far I have tried all the basics such as restarting, using compressed air to clean out the mouse, attaching a new mouse (its a usb connection), using a different usb port altogether, and using compressed air to clean out the ports before I plug the mouse in. I have also tried switching between my desk and a mouse pad in complete desperation. None of these attempts have has any affect. Can anyone offer any suggestions?Hello and Welcome to Apple Discussions ...
Fist, here are the instructions to clean a Might Mouse: http://support.apple.com/kb/HT1537
and here: http://www.macosxhints.com/article.php?story=20060210115417864&lsrc=osxh
Second, go to System Preferences/Keyboard&Mouse/Mouse and make sure your Tracking/Scrolling and Double Clicking is set to your liking. (The System Preferences panel is located in your Applications folder)
Carolyn
Message was edited by: Carolyn Samit -
Adjust Image Problem - Image Changes when Mouse Click is Released.
I love the fact that images can be adjusted after insertion into a page (Things like brightness, contrast etc). The problem I have which is very frustrating is that while any control on the Adjust Image panel is selected and being edited (click and hold mouse button to move a slider), the images' contrast and brightness change (perhaps as if to indicate selection?). This is inherently a problem since it's these very characteristics you're trying to edit. So you adjust the image to your liking but when you release the mouse button, then image then suddenly changes and is no longer the way you want it. Anyone else seen this problem and have any helpful suggestions?
I have been trying to replicate your issue using different format images..but I did not succeed.
If its not images and types that cause the problem, then the inference is that it the application.
The usual advice... unless you want to contact tech support and present your problem to them - is to uninstall iBA with Appdelete or similar rather than dragged to the trash, and then do a reinstall.
This presupposes you saved everything/copies etc,.
BTW, I seldom use the various sliders, with practice using the LEVELS can be more effective, have you tried this option? -
How do I Get the value from a mouse click - on a waveform graph?
If I have made a plot into a Waveform Graph and later want to do a zoom of my data
(Not zoom into the Waveform Graph, but regenerate the data). How do I read the mouse
coordinate if I click on the graph window. I know how to put up the horiz and vert
cursors but don't know how to just read the mouse click. I would really like to
follow the windows standard that identifys a rectangle by clicking and draging and then
be able to read the corners of the rectangle. Thanks, Rick
PS: Using Labview 6iI would recommend to 'translate' your graph in a picture and dislay it in a picture control (see picture examples in LV6).
Once you did it, pictures have an extremely useful property called Mouse that returns the mouse coordinates and click events when you place the cursor on the picture.
By this you can re-arrange the graph on picture appearance.
There are also other methods such as using a Window's API that returns the mouse position referred to the whole screen window, but I believe this would be much more difficult to implement.
Let me know if this was clear and if you need an example vi.
Good luck,
Alberto
Maybe you are looking for
-
how do i edit my billing info if my credit card associated with apple id expired and i have a duty to app store from the time when i had the old credit card? so the thing is a few days ago i made an app store purchase and i didn't know i was running
-
Library Preview displays at lower resolution than Develop Preview
I recently bought a Nikon D7100. I took some test shots and imported the images to Lightroom 4.4, then generated 1:1 previews for all the images. Previews zoomed to 1:1 in Library Mode are noticeably soft. The image below is a screen shot of the Lib
-
my ipod will not downgrade from 5.0 or 4.3.5 to a 4.3 4.2.1 it is a 4G ipod touch im trying to downgrade to a 4.3 or 4.3.3 this ipod model is MC540LL right now i have 5.0 but there was the same problem with downgrade when i had a 4.3.5 firmware
-
Hot key detection in a near cache?
I found this example to detect hot keys in a distributed cache server: http://wiki.tangosol.com/pages/viewpage.action?pageId=16686 How would I accomplish the same thing but for a near cache? thanks sam
-
HT1338 My iphoto has disappeared! What happened? Help
I went to use my iphoto library after sometime not using and it is not there! Where did the picture albums go?