Use Array To apply eventListeners to numerous Buttons
I have this function that I want to apply to 10 different MovieClips that are on the stage by using an array. I wrote the array, I just need to know how I can apply the array to the function. Thank you
var sliceArray:Array=["slice1","slice2","slice3","slice4","slice5","slice6","slice7",
"slice8","slice9","slice10"];
btn1.addEventListener(MouseEvent.MOUSE_DOWN, sliderFunction)
btn1.addEventListener(MouseEvent.MOUSE_UP, sliderFunctionRelease)
function rotateMC(num:Number)
slice1.rotation+=num;
function sliderFunction(event:Event):void
stage.addEventListener(Event.ENTER_FRAME, onEnter)
function onEnter(event:Event):void
rotateMC(10);
function sliderFunctionRelease(event:Event):void
stage.removeEventListener(Event.ENTER_FRAME, onEnter);
Thank you Mr Murphy....that helped
I think I misspoke, I just wanted to have the actions within my function applied to all the members in the array. Just wanted to do this. Thanks
var sliceArray:Array=["slice1","slice2","slice3","slice4","slice5","slice6","slice7",
"slice8","slice9","slice10"];
function rotateMC(num:Number)
for(var i:uint = 0; i<sliceArray.length; i++)
this[sliceArray[i]].rotation+=num;
Similar Messages
-
How can I tell that a default numeric format has been applied to a numeric limit step?
I am working on generating custom HTML code for our test systems in order to reduce the 'footprint' of the standard HTML entries for numeric limits, multiple-numeric limit steps etc....
For a Numeric Limit step, I can set the Numeric Format via the 'Limits' tab and select the pulldown arrow to select any format. Does TestStand actually save this information with the step so I could possibly use this later? I ask this because my modifications are within the 'ModifyReportEntry' Callback. When I am modifying the code to generate new HTML within this callback, I have no idea if the developer has selected a Numeric Format for a given step OR simply left it as DEFAULT.
To make matters more confusing, here is some more information....
When I pause the execution in the callback I notice the following:
Case 1: User has selected a Numeric Format ( this example I will say 3 digits of precision ) %.3f. for a numeric limit step.
Parameters.Result.Limits.Low = 10.000
Parameters.Result.Limits.High = 20.000
Parameters.Result.Numeric = 15.657
Notice the numeric data is ALREADY formatted! Great, I can simply use this to generate my custom HTML table for the numeric limit step.
Case 2 : User has left the numeric format to <Default> for the step.
Parameters.Result.Limits.Low = 10
Paramters.Result.Limits.High = 20
Parameters.Result.Numeric = 15.65713515155
Numeric data is NOT formatted. I know that TestStand will apply the Default Numeric Format that is configured in the report options when it writes the report but since I am doing a custom report I am stuck.
My question is how can I possibly tell that the data has already been formatted by TestStand in the ModifyReportEntry callback? Is there some flag that I could check or anything?
I do notice that the Parameters.ReportEntry string contains TestStand's default HTML code for the step and this is already properly formatted.. so as a possible workaround I could 'pick out' the data from this string but this is slow and time consuming.
Thanks
PHPH,
You can find out if the numeric format has changed using the TestStand API. I use the following statement in my step's post-expression to find out the numeric format that TestStand uses for the step.
Step.Limits.Low.NumericFormat
If the string returned is an empty string, then it is the default format, otherwise, it's the one specified in the string.
Hope this helps.
Raj
National Instruments
Applications Engineer -
i-phone3 wont recharge; initially home button wouldn't work. Applied the 'auto-touch button thing' via settings. This worked until I ran out of battery life. Now it won’t recharge either via laptop (usually does) or wall switch. Just a blk screen.
In general theory, one now has the Edit button for their posts, until someone/anyone Replies to it. I've had Edit available for weeks, as opposed to the old forum's ~ 30 mins.
That, however, is in theory. I've posted, and immediately seen something that needed editing, only to find NO Replies, yet the Edit button is no longer available, only seconds later. Still, in that same thread, I'd have the Edit button from older posts, to which there had also been no Replies even after several days/weeks. Found one that had to be over a month old, and Edit was still there.
Do not know the why/how of this behavior. At first, I thought that maybe there WAS a Reply, that "ate" my Edit button, but had not Refreshed on my screen. Refresh still showed no Replies, just no Edit either. In those cases, I just Reply and mention the [Edit].
Also, it seems that the buttons get very scrambled at times, and Refresh does not always clear that up. I end up clicking where I "think" the right button should be and hope for the best. Seems that when the buttons do bunch up they can appear at random around the page, often three atop one another, and maybe one way the heck out in left-field.
While I'm on a role, it would be nice to be able to switch between Flattened and Threaded Views on the fly. Each has a use, and having to go to Options and then come back down to the thread is a very slow process. Jive is probably incapable of this, but I can dream.
Hunt -
Error using Arrays.toString()
Hi there,
I am getting the following error using Arrays.toString on a String Array. 'toString() in java.lang.Object cannot be applied to (java.lang.String[]).
The line in question is at the bottom of the below code. It starts 'rtitem.appendText.....
import lotus.domino.*;
//import java.util.Arrays;
public class JavaAgent extends AgentBase {
Database curDb;
String[] dbList;
public void NotesMain() {
int dbcount = 0;
try {
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
//get current database
Database curDb = agentContext.getCurrentDatabase();
//build a list of servers;
String[] servers = {"Norwich002/Norwich/MoneyCentre","Norwich003/MoneyCentre","Norwich004/MoneyCentre","Norwich005/MoneyCentre","Norwich007/Norwich/MoneyCentre","Norwich008/Norwich/MoneyCentre","Norwich010/Norwich/MoneyCentre","Norwich020/Norwich/MoneyCentre","Norwich021/Norwich/MoneyCentre"};
//loop through server list
int arraylen = servers.length;
for(int i=0;i <= arraylen;i++){
//create a notesdbdirectory collection for the current server iteration
DbDirectory dbdir = session.getDbDirectory(servers);
//get first database
Database db = dbdir.getFirstDatabase(DbDirectory.DATABASE);
//loop through databases in dbdir
while (db != null){
//add database details to our list
dbList[dbcount] = db.getTitle() + " - " + db.getFilePath();
dbcount++;
} catch(Exception e) {
e.printStackTrace();
private boolean sendEmail(String subject){
try{
Document mailDoc = curDb.createDocument();
mailDoc.replaceItemValue("SendTo","Hayleigh S Mann/Norwich/MoneyCentre");
mailDoc.replaceItemValue("Subject",subject);
RichTextItem rtitem = mailDoc.createRichTextItem("Body");
rtitem.appendText(java.util.Arrays.toString(dbList));
mailDoc.send();
return true;
}catch(Exception e){
e.printStackTrace();
return false;No, that doesn't make any sense. Arrays.toString can take any array as an arg: [http://java.sun.com/javase/6/docs/api/java/util/Arrays.html#toString(java.lang.Object[])]
import java.util.*;
public class A {
public static void main(String[] args) {
String str = Arrays.toString(args);
System.out.println(str);
:; java -cp . A abc 123 xxx
[abc, 123, xxx] -
I have keithley 238 SMU, which when used in sweep mode returns the value in a array of cluster of 4 numeric indicators of which 2 are voltage and current and other two are step size and delay....I want to plot
I-V curves, how to do that?Hello aby
this could be a possible solution to separate 2 values from an array of 4 elements clusters an create 2 arrays suitable for graphing.
Hope it helps.
Alipio
"Qod natura non dat, Salmantica non praestat"
Attachments:
a_solution.vi 24 KB -
I am unable to update my apps on my iphone5s. After entering the applied password, the update button reappears and nothing happens. Can anyone help? Thanks
Hey there Tonyaokb,
It sounds like you are trying to update some of your apps and when you tap the update button, the update does not happen. I recommend starting by closing the running apps on the phone:
iOS: Force an app to close
http://support.apple.com/kb/ht5137
Double-click the Home button.
Swipe left or right until you have located the app you wish to close.
Swipe the app up to close it.
When you have done that, sign out of your iTunes account in Settings > iTunes and App Stores, and restart the phone and try to update them again:
iOS: Turning off and on (restarting) and resetting
http://support.apple.com/kb/ht1430
If the issue persists I would next verify that you can find it in your purchased history with ths article:
Tap App Store.
Make sure you're signed in with the same Apple ID used for the original purchase.
Tap Updates.
Tap Purchased on the resulting screen.
So that you can then delete the app and re install it:
Reinstall the affected app
Remove the app from your device and reinstall it:
Tap and hold any app icon on the Home Screen until the icons start to wiggle and show a small "x" in the top-left corner of the app.
Tap the "x" in the corner of the app you want to delete.
Tap Delete to remove the app and all of its data from your device.
Press the Home button.
Go to the App Store.
Search for the app and download it again.
Note: If it's a paid app, make sure you're using the iTunes account you purchased the app with originally. If it isn't, you may be asked to purchase the app again. Learn more about downloading previously purchased items.
From: iOS: Troubleshooting apps purchased from the App Store
http://support.apple.com/kb/ts1702
Thank you for using Apple Support Communities.
Take care,
Sterling -
Ok i am trying to get a tic tac toe game, which uses array. I need to get 3 buttons and store them then i can check those numbers to see if its a win. Here is my code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class project4q3 extends JFrame implements ActionListener {
private JButton buttons[]=new JButton[9];
private String names[]={"1","2","3",
"4","5","6",
"7","8","9",};
private int map[][]= {{1,2,3}, {4,5,6}, {7,8,9}, {1,4,7}, {2,5,8},
{3,6,9}, {1,5,9}, {3,5,7}};
private JPanel infoPanel;
private JLabel player,player2;
private int row=0,count=0;
private int whosMove=1;
// set up GUI and event handling
public project4q3()
super( "Tic Tac Toe" );
infoPanel = new JPanel();
// two layouts, the upper one is grid style and the
// lower one is flow style.
infoPanel.setLayout (new GridLayout(3, 3));
//Add Button Names
for(int i=0;i<buttons.length;i++)
buttons=new JButton(names[i]);
// direction button objects
for(int i=0;i<buttons.length;i++)
buttons[i].addActionListener( this );
//Grid buttons
for(int i=0;i<buttons.length;i++)
infoPanel.add(buttons[i]);
// grid layout of the main panel, one upper and the other lower
getContentPane().add(infoPanel);
setTitle("Tic Tac Toe");
setSize(400, 400 );
setVisible( true );
} // end constructor
// handle button events because this->actionperformed
// i.e., (project3q6)->actionPerformed, is added into
// each button's action
public void actionPerformed( ActionEvent event ){
int n1=0,n2=0,n3;
for(int i=0;i<buttons.length;i++){
if (event.getSource()==buttons[i])
n1=Integer.parseInt(names[i]);
System.out.println(n1);
System.out.println(n2);
for(int i = 0; flag == 0 && i< c.length; i++){
if(n1==c[i][0]&&n2==c[i][1]&&n3==c[i][2]){
flag = 1;
else if (n1==c[i][0]&&n3==c[i][1]&&n2==c[i][2]){
flag = 1;
else if(n2==c[i][0]&&n1==c[i][1]&&n3==c[i][2]){
flag = 1;
else if(n2==c[i][0]&&n3==c[i][1]&&n1==c[i][2]){
flag = 1;
else if(n3==c[i][0]&&n1==c[i][1]&&n2==c[i][2]){
flag = 1;
else if(n3==c[i][0]&&n2==c[i][1]&&n1==c[i][2]){
flag = 1;
// the start of the game
public static void main( String args[] )
project4q3 application = new project4q3();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );I couldn't try this out due to a few syntax errors, so fixed some. Now the buttons seem to work.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class project4q3 extends JFrame implements ActionListener {
private JButton buttons[]=new JButton[9];
private String names[]={"1","2","3",
"4","5","6",
"7","8","9",};
private int c[][]= {{1,2,3}, {4,5,6}, {7,8,9}, {1,4,7}, {2,5,8},
{3,6,9}, {1,5,9}, {3,5,7}};
private JPanel infoPanel;
private JLabel player,player2;
private int row=0,count=0;
private int whosMove=1;
private int flag;
// set up GUI and event handling
public project4q3()
super( "Tic Tac Toe" );
infoPanel = new JPanel();
// two layouts, the upper one is grid style and the
// lower one is flow style.
infoPanel.setLayout (new GridLayout(3, 3));
//Add Button Names
for(int i=0;i<buttons.length;i++)
buttons=new JButton(names[i]);
// direction button objects
for(int i=0;i<buttons.length;i++)
buttons[i].addActionListener( this );
//Grid buttons
for(int i=0;i<buttons.length;i++)
infoPanel.add(buttons[i]);
// grid layout of the main panel, one upper and the other lower
getContentPane().add(infoPanel);
setTitle("Tic Tac Toe");
setSize(400, 400 );
setVisible( true );
} // end constructor
// handle button events because this->actionperformed
// i.e., (project3q6)->actionPerformed, is added into
// each button's action
public void actionPerformed( ActionEvent event ){
int n1=0,n2=0,n3=0;
for(int i=0;i<buttons.length;i++){
if (event.getSource()==buttons[i])
n1=Integer.parseInt(names[i]);
System.out.println(n1);
System.out.println(n2);
for(int i = 0; flag == 0 && i < c.length; i++){
if(n1==c[i][0]&&n2==c[i][1]&&n3==c[i][2]){
flag = 1;
else if (n1==c[i][0]&&n3==c[i][1]&&n2==c[i][2]){
flag = 1;
else if(n2==c[i][0]&&n1==c[i][1]&&n3==c[i][2]){
flag = 1;
else if(n2==c[i][0]&&n3==c[i][1]&&n1==c[i][2]){
flag = 1;
else if(n3==c[i][0]&&n1==c[i][1]&&n2==c[i][2]){
flag = 1;
else if(n3==c[i][0]&&n2==c[i][1]&&n1==c[i][2]){
flag = 1;
// the start of the game
public static void main( String[] args)
project4q3 application = new project4q3();
application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); -
How can I automatically close a dialog box using Javascript after I click the OK button to submit it? I don't want to have to X out of the dialog box after I am done.
Thanks
LindaJS can not interact with open dialogs in any way, unless it's a dialog
created in JS using the Dialog object.
On Thu, Jul 24, 2014 at 11:13 PM, lindaeliseruble <[email protected]> -
How to use same actions for differ pop-up buttons
Hi gurus,
I am using 2 popup in a view.same popup's having same buttons 'Yes', 'No'.when i use 1st one i have to create an action for that Yes button where i put my code for that particular Action.
But when i used 2nd one the action define for that is not acceptable with differ name.it takes only standard one.
Now my Query is : How to use same actions for differ pop-up buttons with in a similar view?Where i put my code.
Plz sugges me.
<b>Points will be sured.</b>
Sanket sethiHi ,
u can use the method SUBSCRIBE_TO_BUTTON_EVENT of the IF_WD_WINDOW interface ... to handle the event fired by the popup .....used this method after creating the popup window ...
regards
Yash -
When I try to play some of the songs in my itunes library, I get a prompt saying the file cannot be used. When I hit the locate button, the file cannot be found. I didn't delete any songs/files and there is no common link between the missing songs.
Hello there, Paso Kid.
The following Knowledge Base articles provide some assistance with locating content in your iTunes Library:
iTunes: Finding lost media and downloads
http://support.apple.com/kb/TS1408
and
Where are my iTunes files located?
http://support.apple.com/kb/HT1391
If you have already reviewed those steps and still cannot find the songs you purchased from iTunes, delete the songs and download them again using the information in this article:
iTunes 11 for Windows: Download previous purchases from the iTunes Store
http://support.apple.com/kb/PH12491
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro. -
How to use Spry validation with link styled submit buttons..??
I'm working with a theme package that comes with a bunch of button styles that work with basic links. For example:
<a href='page.html' class='small-button smallblue'><span>Button Label</span></a>
I've got a basic form setup with Spry validation, but the submit button needs some styling to make it look nice with the site. Since there are already styles ready for me to turn links into buttons I figured I'd use the same thing for my submit buttons.
To accomplish that, I'm using the following javascript...
<script type="text/javascript">
function submitForm() {
document.getElementById("form_name").submit();
</script>
And then I'm updating my submit button to something like this...
<a href='javascript: submitForm()' class='small-button smallblue'><span>Button Label</span></a>
When I do this, the form submits as expected, but the Spry validation doesn't work. Is there a way I can make the Spry stuff work with these types of buttons? I know I could create separate styles for the submit buttons themselves, or I could use an image type button, but I'd really like to figure out how to get these existing styles to work for me since the theme already has so many of them done for me.
Any information on this would be greatly appreciated. Thanks!Save yourself a lot of trouble and style the normal submit button as per
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<style>
.Standout {
font-family: Geneva, Arial, Helvetica, sans-serif;
text-transform: uppercase;
color: #FFFFFF;
font-size: 16px;
background-color: #CC0000;
font-weight: bold;
border-style: none;
padding-top: 6px;
padding-bottom: 5px;
padding-right: 64px;
padding-left: 64px;
letter-spacing: 1px;
.Standout:hover {
background-color: #000000;
</style>
</head>
<body>
<form action="" method="get" name="myform">
<span id="sprytextfield1">
<label for="text1"></label>
<input type="text" name="text1" id="text1">
<span class="textfieldRequiredMsg">A value is required.</span></span>
<input name="input" type="submit" class="Standout">
</form>
<script>
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]});
</script>
</body>
</html>
Gramps -
How to Use an Image to Customize the Static Button Widget
Can I just get someone to help me figure out how to use an image to customize the static button widget, please?
I have tried using several different types of images, but none of them seem to actually change the appearance of the button.
Thanks!
Laura
Captivate 5.5I tried to use the tools within the widget itself - it offers you the opportunity to use an image (see screenshot below).
I also opened it in Flash and tried to replace the images for one of the button styles there w/ my own, but in re-publishing the SWF from there I broke the widget. When I attempted to use the edited widget, there were no customization controls available after I inserted it (see screenshot two below). -
HI all,
I am working on a program that will print out my initials 'A' and 'T' using arrays. I am asked to initialize the first intial to '*' and the second intial to '@'. I wrote the code but the output is wrong. Can someone help me by letting me know what I am doing wrong in my arrray?I just get back my array of 30X30. I also wrote a driver but when I run the program, I really appreciate it so much.
public class Initial
private char whichinitial ;
private int MAX =30;//Maximum amount for 2-d Matrix
char[][] letterMatrix = new char[MAX][MAX];//2-d Array 30 x30
private boolean first = true;
public Initial()
{ //FIlls Array full of '*'s
whichinitial = '*';
for(int i=0;i< MAX;i++)
for(int j=0;i< MAX;i++)
letterMatrix[i][j] = whichinitial;
public void setLetter(char letter)
{//Setter for Letter
whichinitial = letter;
public char getLetter()
{//Getter for Letter
return whichinitial;
public void firstLetter()
{ //Creates an A shape
for(int i=0;i< MAX;i++)
for(int j=0;j< MAX;j++)
if((i>0)|| ((i<6) || ((j>0) && (j<29))))
letterMatrix[j] =whichinitial;
public void secondLetter()
{//Creates an T shape
first = false;
for(int i=0;i <MAX;i++)
for(int j=0;j <MAX;j++)
if((i>1) ||(j < 29)||(j>5)||(i>10))
letterMatrix[i][j] = whichinitial;
public void display()
{//Displays the Initials
if(first)
System.out.println("\n \n \n My First Initial," + whichinitial + ", follows:");
else
System.out.println("\n \n \n My Last Initial," + whichinitial + ", follows:");
for(int i=0;i <MAX;i++)
System.out.println();
for(int j=0;j <MAX;j++)
if(letterMatrix[i][j] == '*')
System.out.print(" ");
else
System.out.print(letterMatrix[i][j]);I am trying to write a program using a matrix. The size of the maxtrix should be 30X30. The first initial shoulld be initialized to '*' and the secind initial should be initialized to '@'. Both initials should be 30 characters high and 30 characters wide and the initials should also represent the uppercase letter of your initials. I know that the first initial's matrix needs to be filled up vertically and the second initial needs to be filled horizontally but the output is wrong....PLease Help!
Message was edited by:
apples03 -
Hi guys,
I'm developing an ADF application in JDev 11.1.1.6.0. I have problem about using arrays in jsp page. I have an iterator that brings me data from UCM. I just want to take every documents seperately and use in a Jquery division by division.
Can i have chance to use an array tag in that page? Or how can i make it possible my work in a different way?
Thank you so much,
ErdoHi Frank,
I've already use an iterator. I just want to take datas and after close the af:iterator tag. Then i will use those datas in a different block.
My code :
<af:iterator var="node" value="#{nodes}" id="i1">
<af:outputText value="#{node.propertyMap['CSGMNEWS_REGDEF:Desc'].asTextHtml}"
id="ot1"/>
</af:iterator>
I want to take all informations from node.PropertyMap[] and then i will set the values of outputText with those informations. I hope I'm clear.
Regards,
Erdo
Edited by: erdo on 20.Mar.2013 10:21 -
When using Firefox as my browser, my "back" button no longer works? And by the way...getting help is a real pain in the butt on this site!!!!!
see -- http://kb.mozillazine.org/Kill_application
which explains how to completely exit (quit) your Mozilla application
Try closing Firefox completely
*Close Firefox properly '''File > Exit''', not with the "X" which just closes the window.
*Use the Windows Task Manager "Processes" tab to make sure that firefox.exe is not running and also that the plugin-container.exe is not running.
If that does not work, try restarting the system.
If still no luck try restoring bookmarks from last backup, or better create your own .json backup and restore from that.
*http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox#Creating_bookmark_backups
*''If you had to go this far, please provide feedback if restoring bookmarks alone fixed the problem. I think I may have done that once with success, but never see that suggested -- I'd try most anything to not lose history or bookmarks. But then I could restore files from my profile and restore latest bookmarks backup from current profile.''
The following will result in complete loss of history if it comes down to deleting places.sqlite, so rename files rather than deleting. With Firefox down.
Of course you have backups of your profile you could replace rename and
replace those files instead.
Locked or damaged places.sqlite - MozillaZine Knowledge Base
:"Toolbar buttons such as Back/Forward are disabled "
:http://kb.mozillazine.org/Locked_or_damaged_places.sqlite
Maybe you are looking for
-
Nokia Email and vanity domain hotmail address
Hi, I just got the Nokia e71x. Setting up the email client from email.nokia.com. I tested it and got to work with my hotmail address, it's [email protected] But now I'm trying to get it set up for my other windows live mail, it's through my school bu
-
How to place a banner in a HTML page with alpha?
I have multiple ideas/designs which want to work into my new site. It utilises designing graphics in AE, exported as .swf that lay on an alpha, building them into my HTML page layout, and once there the alpha/space in the design will enable HTML back
-
Hi I bought pages after the free trial, it is on my desktop and I can use it, But cannot get rid of the trial version, it wants my serial number for pages which was lost in a confirmation email when my computers hard drive went down. Need the serial
-
Creating 2 same forms in different application raise error?
Hi all, I made a copy of a form in System Administrator -> Forms and the bad thing here is that they have the same name but different applications. After that in few minutes i couldn't log in the EBS. Is this the reason or something else? version: 11
-
Photoshop CS5 Crashes on Save/Save as/Save for web
Using win7 64bit, I7 950, ATI 6970, 12GB RAM Photoshop keeps crashing not in a continues way, it happen suddenly, not every time whe trying to save/save as/save for web. Tried reinstalling PS, didnt solve the issue, Tried reinstalling entire Adobe De