ERROR: int cannot be dereferenced
hi everyone i am trying to copmile the following code
public void refreshGUI() {
MessageBoardQueries MBQ = new MessageBoardQueries();
Date date = Calendar.getInstance().getTime();
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String argDate = df.format(date).toString();
int pNumber = MBQ.queryPending(argDate);
int aNumber = MBQ.queryAccepted(argDate);
int dNumber = MBQ.queryDeclined(argDate);
pendingNumberField.setText(pNumber.toString());
acceptedNumberField.setText(MBQ.queryAccepted(argDate));
declinedNumberField.setText(MBQ.queryDeclined(argDate));
}but i keep getting the error:
int cannot be dereferenced on the line
pendingNumberField.setText(pNumber.toString());
does anyone know why?
because int is a primitive datatype, hence doesn't inherit from java.lang.Object, and as such doesn't have a toString method
try Integer.toString(pNumber) or String.valueOf(pNumber). either is equally valid
Similar Messages
-
"int cannot be dereferenced" error.. help me please
I'm working with an array list class called PersonList and it uses attributes from a normal class called Person.
I would like to make this method PrintPerson inside the PersonList class that should search for a specific Person given the ID as parameter to the method. the method should print all info of the Person if found, otherwise a message saying id is not valid.
I solved it like this:
public void PrintPerson(int id)
System.out.println("Enter ID of the person ");
id = Stdin.readInteger();
//search the ID if it is in the List
int i=0;
while
((i<next)&&(!(list.getID().equals(id))))
i++;
//if found
if (i<next)
list[i].OutputWindow();}//display the object ouput of this ID
else{
System.out.println("The following ID: " id "is not valid!");
}//end if
}// end of method
my problem is with this code:
((i<next)&&(!(list.getID().equals(id))))
I get this error "int cannot be dereferenced"
what should I do? help me please
-- Mattlist.getID() == id
-
Error : char cannot be dereferenced
I wrote this program for my test in high school. I am getting 1 error and cannot fix it. can any1 please tell me how to fix this error. The following is the program and the rror message "-
I AM NEW HERE so i would really BENEFIT from ANY HELP !
class testing
static int[] search(char list[], char target) {
int brand[] = new int [list.length];
for (int i=0; i<list.length; i++) {
if (list[i] == target)
brand[i] = target.positionOf();
return brand;
} // end method
public static void main (String str[]) {
char list[] = {'M', 'B', 'A', 'J', 'P', 'J','M', 'J'};
char target = (str[0].charAt(0));
System.out.print ("The list = ");
for (int i =0; i<list.length; i++)
System.out.print(list[i] + ", ");
System.out.println();
System.out.println ("Target letter " + target + " has been found in position " + search(list,target) + ".");
} // end main
} // end class
Error :
C:\JPadPro\MyProjects\testing.java:14: char cannot be dereferenced
brand[i] = target.positionOf();
^
1 error
FinishedMy program question was --> Write a program to find a symbol from a list of symbols. Your search method should return all positions in which the target symbol is found.
According to your solution I changed to indexOf() but still i get the same error.
class testing
static int[] search(char list[], char target) {
int brand[] = new int [list.length];
for (int i=0; i<list.length; i++) {
if (list[i] == target)
brand[ i ] = (list[ i ].indexOf(target));
return brand;
} // end method
public static void main (String str[]) {
char list[] = {'M', 'B', 'A', 'J', 'P', 'J','M', 'J'};
char target = str[0].charAt(0);
System.out.print ("The list = ");
for (int i =0; i<list.length; i++)
System.out.print(list[i] + ", ");
System.out.println();
System.out.println ("Target letter " + target + " has been found in position " + search(list,target) + ".");
} // end main
} // end class
Error =
The current directory is: C:\JPadPro\MyProjects
C:\JPadPro\MyProjects\testing.java:14: char cannot be dereferenced
brand[i] = (list.indexOf(target));
^
1 error
Finished -
Program Error: Int cannot be derefereced
I am writing a program which displays a GUI for a chocolate chip cookies recipe. The user can key in the number of cookies they want, and the program will calculate and display the appropriate amount of ingredients required.
It is a program I have done myself in order to improve my skills.
There is an error in my code which I can't seem to get rid of. It says that "int cannot be derefereced" and it occurs on this line: String text = noOfCookies.getText();
I hope someone will be able to tell me what has gone wrong. Thanks for any help.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CookieGUI
private int WIDTH = 450;
private int HEIGHT = 600;
private JFrame frame;
private JPanel panel;
private JLabel inputLabel, outputLabel, outputLabel2, outputLabel3,
outputLabel4, outputLabel5, outputLabel6, outputLabel7, outputLabel8,
outputLabel9, outputLabel10, resultLabel, resultLabel2, resultLabel3,
resultLabel4, resultLabel5;
private JTextField noOfCookies;
//sets up the GUI
public CookieGUI()
frame = new JFrame("Choc Chip Cookie Recipe Creator.Version 1");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
inputLabel = new JLabel ("Enter the number of cookies required: ");
outputLabel = new JLabel ("Ingredients required: ");
outputLabel2 = new JLabel ("Sugar: ");
resultLabel = new JLabel ("---");
outputLabel3 = new JLabel ("Butter: ");
resultLabel2 = new JLabel ("---");
outputLabel4 = new JLabel ("Self Raising Flour: ");
resultLabel3 = new JLabel ("---");
outputLabel5 = new JLabel ("Egg: ");
resultLabel4 = new JLabel ("---");
outputLabel6 = new JLabel ("Chocolate Chips: ");
resultLabel5 = new JLabel ("---");
// Output labels for the steps go here:
outputLabel7 = new JLabel ("Step 1 : Mix sugar, butter and "
+ "self raising flour thoroughly.");
outputLabel8 = new JLabel ("Step 2 : Stir in egg, a few "
+ "drops of vanilla essence and chocolate chips.");
outputLabel9 = new JLabel ("Step 3 : Roll out mixture and "
+ "cut out cookies.");
outputLabel10 = new JLabel ("Step 4 : Bake in hot oven "
+ "(Gas Mark 6) for 10-12 minutes.");
panel = new JPanel();
panel.setPreferredSize (new Dimension(WIDTH, HEIGHT));
panel.setBackground (Color.cyan);
panel.add (inputLabel);
panel.add (noOfCookies);
panel.add (outputLabel);
panel.add (outputLabel2);
panel.add (outputLabel3);
panel.add (outputLabel4);
panel.add (outputLabel5);
panel.add (outputLabel6);
panel.add (outputLabel7);
panel.add (outputLabel8);
panel.add (outputLabel9);
panel.add (outputLabel10);
panel.add (resultLabel);
panel.add (resultLabel2);
panel.add (resultLabel3);
panel.add (resultLabel4);
panel.add (resultLabel5);
frame.getContentPane().add (panel);
public void display()
frame.pack();
frame.show();
//action listener
private class CookieListener implements ActionListener
public void actionPerformed (ActionEvent event)
double sugar, butter, selfRaisingFlour, egg, vanillaEssence,
chocolateChips;
int noOfCookies;
String text = noOfCookies.getText();
noOfCookies = Integer.parseInt (text);
sugar =(0.3334 * noOfCookies);
noOfCookies = Integer.parseInt (text);
butter = (0.3334 * noOfCookies);
noOfCookies = Integer.parseInt (text);
selfRaisingFlour = (0.6667 * noOfCookies);
noOfCookies = Integer.parseInt (text);
egg = (0.08334 * noOfCookies);
noOfCookies = Integer.parseInt (text);
chocolateChips = (0.3334 * noOfCookies);
//set all the result labels
resultLabel.setText (Double.toString (sugar));
resultLabel2.setText (Double.toString (butter));
resultLabel3.setText (Double.toString (selfRaisingFlour));
resultLabel4.setText (Double.toString (egg));
resultLabel5.setText (Double.toString (chocolateChips));
public class Cookie
//creates and displays the cookie recipe GUI
public static void main (String[] args)
CookieGUI chocchip = new CookieGUI();
chocchip.display();
}You dont have to instantiate it, just declaringit
is
enough..
I do believe that is false. It is assigned null if
you do not instantiate it. Meaning when youreference
it you will get a null pointer exception.Yes, that's true, but you'll still have these
shadowing problens in your code... The OP declared
(not instantiated) JTextField noOfCookies , then
declared int noOfCookies in a method. Referring to
'noOfCookies' within this method will refer to the
int.. This is true whether you instantiate the global
JTextField noOfCookies or just declare it.Right, but the lack of instantiation was pointed out as a possible solution to a second problem, once the program runs, it crashes and issues an error report. The suggestion was made to point out that the user should instantiate the noOfCookies JTextField before adding it to the GUI, and definitely before calling noOfCookies.getText(); (assuming the int was changed to another name, or she correctly referenced the textfield noOfCookies so as not to get the compile time error) -
This program show me "int cannot be dereferenced" as error can you help me?
public class Factorial{
public static void main (String [] args){
if (args.length<1){
showmsg("a Integer Please");
else if (args.length>1){
showmsg ("Only a Integer please");
else {
int n;
try {
n= Integer.parseInt(args[0]);
catch (NumberFormatException nfe){
showmsg ("a Integer not a String please"); //call to chow message method
factorial(n);
//show a message
private static void showmsg (String texto){
System.out.println(texto);
//factorial procedure
public static void factorial (int n){
int fac=1;
for (int i=1;i<=n;i++){
fac*=i;
String resu = fac.toString();
showmsg(resu);
}Thanks for your help, I did change other lines too... (if some body wish Run)
try {
int n;
n= Integer.parseInt(args[0]);
factorial(n);
catch (NumberFormatException nfe){
//call to show message method
showmsg ("a Integer not a String please");
showmsg (nfe.getMessage());
} -
Hello,
I hope this is an appropriate forum for this question. This is not a HW assignment; I have just started Java as a hobby. I think the real problem I have is a lack of sound understanding of how to call methods, and what criteria have to be met to call a method within the main().
Here is the code:
public class InconvenientChange3
public static int quarters;
public static int dimes;
public static int nickels;
public static int pennies;
public static int sum;
public static int sum()
sum = quarters + dimes + nickels + pennies;
public static void main(String[] args)
System.out.println();
int[] values = new int [100];
for (int amount = 1; amount < 100; amount ++)
quarters = amount/25;
int remainder = amount%25;
dimes = remainder/10;
remainder = remainder%10;
nickels = remainder/5;
pennies = remainder%5;
for (int amount = 1; amount < 100; amount ++ )
values[amount] = sum.values[amount];
System.out.println(values[amount]);
System.out.println();
The error I get is: int cannot be dereferenced values[amount] = sum.values[amount];
I have tried troubleshooting this for a while, but can't figure out this error. Thanks so much for your assistance.
- steveHello,
Thanks for your response. My intent is to apply the method "sum" (which adds the total number of quarters, dimes, nickels, and pennies) to the elements of the values[ ] array, thus creating a new array that holds the number of coins required for each value.
So the value at index 1 is 1 (1 penny)
The value at index 11 is 2 (1 dime, 1 penny)
The value at index 41 is 4 (1 quarter, 1 dime, 1 nickel, 1 penny)
etc.
I played with this a little, and successfully printed the sum for every value by including the statement:
sum = quarters + dimes + nickels + pennies wihin the first for loop. (So I know my math logic is correct). Now I want to assign these sums to a new array - that's my intent.
Thanks again for your help and patience.
Regards,
steve -
Hi,
I get the following compilation error message:
"float cannot be dereferenced"
and i don't know what it meens.
My code was compiling until i add the intValue methode in the last line.
Here is the part of code :
Dimension d,i;
d = getSize(); // i get the size of the frame
i = _imPanel.getSize(); // i get the size of an element in this frame
float hp = i.height/d.height; // i calculate a ratio between those 2 size
float wp = i.width/d.width; // for each dimansion
_imPanel.setPreferredSize(new Dimension((getWidth()*wp).intValue(),(getHeight()*hp).intValue()));
// and i apply a new dimension to the element int the frame using the ration and the new size of the frame.
As the ratio is a float and Dimension needs int in parameters, i decided to use the intValue methode to cast the float into int.
That's it.Hello,
Your problem is that you are trying to use a primitive type as if it were an object!
You cannot call methods on the primitive types (int, float, double, etc.). Therefore, your line should be converted from:
Dimension((getWidth()*wp).intValue(),(getHeight()*hp).ntValue()));to Dimension(new Float(getWidth()*wp).intValue(), new Float(getHeight()*hp).intValue()));Which could be done better by directly casting the values:
Dimension((int)(getWidth()*wp), (int)(getHeight()*hp));Manuel Amago. -
Error: boolean cannot be derefrenced. Help!
Error boolean cannot be derefrenced on the toString methods for:
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
if ((changeSupport != null) && (oldValue != newValue)) {
String oValue = (oldValue.toString());
String nValue = newValue.toString();
changeSupport.firePropertyChange(propertyName, Boolean.valueOf(oValue), Boolean.valueOf(nValue));
Any Ideas?byte, char, short, int, long, float, double and boolean are primitives.
They don't have any members (fields or methods) that you can access by dereferencing a reference variable using the dot notation.
If you want the String value of a boolean, there's probably a static method in Boolean, or you can use String.valueOf(bool). -
Error boolean cannot be derefrenced?
Error boolean cannot be derefrenced on the toString methods for:
public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
if ((changeSupport != null) && (oldValue != newValue)) {
String oValue = (oldValue.toString());
String nValue = newValue.toString();
changeSupport.firePropertyChange(propertyName, Boolean.valueOf(oValue), Boolean.valueOf(nValue));
If your wondering why i try to do it his way; For some strange reason the Boolean.valueOf(java.lang.boolean); method has been removed from Java.;ang.boolean in PP, so only Boolean.valueOf(java.lang.String) can be used.
Any Ideas?byte, char, short, int, long, float, double and boolean are primitives.
They don't have any members (fields or methods) that you can access by dereferencing a reference variable using the dot notation.
If you want the String value of a boolean, there's probably a static method in Boolean, or you can use String.valueOf(bool). -
Boolean cannot be dereferenced
Hi all any help would be great:
Im getting these errors:
KhanAccount.java:41: boolean cannot be dereferenced
for(int i = 0; i < passwd.length(); i++)
^
KhanAccount.java:42: boolean cannot be dereferenced
if (Character.isDigit(passwd.charAt(i)))
^
KhanAccount.java:45: boolean cannot be dereferenced
if (passwd.length() >= 6 && hasDigit)
^
3 errors
This is the code:
(main method)
import java.text.*;
import javax.swing.*;
public class KhanPassword
public static void main (String [] args)
KhanAccount oneacct = new KhanAccount ();
inputacct (oneacct);
System.exit(0);
public static KhanAccount inputacct (KhanAccount aacct)
/* If an invalid password is entered (or the two entries do not match),
the user should be prompted to try again. */
/* Continuously reads a pair of passwords until the two match.*/
do { // Continuously reads the password until it is a valid one.
do {
String password = JOptionPane.showInputDialog("Enter password:\n"
+ "(must be at least six characters long and have at least one digit)");
aacct.setusername(un);
/* display a message indicating whether it is valid or not */
if (!aacct.setPassword(passwd))
JOptionPane.showMessageDialog(null, "Invalid password!");
else {
JOptionPane.showMessageDialog(null, "Valid password!");
break;
while (true);
/* The password should be prompted for twice */
String reenter = JOptionPane.showInputDialog("Re-enter password:");
/* the entries should match or a message provided to the user. */
if (!passwd.equals(reenter))
JOptionPane.showMessageDialog(null, "Two passwords don't match!");
else
JOptionPane.showMessageDialog(null, "Two passwords match!");
} while (!passwd.equals(reenter));
return aacct;
(called method)
public class KhanAccount
public String username;
public boolean password;
public String reenter;
public boolean passwd;
public static void KhanAccount (){};
public String getusername()
return username;
public boolean getpassword()
return password;
public void setusername (String un)
username = un;
public boolean setPassword()
password = passwd;
/* check if contains digit*/
boolean hasDigit = false;
for(int i = 0; i < passwd.length(); i++)
if (Character.isDigit(passwd.charAt(i)))
hasDigit = true;
if (passwd.length() >= 6 && hasDigit)
password = passwd;
return true;
} else
return false;
}Btw, isn't better to initiate hasDigit to true and then when
a character is wrong set hasDigit = false and quit loop
with break or so?
And methods called set.. often returns nothing if they return
boolean they are often named with is... or so isPasswd
I've learned basic methods should be divided into three types:
constructors starts with make..
modifiers , set..
predicats , is..
//jF
/* check if contains digit*/
boolean hasDigit = false;
for(int i = 0; i < passwd.length(); i++)
if (Character.isDigit(passwd.charAt(i)))
hasDigit = true;
if (passwd.length() >= 6 && hasDigit)
password = passwd;
return true;
} else
return false;
} -
Getting error message Cannot Resolve Symbol when trying to compile a class
Hello All -
I am getting an error message cannot resolve symbol while trying to compile a java class that calls another java class in the same package. The called class compiles fine, but the calling class generates
the following error message:
D:\Apache Tomcat 4.0\webapps\examples\WEB-INF\classes\cal>javac
ConnectionPool.java
ConnectionPool.java:158: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
private void addConnection(PooledConnection value) {
^
ConnectionPool.java:144: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
PooledConnection pcon = new PooledConnection(con);
^
ConnectionPool.java:144: cannot resolve symbol
symbol : class PooledConnection
location: class cal.ConnectionPool
PooledConnection pcon = new PooledConnection(con);
The code is listed as follows for PooledConnection.java (it compiles fine)
package cal;
import java.sql.*;
public class PooledConnection {
// Real JDBC Connection
private Connection connection = null;
// boolean flag used to determine if connection is in use
private boolean inuse = false;
// Constructor that takes the passed in JDBC Connection
// and stores it in the connection attribute.
public PooledConnection(Connection value) {
if ( value != null ) {
connection = value;
// Returns a reference to the JDBC Connection
public Connection getConnection() {
// get the JDBC Connection
return connection;
// Set the status of the PooledConnection.
public void setInUse(boolean value) {
inuse = value;
// Returns the current status of the PooledConnection.
public boolean inUse() {
return inuse;
// Close the real JDBC Connection
public void close() {
try {
connection.close();
catch (SQLException sqle) {
System.err.println(sqle.getMessage());
Now the code for ConnectionPool.java class that gives the cannot
resolve symbol error
package cal;
import java.sql.*;
import java.util.*;
public class ConnectionPool {
// JDBC Driver Name
private String driver = null;
// URL of database
private String url = null;
// Initial number of connections.
private int size = 0;
// Username
private String username = new String("");
// Password
private String password = new String("");
// Vector of JDBC Connections
private Vector pool = null;
public ConnectionPool() {
// Set the value of the JDBC Driver
public void setDriver(String value) {
if ( value != null ) {
driver = value;
// Get the value of the JDBC Driver
public String getDriver() {
return driver;
// Set the URL Pointing to the Datasource
public void setURL(String value ) {
if ( value != null ) {
url = value;
// Get the URL Pointing to the Datasource
public String getURL() {
return url;
// Set the initial number of connections
public void setSize(int value) {
if ( value > 1 ) {
size = value;
// Get the initial number of connections
public int getSize() {
return size;
// Set the username
public void setUsername(String value) {
if ( value != null ) {
username = value;
// Get the username
public String getUserName() {
return username;
// Set the password
public void setPassword(String value) {
if ( value != null ) {
password = value;
// Get the password
public String getPassword() {
return password;
// Creates and returns a connection
private Connection createConnection() throws Exception {
Connection con = null;
// Create a Connection
con = DriverManager.getConnection(url,
username, password);
return con;
// Initialize the pool
public synchronized void initializePool() throws Exception {
// Check our initial values
if ( driver == null ) {
throw new Exception("No Driver Name Specified!");
if ( url == null ) {
throw new Exception("No URL Specified!");
if ( size < 1 ) {
throw new Exception("Pool size is less than 1!");
// Create the Connections
try {
// Load the Driver class file
Class.forName(driver);
// Create Connections based on the size member
for ( int x = 0; x < size; x++ ) {
Connection con = createConnection();
if ( con != null ) {
// Create a PooledConnection to encapsulate the
// real JDBC Connection
PooledConnection pcon = new PooledConnection(con);
// Add the Connection to the pool.
addConnection(pcon);
catch (Exception e) {
System.err.println(e.getMessage());
throw new Exception(e.getMessage());
// Adds the PooledConnection to the pool
private void addConnection(PooledConnection value) {
// If the pool is null, create a new vector
// with the initial size of "size"
if ( pool == null ) {
pool = new Vector(size);
// Add the PooledConnection Object to the vector
pool.addElement(value);
public synchronized void releaseConnection(Connection con) {
// find the PooledConnection Object
for ( int x = 0; x < pool.size(); x++ ) {
PooledConnection pcon =
(PooledConnection)pool.elementAt(x);
// Check for correct Connection
if ( pcon.getConnection() == con ) {
System.err.println("Releasing Connection " + x);
// Set its inuse attribute to false, which
// releases it for use
pcon.setInUse(false);
break;
// Find an available connection
public synchronized Connection getConnection()
throws Exception {
PooledConnection pcon = null;
// find a connection not in use
for ( int x = 0; x < pool.size(); x++ ) {
pcon = (PooledConnection)pool.elementAt(x);
// Check to see if the Connection is in use
if ( pcon.inUse() == false ) {
// Mark it as in use
pcon.setInUse(true);
// return the JDBC Connection stored in the
// PooledConnection object
return pcon.getConnection();
// Could not find a free connection,
// create and add a new one
try {
// Create a new JDBC Connection
Connection con = createConnection();
// Create a new PooledConnection, passing it the JDBC
// Connection
pcon = new PooledConnection(con);
// Mark the connection as in use
pcon.setInUse(true);
// Add the new PooledConnection object to the pool
pool.addElement(pcon);
catch (Exception e) {
System.err.println(e.getMessage());
throw new Exception(e.getMessage());
// return the new Connection
return pcon.getConnection();
// When shutting down the pool, you need to first empty it.
public synchronized void emptyPool() {
// Iterate over the entire pool closing the
// JDBC Connections.
for ( int x = 0; x < pool.size(); x++ ) {
System.err.println("Closing JDBC Connection " + x);
PooledConnection pcon =
(PooledConnection)pool.elementAt(x);
// If the PooledConnection is not in use, close it
if ( pcon.inUse() == false ) {
pcon.close();
else {
// If it is still in use, sleep for 30 seconds and
// force close.
try {
java.lang.Thread.sleep(30000);
pcon.close();
catch (InterruptedException ie) {
System.err.println(ie.getMessage());
I am using Sun JDK Version 1.3.0_02" and Apache/Tomcat 4.0. Both the calling and the called class are in the same directory.
Any help would be greatly appreciated.
tnx..
addiIs ConnectionPool in this "cal" package as well as PooledConnection? From the directory you are compiling from it appears that it is. If it is, then you are compiling it incorrectly. To compile ConnectionPool (and PooledConnection similarly), you must change the current directory to the one that contains cal and type
javac cal/ConnectionPool. -
Dear Sir,
I really need your valuable assistance i was about to finish a project but at very last moment i am stuck. Here is the explanation below...
I have two files called "holder.swf" and "slide.swf" i want to improt the "slide.swf" using this action below
var myLoader:Loader = new Loader();
var url:URLRequest = new URLRequest("slide.swf");
myLoader.load(url);
addChild(myLoader);
myLoader.x = 2;
myLoader.y = 2;
Also i have attached the flash file of "holder.swf". My concern is the moment i am calling the "slide.swf" inside the "holder.swf" it is showing the following error...
" TypeError: Error #1009: Cannot access a property or method of a null object reference.
at FC_Home_Ads_Holder_v2_fla::MainTimeline() "
Here are the files uploaded for your reference, please download this file http://www.touchpixl.com/ForumsAdobecom.zip
This error is being occured from "MainTimeline.as" file here is the code been use inside of this file below....
package FC_Home_Ads_Holder_v2_fla
import __AS3__.vec.*;
import adobe.utils.*;
import com.danehansen.*;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.accessibility.*;
import flash.desktop.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.globalization.*;
import flash.media.*;
import flash.net.*;
import flash.net.drm.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.sensors.*;
import flash.system.*;
import flash.text.*;
import flash.text.engine.*;
import flash.text.ime.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends flash.display.MovieClip
public function MainTimeline()
new Vector.<String>(6)[0] = "Productivity";
new Vector.<String>(6)[1] = "Leadership";
new Vector.<String>(6)[2] = "Execution";
new Vector.<String>(6)[3] = "Education";
new Vector.<String>(6)[4] = "Speed of Trust";
new Vector.<String>(6)[5] = "Sales";
super();
addFrameScript(0, this.frame1);
return;
public function init():void
var loc1:*=null;
com.greensock.plugins.TweenPlugin.activate([com.greensock.plugins.Aut oAlphaPlugin]);
loc1 = new flash.net.URLLoader(new flash.net.URLRequest(this.XML_LOC));
var loc2:*;
this.next_mc.buttonMode = loc2 = true;
this.prev_mc.buttonMode = loc2;
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
stage.align = flash.display.StageAlign.TOP_LEFT;
loc1.addEventListener(flash.events.Event.COMPLETE, this.xmlLoaded, false, 0, true);
this.prev_mc.addEventListener(flash.events.MouseEvent.CLICK, this.minusClick, false, 0, true);
this.next_mc.addEventListener(flash.events.MouseEvent.CLICK, this.plusClick, false, 0, true);
return;
public function xmlLoaded(arg1:flash.events.Event):void
var loc1:*=null;
var loc2:*=0;
this.xmlData = new XML(arg1.target.data);
loc2 = 0;
while (loc2 < this.LABELS.length)
loc1 = new Btn(this.LABELS[loc2], loc2);
this.btnHolder_mc.addChild(loc1);
this.BTNS.push(loc1);
trace(this.LABELS[loc2]);
++loc2;
this.current = uint(this.xmlData.@firstPick);
trace("-----width-----");
trace(this.contentMask.width);
var loc3:*=this.contentMask.width / this.LABELS.length;
trace(loc3);
loc2 = 0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].width = loc3;
this.BTNS[loc2].x = loc3 * loc2;
++loc2;
this.btnHolder_mc.addEventListener(flash.events.MouseEvent.CLICK, this.numClick, false, 0, true);
this.selectMovie();
return;
public function numClick(arg1:flash.events.MouseEvent):void
this.killTimer();
this.current = arg1.target.i;
this.selectMovie();
return;
public function killTimer():void
this.timerGoing = false;
if (this.timer)
this.timer.reset();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
this.timer = null;
return;
public function selectMovie():void
if (this.timerGoing)
this.timer = new flash.utils.Timer(uint(this.xmlData.ad[com.danehansen.MyMath.modulo(t his.current, this.xmlData.ad.length())].@delay), 1);
this.timer.start();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
while (this.holder_mc.numChildren > 0)
this.holder_mc.removeChild(this.holder_mc.getChildAt(0));
var loc1:*=new flash.display.Loader();
loc1.load(new flash.net.URLRequest(this.xmlData.ad[com.danehansen.MyMath.modulo(thi s.current, this.xmlData.ad.length())].@loc));
this.holder_mc.addChild(loc1);
var loc2:*=0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].deselect();
++loc2;
this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].select();
var loc3:*=this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].x + this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].width / 2 + this.btnHolder_mc.x;
trace("addLength:" + this.xmlData.ad.length());
trace(loc3, com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length()));
com.greensock.TweenLite.to(this.indicator_mc, 0.3, {"x":loc3, "ease":com.greensock.easing.Cubic.easeOut});
loc1.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, this.adLoaded, false, 0, true);
return;
public function adLoaded(arg1:flash.events.Event):void
var evt:flash.events.Event;
var loc1:*;
evt = arg1;
try
evt.target.content.xmlData = this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())];
catch (er:Error)
return;
public function minusClick(arg1:flash.events.MouseEvent):void
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current - 1);
loc1.current = loc2;
this.selectMovie();
return;
public function plusClick(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function ENDED(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function STARTED(arg1:flash.events.Event):void
this.killTimer();
return;
function frame1():*
this.timerGoing = true;
addEventListener("endNow", this.ENDED, false, 0, true);
addEventListener("startNow", this.STARTED, false, 0, true);
this.init();
return;
public const XML_LOC:String=stage.loaderInfo.parameters.xmlLoc ? stage.loaderInfo.parameters.xmlLoc : "home_ads.xml";
public const LABELS:__AS3__.vec.Vector.<String>=new Vector.<String>(6);
public const BTNS:__AS3__.vec.Vector.<Btn>=new Vector.<Btn>();
public const TRANSITION_TIME:Number=0.2;
public var contentMask:flash.display.MovieClip;
public var btnHolder_mc:flash.display.MovieClip;
public var holder_mc:flash.display.MovieClip;
public var indicator_mc:flash.display.MovieClip;
public var prev_mc:flash.display.MovieClip;
public var next_mc:flash.display.MovieClip;
public var current:int;
public var xmlData:XML;
public var timer:flash.utils.Timer;
public var timerGoing:Boolean;
Here is the folder uploaded on the server for you to get clear picture, please click on this link to download the entire folder. http://www.touchpixl.com/ForumsAdobecom.zip
I am not being able to resolve the issue, it needs a master to get the proper solution. I would request you to help me.
Thanks & Regards
Sanjib DasHere is the entire code of MainTimeline.as below, please correct it.
package FC_Home_Ads_Holder_v2_fla
import __AS3__.vec.*;
import adobe.utils.*;
import com.danehansen.*;
import com.greensock.*;
import com.greensock.easing.*;
import com.greensock.plugins.*;
import flash.accessibility.*;
import flash.desktop.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.globalization.*;
import flash.media.*;
import flash.net.*;
import flash.net.drm.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.sensors.*;
import flash.system.*;
import flash.text.*;
import flash.text.engine.*;
import flash.text.ime.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends flash.display.MovieClip
public function MainTimeline()
new Vector.<String>(6)[0] = "Productivity";
new Vector.<String>(6)[1] = "Leadership";
new Vector.<String>(6)[2] = "Execution";
new Vector.<String>(6)[3] = "Education";
new Vector.<String>(6)[4] = "Speed of Trust";
new Vector.<String>(6)[5] = "Sales";
super();
addFrameScript(0, this.frame1);
return;
public function init():void
var loc1:*=null;
com.greensock.plugins.TweenPlugin.activate([com.greensock.plugins.AutoAlphaPlugin]);
loc1 = new flash.net.URLLoader(new flash.net.URLRequest(this.XML_LOC));
var loc2:*;
this.next_mc.buttonMode = loc2 = true;
this.prev_mc.buttonMode = loc2 = true;
stage.scaleMode = flash.display.StageScaleMode.NO_SCALE;
stage.align = flash.display.StageAlign.TOP_LEFT;
loc1.addEventListener(flash.events.Event.COMPLETE, this.xmlLoaded, false, 0, true);
this.prev_mc.addEventListener(flash.events.MouseEvent.CLICK, this.minusClick, false, 0, true);
this.next_mc.addEventListener(flash.events.MouseEvent.CLICK, this.plusClick, false, 0, true);
return;
public function xmlLoaded(arg1:flash.events.Event):void
var loc1:*=null;
var loc2:*=0;
this.xmlData = new XML(arg1.target.data);
loc2 = 0;
while (loc2 < this.LABELS.length)
loc1 = new Btn(this.LABELS[loc2], loc2);
this.btnHolder_mc.addChild(loc1);
this.BTNS.push(loc1);
trace(this.LABELS[loc2]);
++loc2;
this.current = uint(this.xmlData.@firstPick);
trace("-----width-----");
trace(this.contentMask.width);
var loc3:*=this.contentMask.width / this.LABELS.length;
trace(loc3);
loc2 = 0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].width = loc3;
this.BTNS[loc2].x = loc3 * loc2;
++loc2;
this.btnHolder_mc.addEventListener(flash.events.MouseEvent.CLICK, this.numClick, false, 0, true);
this.selectMovie();
return;
public function numClick(arg1:flash.events.MouseEvent):void
this.killTimer();
this.current = arg1.target.i;
this.selectMovie();
return;
public function killTimer():void
this.timerGoing = false;
if (this.timer)
this.timer.reset();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
this.timer = null;
return;
public function selectMovie():void
if (this.timerGoing)
this.timer = new flash.utils.Timer(uint(this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].@delay), 1);
this.timer.start();
this.timer.addEventListener(flash.events.TimerEvent.TIMER, this.plusClick, false, 0, true);
while (this.holder_mc.numChildren > 0)
this.holder_mc.removeChild(this.holder_mc.getChildAt(0));
var loc1:*=new flash.display.Loader();
loc1.load(new flash.net.URLRequest(this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].@loc));
this.holder_mc.addChild(loc1);
var loc2:*=0;
while (loc2 < this.BTNS.length)
this.BTNS[loc2].deselect();
++loc2;
this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].select();
var loc3:*=this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].x + this.BTNS[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())].width / 2 + this.btnHolder_mc.x;
trace("addLength:" + this.xmlData.ad.length());
trace(loc3, com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length()));
com.greensock.TweenLite.to(this.indicator_mc, 0.3, {"x":loc3, "ease":com.greensock.easing.Cubic.easeOut});
loc1.contentLoaderInfo.addEventListener(flash.events.Event.COMPLETE, this.adLoaded, false, 0, true);
return;
public function adLoaded(arg1:flash.events.Event):void
var evt:flash.events.Event;
var loc1:*;
evt = arg1;
try
evt.target.content.xmlData = this.xmlData.ad[com.danehansen.MyMath.modulo(this.current, this.xmlData.ad.length())];
catch (er:Error)
return;
public function minusClick(arg1:flash.events.MouseEvent):void
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current - 1);
loc1.current = loc2;
this.selectMovie();
return;
public function plusClick(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function ENDED(arg1:flash.events.Event):void
if (arg1.type != "timer")
this.killTimer();
var loc1:*;
var loc2:*=((loc1 = this).current + 1);
loc1.current = loc2;
this.selectMovie();
trace("next");
return;
public function STARTED(arg1:flash.events.Event):void
this.killTimer();
return;
function frame1():*
this.timerGoing = true;
addEventListener("endNow", this.ENDED, false, 0, true);
addEventListener("startNow", this.STARTED, false, 0, true);
this.init();
return;
public const XML_LOC:String=stage.loaderInfo.parameters.xmlLoc ? stage.loaderInfo.parameters.xmlLoc : "home_ads.xml";
public const LABELS:__AS3__.vec.Vector.<String>=new Vector.<String>(6);
public const BTNS:__AS3__.vec.Vector.<Btn>=new Vector.<Btn>();
public const TRANSITION_TIME:Number=0.2;
public var contentMask:flash.display.MovieClip;
public var btnHolder_mc:flash.display.MovieClip;
public var holder_mc:flash.display.MovieClip;
public var indicator_mc:flash.display.MovieClip;
public var prev_mc:flash.display.MovieClip;
public var next_mc:flash.display.MovieClip;
public var current:int;
public var xmlData:XML;
public var timer:flash.utils.Timer;
public var timerGoing:Boolean; -
I am having a application in Visual Studio 2003 on Windows XP , Now I am Migrating the application in Visual Studio 2005 on Windows-7 .
In my Development PC , I was install Measurement Studio 2009 , NI DAQ 7.01 and Field Point 6.05.
my application is Showing following error:
Linking...
LINK : fatal error LNK1104: cannot open file 'NiFieldPoint71D.lib'
Build log was saved at "file://c:\EdacsNt\Source\SaftyServices\NICfpDAQDl?l\Debug\BuildLog.htm"
NICfpDAQDll - 1 error(s), 0 warning(s)
When I copy from NiFieldPoint71D.lib library from Measurement Studio 7.1 and put in :\Program Files\National Instruments\MeasurementStudioVS2005\VCNET\Lib.
my application is Showing following error:
1>Linking...
1>atlsd.lib(atltrace.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in NiFieldPoint71D.lib(StdAfx.obj)
1>atlsd.lib(atlbase.obj) : error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) already defined in NiFieldPoint71D.lib(StdAfx.obj)
1> Creating library ..\..\lib\debug\NICfpDAQDll.lib and object ..\..\lib\debug\NICfpDAQDll.exp
1>..\..\bin\debug\NICfpDAQDll.dll : fatal error LNK1169: one or more multiply defined symbols found
I want to ignore NiFieldPoint71D.lib from using project setting(Linker->Input->ignore Specific Library ) but still it is showing same error.
In the project Setting I am done following setting:
"C:\Program Files\National Instruments\MeasurementStudioVS2005\VCNET\Lib";"
C:\Program Files\National Instruments\NI-DAQ\Lib"
Linker->Input->ignore Specific Library: mfcs71d.lib;libc.lib;'NiFieldPoint71D.lib
Please provide some solution.
Thanks
NityanandYou posted this in the LabVIEW forum.
Are you programming in LabVIEW?
There is a separate Measurement Studio for VC++ forum. http://forums.ni.com/t5/Measurement-Studio-for-VC/bd-p/231 -
ReferenceError: Error #1056: Cannot create property
Hello,
I have been playing around with passing objects between Flex and BlazeDS.
I have a Java VO:
package vo;
import java.util.Date;
import java.util.Set;
public class TestVO
private long aInt;
private double aDouble;
private boolean aBool;
private Date aDate;
private String aString;
private Set aSet;
public void setAInt(long aInt)
this.aInt = aInt;
public long getAInt()
return aInt;
public void setADouble(double aDouble)
this.aDouble = aDouble;
public double getADouble()
return aDouble;
public void setABool(boolean aBool)
this.aBool = aBool;
public boolean isABool()
return aBool;
public void setADate(Date aDate)
this.aDate = aDate;
public Date getADate()
return aDate;
public void setAString(String aString)
this.aString = aString;
public String getAString()
return aString;
public void setASet(Set aSet)
this.aSet = aSet;
public Set getASet()
return aSet;
and the corresponding ActionScript VO:
package vo
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="vo.TestVO")]
public class TestVO
public var aInt : int;
public var aDouble : Number;
public var aBool : Boolean;
public var aDate: Date;
public var aString : String ;
public var aSet : ArrayCollection = new ArrayCollection();
When passing an instantiated object back from java I get these errors in the console:
ReferenceError: Error #1056: Cannot create property AString on vo.TestVO.
ReferenceError: Error #1056: Cannot create property AInt on vo.TestVO.
ReferenceError: Error #1056: Cannot create property ASet on vo.TestVO.
ReferenceError: Error #1056: Cannot create property ADouble on vo.TestVO.
ReferenceError: Error #1056: Cannot create property ABool on vo.TestVO.
ReferenceError: Error #1056: Cannot create property ADate on vo.TestVO.
If I change my ActionScript VO to the following it works:
package vo
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="vo.TestVO")]
public class TestVO
public var AInt : int;
public var ADouble : Number;
public var ABool : Boolean;
public var ADate: Date;
public var AString : String ;
public var ASet : ArrayCollection = new ArrayCollection();
I dont particulary want to use this naming convention for my variables. Making the Java variables public also works but I dont want to do this either?
Is there anything I can do or is this the way it is?
CheersHey try this in your actionscript code
package vo
import mx.collections.ArrayCollection;
[Bindable]
[RemoteClass(alias="vo.TestVO")]
public class TestVO
private var _aInt:int;
private var _aDouble:Number;
private var _aBool:Boolean;
private var _aDate:Date;
private var _aString:String;
private var _aSet:ArrayCollection = new ArrayCollection();
public function get aInt():int{return _aInt;}
public function set aInt(aInt:int):void
this._aInt = aInt;
public function get aDouble():Number{
return _aDouble;
public function set aDouble(aDouble:Number):void{
this._aDouble = aDouble;
public function get aDate():Date{return this._aDate;}
public function set aDate(aDate:Date):void{
this._aDate = aDate;
public function get aString():String{return this._aString;}
public function set aString(aString:String):void{
this._aString = aString;
public function get aSet():ArrayCollection{return this._aSet;}
public function set aSet(aSet:ArrayCollection):void{
this._aSet = aSet;
---That should work cos I had the same problem today and that was how I solved it.
--Patrick -
ReferenceError: Error #1056: Cannot create property 0 on Number.
Hi, I have an AS3 script that calls an XML but when compiling I get this error
ReferenceError: Error #1056: Cannot create property 0 on Number.
at mod::ML/parseData()
at mng::DM/onXMLLoaded()
Here are some snippets
the first script that defines the XML
private function addedToStageHandler(event:Event = null) : void
var _loc_2:* = Application.getInstance();
Application.xmlPath = "xml/soc.xml";
_loc_2.initialize(this);
return;
here is the ML one
public class Model extends EventDispatcher implements IModel
public var social:Social;
public function Model()
return;
public function parseSocialData(param1:XML) : void
this.social = new Social(param1);
this.socialSection.social = this.social;
return;
public function getSectionData(param1:String) : Absec
var _loc_2:Absec = null;
switch(param1)
case "SocialSection":
_loc_2 = this.socialSection;
break;
return _loc_2;
public function parseData(param1:XML) : void
this.socialSection = new SocialSection(XML(_loc_3));
var _loc_4:int = 0;
var _loc_5:* = xml.sections.section;
var _loc_3:* = new XMLList("");
for each (_loc_6 in _loc_5)
var _loc_7:* = _loc_5[_loc_4];
with (_loc_5[_loc_4])
if (@id == "SocialSection")
_loc_3[_loc_4] = _loc_6;
here is the DM one
private function onXMLLoaded(event:Event) : void
var _loc_2:* = new XML(event.target.data);
this.model.parseData(_loc_2);
dispatchEvent(new Event(XML_LOADED));
return;
and the XML
<section id="SocialSection" active="true" visible="true" default="false">
<name><![CDATA[<font size="50">SOCIAL</font>]]></name>
<title><![CDATA[<font size="25">SOCIAL</font>]]></title>
<forums>
<line1><![CDATA[<font size="10">POST ON THE</font>]]></line1>
<line2><![CDATA[<font size="18">FORUMS</font>]]></line2>
<rollover><![CDATA[<font size="10">Have questions? Click here.</font>]]></rollover>
<url>link_to_forum</url>
</forums>
</section>
I think the issue is _loc_4 but not sure how to fix this. Thanks!Hi, thanks for your reply. I did as you suggested and the error is here for ML
_loc_3[_loc_4] = _loc_6;
and here for DM
this.model.parseData(_loc_2);
And it's more cryptic than before : ). I think the DM error is predictable because of the first one
The complete error list is
ReferenceError: Error #1056: Cannot create property 0 on Number.
at mod::ML/parseData()
at mng::DM/onXMLLoaded()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
again, I think everything starts with ML script error
Thanks!
Maybe you are looking for
-
How can I arrange my Playlists in Order in the sidebar?
I'm trying to arrange my Smart Playlists in alphabetical order in the sidebar. However, When I click and drag, the order of the playlists don't re-arrange themselves. Any ideas how to do this? Thanks!
-
Cannot Connect to Oracle, PHP cannot load oci dlls
Hello, I have installed wamp on windows server, and oracle 9, When I try to connect to oracle in php I get: Fatal error: Call to undefined function oci_connect() in C:\wamp\www\project2\index.php on line 3 Also when I start wamp, it cannot load the o
-
MISALIGNMENT PROBLEMS USING "LOAD FILES INTO PHOTOSHOP LAYERS" FROM BRIDGE CC
I'm having a persistent problem which technical support was unable to resolve after being on the phone with them for 1.5 hrs. I was told the issue would be escalated... That was five days ago, and I've heard nothing. Here is the problem: In ACR worki
-
How to get data from another view on the RFx to populate bidders web dynpro
i am trying to populate bidders in the table on the bidder tab when a user click a button based on the line item data. How do i have access to get the line item since it is in a separate component controller and view for the RFx? thanks you.
-
X230: what is expected temperature during heavy CPU load?
Hello all, after few seconds of heavy CPU usage on my x230 termal sensors show temperature slightly above 100 degrees celsius. I think it's way to high and probably should call the service to replace the fan, clean the heatsink etc, but wanted to mak