Student Project - Need Help With ViewPlatform Rotation
Hello folks,
I'm a student in Strathclyde University, Glasgow, and I'm currently doing a small project for one of my programming classes. I'm doing a 3D knots and crosses game but I'm having tremendous difficulty getting the rotation to work just the way I want it to. Let me decribe what I need.
Visualise 27 cubes, arranged in a 3 x 3 x 3 structure, space out slightly: a 3D knots and crosses setup. I'm trying to get the ViewPlatform to rotate around the central cube in a spherical fashion.
I also need this rotation to use the keyboard arrow keys, not the mouse because I am reserving the mouse for interaction using the PickMouseBehavior class as stated in my project specification.
I have looked up various classes in the API: such as KeyNavigator, OrbitBehavior, and some VisAd class that isn't included with the Java3D API nor is it on the systems I have available at the university.
The trouble is, all these classes that I have found do not rotate the way I need them to: as described above. They "turn left" and "turn right" the camera as opposed to "rotate left around" and "rotate right around" the central cube (i.e horizontal rotation of the camera on a wide circle around an object).
They also "move forward" and "move backward" as opposed to "rise up around" and "drop down around" the central cube (i.e. vertical rotation on a wide circle around an object).
I have previously tackled this problem by creating a dummy cube under the central cube using then attaching the "camera" to the dummy cube in the DarkBASIC programming language and wonder if this method is available using Java.
I've thought about defining my own arrow key rotation class, but I have little idea how to go about doing that either.
An additional bonus would be the ability to limit vertical rotation so as not to go over and upside-down the vertical limit.
Any help would be appreciated.
I appreciate the answer and I know about implementing a Behavior to do this particular function of the program: is this what you are suggesting?
If so, could you provide some clarity onto how go about implementing a Behavior to do the type of rotations I stated in my first post? By clarity I mean a little bit more about the recipe for creating a Behavior: the API is lacking documentation on this I think.
I'll go do a bit of reading on it and tell you where I get. Nonetheless, any further advice would be much appreciated.
Similar Messages
-
I'm trying to help a friend with the Flash Banner Rotator
She needs to make the image clickable and pop up the scroll text box item exactly like when you rollOver the title and the scroll text box pops up.
She wants the image to trigger the text box to open and close onRelease and onRollOut from the image.
Here's the swf live:
http://bgehome.com/index3.php
Any help would be great
This AS opens the Text Box
textMc.scrolltxt.bg.onRollOver = function(){ // pop up scrolltxt
mainContent["tex" + newPos]._y = thumbHeight - textMc.scrolltxt.bg._height;
isReading = true;
textMc.scrolltxt.bg.onRollOut = textMc.scrolltxt.bg.onReleaseOutside = function(){ // pop down scrolltxt
if(!mainContent["tex" + newPos].scrolltxt.bg.hitTest(_root._xmouse, _root._ymouse, true)){
mainContent["tex" + newPos]._y = thumbHeight - textMc.imtext._height;
isReading = false;
Full AS
thumb.useHandCursor=false;
// Thumb/ Banner Rotator //
///Initialisation //
var bgmask:MovieClip = bckgrnd.duplicateMovieClip("bgmask"); // Create a mask to place on top of mainContent, which contains the images
var contentWidth:Number = bgmask._width;
bgmask._width = contentWidth;
var XMLContent = new XML(); // Create a new XML object
XMLContent.ignoreWhite = true;
XMLContent.load("Banner.xml"); // Load the XML content from Banner.xml (which is the name of the xml file) in XMLContent variable
//XMLContent.load("Thumbnail.xml");
var cssStyle = new TextField.StyleSheet(); // Create a new StyleSheet object
// Create Containers
var mainContent:MovieClip = this.createEmptyMovieClip("mainContent",this.getNextHighestDepth()); // Contains thumbs
leftBtn.swapDepths(mainContent); // Make sure leftBtn ...
rightBtn.swapDepths(leftBtn.getDepth + 1); // and rightBtn is on top of the mainContent
var pieMc:MovieClip = this.createEmptyMovieClip("pie", this.getNextHighestDepth()); // Create movieClip which contains the pieLoader
var format = new TextFormat(); // Make a new TextFormat
format.font = "arial"; // with font PF Ronda Seven, if you want to change the font, do it here
format.size = 18; // Font size, for pixel fonts use 8
var mclListener:Object = new Object(); // Make event listener object
var clipLoader = new MovieClipLoader(); // Make a MovieCLipLoader to load the images
clipLoader.addListener(mclListener); // The event listener is added to the MovieClipLoader object
var iniNum:Number = 0; // initional relative number for thumb/banner positioning
var thumbHeight:Number; // see xml document
var thumbWidth:Number; // see xml document
var thumbSpace:Number; // see xml document
var contentPos_Y:Number; // see xml document
var thumbDir:String; // see xml document
var dispThumbNumber:Number; // see xml document
var linkDestiny:String; // see xml document
var shiftTime:Number; // see xml document
var fadeInTime:Number; // see xml document
var easeSpeed:Number; // see xml document
var imagesTotal:Number; // amount of thumbs
var dwLoader:Number = 0; // pie segment angle
var arcVal:Number = 0; // total pie angle
var isReading:Boolean = false; // boolean: set true when reading. When true the pieLoader will stop
var prevXPosition:Number = 0; // previous absolute x position
var nextXPosition:Number = 0; // next absolute x position
var images; // image array
// XML, CSS Loading //
cssStyle.load("ThumbBannerRotator.css");
XMLContent.onLoad = function() { // Couple xml parameters with program variables
iniNum = 0;
nextXPosition = 0;
prevXPosition = 0;
dwLoader = 0;
arcVal = 0;
// images = array with images and titles and webUrls
images = XMLContent.firstChild.childNodes[0].childNodes;
imagesTotal = images.length;
// Other parameters
thumbHeight = XMLContent.firstChild.attributes.thumbHeight;
thumbWidth = XMLContent.firstChild.attributes.thumbWidth;
startPos = XMLContent.firstChild.attributes.startPos;
easeSpeed = XMLContent.firstChild.attributes.easeSpeed;
linkDestiny = XMLContent.firstChild.attributes.linkDestiny;
thumbDir = XMLContent.firstChild.attributes.thumbDir;
dispThumbNumber = XMLContent.firstChild.attributes.dispThumbNumber;
shiftTime = XMLContent.firstChild.attributes.shiftTime;
fadeInTime = XMLContent.firstChild.attributes.fadeInTime;
// Calculate the other program variables
contentPos_Y = (bckgrnd._height - Number(thumbHeight))/2
thumbSpace = (contentWidth - dispThumbNumber*thumbWidth)/(Number(dispThumbNumber) +1);
dwLoader = 100 * 3.6 / (Number(shiftTime) * 24);
mainContent._y = contentPos_Y; // Position form top
bgmask._height = thumbHeight;
bgmask._y = contentPos_Y;
mainContent.setMask(bgmask);
// Load the first images
for(var i = 0; i < dispThumbNumber ; i++){
loadImage(i,0,"load");
loadText(i,0,"load");
function shiftPic(direction:String){
if (isReading == false){
callPic(direction);
function callPic(direction:String) { // Call images, captions and titles and add them to containers: mainContent
if(direction == "left"){
var newPos:Number = (iniNum -1) % imagesTotal; // Calculate the relative position off the new image, this number corresponds with the index number from the image-array
var remPos:Number = (iniNum+( Number(dispThumbNumber) - 1)) % imagesTotal; // Calculate the relative position off the image that needs to be removed
var prevPos:Number = iniNum % imagesTotal; // Calculate the relative position off the images before the new image
nextXPosition = prevXPosition + Number(thumbSpace) + Number(thumbWidth); // Calculate the absolute x position = previous position + thumbSpace and thumbWidth, used in ease function
prevXPosition = nextXPosition; // Update prevPosition
iniNum = iniNum - 1; // Substract the iniNumber
if(direction == "right"){
var remPos:Number = iniNum % imagesTotal; // Calculate the relative position off the new image, this number corresponds with the index number from the image-array
var newPos:Number = (iniNum+ Number(dispThumbNumber)) % imagesTotal; // Calculate the relative position off the image that needs to be removed
var prevPos:Number = (iniNum+(Number(dispThumbNumber) - 1)) % imagesTotal; // Calculate the relative position off the images before the new image
nextXPosition = prevXPosition - Number(thumbSpace) - Number(thumbWidth); // Calculate the absolute x position = previous position + thumbSpace and thumbWidth
prevXPosition = nextXPosition; // Update prevPosition
iniNum = iniNum + 1;
if (newPos < 0){ //If newPos is negative, make it positive
newPos = imagesTotal + newPos;
if (remPos < 0){ //If remPos is negative, make it positive
remPos = imagesTotal + remPos;
if (prevPos < 0){ //If prevPos is negative, make it positive
prevPos = imagesTotal + prevPos;
loadImage(newPos, prevPos, direction); // Load images and image titles
loadText(newPos, prevPos , direction); // Load titles and caption
mainContent[remPos].removeMovieClip(); // remove the image with name "remPos"
mainContent["tex" + remPos].removeMovieClip(); // remove the text with name tex"remPos"
arcVal = 0; // reset the pieLoader
function loadImage(newPos:Number, prevPos:Number, direction:String){
thumbURL = images[newPos].attributes.thumbPath; // Get thumbUrl from images-array
thumbMc = mainContent.createEmptyMovieClip(""+newPos, mainContent.getNextHighestDepth()); // Create new thumbMc movieClip variable
thumbMc._alpha = 0; // Alpha = zero for fade in effect
if (direction == "left"){
thumbMc._x = mainContent[prevPos]._x - Number(thumbWidth) - Number(thumbSpace); // positioning of thumbMc
if (direction == "right"){
thumbMc._x = mainContent[prevPos]._x + Number(thumbWidth) + Number(thumbSpace); // positioning of thumbMc
if(direction == "load"){
thumbMc._x = Number(thumbWidth*newPos) + Number(thumbSpace*(newPos+1)) ; // positioning of thumbMc
addLoader(thumbMc);
clipLoader.loadClip(thumbDir+thumbURL, thumbMc); // Load the images in the thumbMc
function loadText(newPos:Number, prevPos:Number, direction:String){
thumbTitle = images[newPos].attributes.title; // Get title from images-array
thumbDesc = images[newPos].attributes.description; // Get caption description from images-array
textMc = mainContent.createEmptyMovieClip("tex"+newPos, mainContent.getNextHighestDepth()); // Create new titleMc moveClip variable
if (direction == "left"){
textMc._x = mainContent[prevPos]._x - Number(thumbWidth) - Number(thumbSpace); // positioning of textMc
if (direction == "right"){
textMc._x = mainContent[prevPos]._x + Number(thumbWidth) + Number(thumbSpace); // positioning of textMc
if(direction == "load"){
textMc._x = Number(thumbWidth*newPos) + Number(thumbSpace*(newPos+1)) ; // positioning of textMc
textMc.attachMovie("scrollText" , "scrolltxt", textMc.getNextHighestDepth());
textMc.scrolltxt.bg._width = Number(thumbWidth); // set background width
textMc.scrolltxt.main.content.styleSheet = cssStyle; // set css style
textMc.scrolltxt.main.content._width = Number(thumbWidth) - 30; // set scrolltext components width
textMc.scrolltxt.maskMc._width = Number(thumbWidth) - 10; // set scrolltext components width
textMc.scrolltxt.dragger._x = textMc.scrolltxt.bar._x = textMc.scrolltxt.upBtn._x = textMc.scrolltxt.downBtn._x = textMc.scrolltxt.stripe._x = Number(thumbWidth) - 10; // positioning of scrolltext components
textMc.scrolltxt.main.content.text = thumbDesc; // set text
textMc.scrolltxt.main.content.embedFonts = true;
textMc.scrolltxt.main.content.selectable = false;
textMc.scrolltxt.main.content.setTextFormat(format); // set text format
textMc.scrolltxt.main.content._height = textMc.scrolltxt.main.content.textHeight + 5; // calculate height of text
textMc.createTextField("imtext",1,0,0,thumbWidth,48); // Create a textfield in the titleMc for the image title
textMc.imtext.embedFonts = true;
textMc.imtext.text = thumbTitle; // Add text
textMc.imtext.selectable = false;
textMc.imtext.textColor = 0xaddf99; // Set textColor to pink
textMc.imtext.setTextFormat(format); // set text format
textMc.imtext._x = Math.round((thumbWidth - textMc.imtext.textWidth)/2);
textMc._y = thumbHeight - textMc.imtext._height;
textMc.attachMovie("arrow", "arrowMc", textMc.getNextHighestDepth()); // add arrow
textMc.arrowMc._x = Number(thumbWidth) - textMc.arrowMc._width;
textMc.arrowMc._y = Number(textMc.arrowMc._height);
textMc.arrowMc._alpha = 0;
textMc.scrolltxt.bg.onRollOver = function(){ // pop up scrolltxt
mainContent["tex" + newPos]._y = thumbHeight - textMc.scrolltxt.bg._height;
isReading = true;
textMc.scrolltxt.bg.onRollOut = textMc.scrolltxt.bg.onReleaseOutside = function(){ // pop down scrolltxt
if(!mainContent["tex" + newPos].scrolltxt.bg.hitTest(_root._xmouse, _root._ymouse, true)){
mainContent["tex" + newPos]._y = thumbHeight - textMc.imtext._height;
isReading = false;
function addLoader(thumb:MovieClip){ // Add a preloader to every thumbnail
mainContent.attachMovie("smallLoader", "preloader" + thumb._name, mainContent.getNextHighestDepth()); // add preloader
mainContent["preloader"+thumb._name]._x = thumb._x + (thumbWidth - mainContent["preloader"+thumb._name]._width) /2; // positioning
mainContent["preloader"+thumb._name]._y = (thumbHeight - mainContent["preloader"+thumb._name]._height) /2; // positioning
mclListener.onLoadInit = function(thumb:MovieClip) {
mainContent["preloader"+thumb._name].removeMovieClip();
mainContent[""+thumb._name].onEnterFrame = function(){ // Fade in Effect
mainContent[""+thumb._name]._alpha += Number(fadeInTime); // Every frame the alpha of the thumbnail is added by fadeInTime.
if(mainContent[""+thumb._name]._alpha >= 100){
delete mainContent[""+thumb._name].onEnterFrame; // When fade in effect is done, remove the onEnterFrame funtion
mclListener.onLoadComplete = function(thumb){ // When a thumb is fully loaded, add button action
thumb.onRelease = function(){ // When button released, execute function below
var i = Number(thumb._name)%imagesTotal;
// Go to a website defined in the xml document
thumb.onRollOver = function(){ // make alpha of arrow 100 on roll over
var i = Number(thumb._name)%imagesTotal;
mainContent["tex" + i].arrowMc._alpha = 100;
thumb.onRollOut = function(){ // make alpha of arrow 0 on roll over
var i = Number(thumb._name)%imagesTotal;
mainContent["tex" + i].arrowMc._alpha = 0;
// Button and Position Handling ///
// Left button
leftBtn.onPress = function() {
if (isReading == false){ // onPress call the next picture on the right
callPic("left");
leftBtn.onRollOver = function(){ // onRollOver move the arrow by 5 pixels
if(isReading == false){
leftBtn.arrow._x -= 5;
leftBtn.onRollOut = leftBtn.onReleaseOutside = function(){
if(isReading == false){
leftBtn.arrow._x += 5 ; // onRollOut reset the arrow
// Right button
rightBtn.onPress = function() {
if(isReading == false){
callPic("right"); // onPress call the next picture on the right
rightBtn.onRollOver = function(){
if(isReading == false){
rightBtn.arrow._x += 5 ; // onRollOver move the arrow by 5 pixels
rightBtn.onRollOut = rightBtn.onReleaseOutside = function(){
if(isReading == false){
rightBtn.arrow._x -= 5; // onRollOut reset the arrow
pieMc.onRelease = function(){
if (dwLoader != 0){ // Stops the pieLoader
dwLoader = 0;
else{
dwLoader = 100 * 3.6 / (Number(shiftTime) * 24); // Start the pieLoader
// Easing function //
//Used to give that cool ease effect on the mainContent, titleContainer and reflectContainer and dragger
// Want to change the ease effect? check help document
this.onEnterFrame = function() { // Start endless loop, executed every time frame is updated // If dragEase is false don't allow easing for the dragger
if (dwLoader != 0 && isReading == false){
arcVal += Number(dwLoader); // new value of arcVal is the old value plus dwLoader
pieMc.clear();
pieMc.beginFill(0xaddf99, 100); // draw the pie shape with pink color, you can change the color in this line
pieMc.drawPie(bckgrnd._width - 20, 20, 90, -arcVal, 7); // position the pieLoader, 90 = startAngle, 7 = radius
pieMc.endFill();
if (arcVal > 360){
shiftPic("right"); // If the pie-angle = 360 call the next picture/thumbnail
arcVal = 0;
dx = (nextXPosition - mainContent._x) * easeSpeed; // Calculates how much the mainContent needs to move, note that dx is becomming smaller and smaller when the mainContent reaches its final position.
mainContent._x += dx; // Move the mainContent
MovieClip.prototype.drawPie = function(x, y, startAngle, arc, radius) { // x, y = center point of the wedge.startAngle = starting angle in degrees.arc = sweep of the wedge. Negative values draw clockwise.
this.moveTo(x, y); // move to x,y position
var segAngle, theta, angle, angleMid, segs, startx, starty, anchx, anchy, contrx, contry; // Init vars
segs = Math.ceil(Math.abs(arc)/20); // Devide the arc in 20 segments
segAngle = arc/segs; // Calculate the sweep of each segment.
theta = -(segAngle/180)*Math.PI; // Convert to radions
angle = -(startAngle/180)*Math.PI; // Convert startAngle to radians
startx = x + Math.cos(startAngle/180*Math.PI) * radius; // Calculate curve start x position
starty = y + Math.sin(-startAngle/180*Math.PI) * radius; // Calculate curve start y position
this.lineTo(startx, starty); // Draw a line from the center to the start of the curve
for (var i = 0; i<segs; i++) { // Loop for drawing curve segments
angle += theta; // Icrement angle with segAngle => theta (in radians)
anchx = x+Math.cos(angle)*radius; // Calculate parameters for curveTo function
anchy = y+Math.sin(angle)*radius; // Calculate parameters for curveTo function
contrx = x+Math.cos(angle-(theta/2))*(radius/Math.cos(theta/2)); // Calculate parameters for curveTo function
contry = y+Math.sin(angle-(theta/2))*(radius/Math.cos(theta/2)); // Calculate parameters for curveTo function
this.curveTo(contrx, contry, anchx, anchy); // Draw the curve
this.lineTo(x, y); // close the curve by drawing a line to the centerAs is always the case in this sort of situation, you ask the printer, or banner maker. If you have a particular company in mond, they may have a website with guidelines, and that is going to be much better information than the guesses - good though 'some' of them might be.
25' by 16' is huge. Have you found somewhere that will make it? This company will supply 25 foot long banners, at a surprisingly cheap $176, but only 3 foot high. The problem being the width of the printer.
http://www.allstatebanners.com/3x25-vinyl-banner -
Im considering buying a power mac G5 but only cuz its all i can afford and i got an idea about hooking ut up to my tv but i would want to be able to use a wireless keyboard and traction pad but i did some reserch online and found out i need a airport extreme with 2.0 EDR to enable bluetooth which is a requirement for the wireless keyboard. Where can I find the AirPort Extreme with Bluetooth 2.0+EDR card? There dosent seem to be any place online that sells it and lets say I do install the airport extreme card and enable wifi on a power Mac G5, will I be able to use a apple wireless keyboard with it? And just a side question, for the age of the computer what OS should I have installed, I'm not to femilliar with apple software, the only apple products I have are old iPods n a 4s. Oh and I would mainly use it for going online, a little bit of vid editing, watching YouTube vids, homework and uploading and listing to music, I would love to wirelessly sync my iPhone to the power Mac wirelessly.
Forgot Your Account Password
For Lion, Mountain Lion, or Mavericks
Boot to the Recovery HD:
Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
When the menubar appears select Terminal from the Utilities menu.
Enter resetpassword at the prompt and press RETURN. Follow
instructions in the dialog window that will appear.
Or see:
Reset a Mac OS X 10.7 Lion Password
OS X Mountain Lion- Reset a login password,
OS X Mavericks- Solve password problems,
OS X Lion- Apple ID can be used to reset your user account password.
For Snow Leopard and earlier with installer DVD
Mac OS X 10.6- If you forget your administrator password,
OS X- Changing or resetting an account password (Snow Leopard and earlier).
For Snow Leopard and earlier without installer DVD
How to reset your Mac OS X password without an installer disc | MacYourself
Reset OS X Password Without an OS X CD — Tech News and Analysis
How To Create A New Administrator Account - Hack Mac -
Need help with the rotate and zoom button...
hi, i create a Jpanel code that use for zoom in and rotate image, the rotate button work fine but the zoom in is not work by the following code, can any one tell me how to fix this?
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.Hashtable;
import javax.imageio.ImageIO;
import javax.swing.event.*;
public class RotatePanel extends JPanel {
private double m_zoom = 1.0;
private double m_zoomPercentage;
private Image image;
private double currentAngle;
private Button rotate1, rotate2, rotate3,zoom;
public RotatePanel(Image image) {
this.image = image;
MediaTracker mt = new MediaTracker(this);
mt.addImage(image, 0);
try {
mt.waitForID(0);
catch (Exception e) {
e.printStackTrace();
public void rotate() {
//rotate 5 degrees at a time
currentAngle+=90.0;
if (currentAngle >= 360.0) {
currentAngle = 0;
repaint();
public void setZoomPercentage(int zoomPercentage)
m_zoomPercentage = ((double)zoomPercentage) / 100;
public void originalSize()
m_zoom = 1;
public void zoomIn()
m_zoom += m_zoomPercentage;
public void zoomOut()
m_zoom -= m_zoomPercentage;
if(m_zoom < m_zoomPercentage)
if(m_zoomPercentage > 1.0)
m_zoom = 1.0;
else
zoomIn();
public double getZoomedTo()
return m_zoom * 100;
public void rotate1() {
//rotate 5 degrees at a time
currentAngle+=180.0;
if (currentAngle >= 360.0) {
currentAngle = 0;
repaint();
public void rotate2() {
//rotate 5 degrees at a time
currentAngle+=270.0;
if (currentAngle >= 360.0) {
currentAngle = 0;
repaint();
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
AffineTransform origXform = g2d.getTransform();
AffineTransform newXform = (AffineTransform)(origXform.clone());
//center of rotation is center of the panel
int xRot = this.getWidth()/2;
int yRot = this.getHeight()/2;
newXform.rotate(Math.toRadians(currentAngle), xRot, yRot);
g2d.setTransform(newXform);
//draw image centered in panel
int x = (getWidth() - image.getWidth(this))/2;
int y = (getHeight() - image.getHeight(this))/2;
g2d.scale(m_zoom, m_zoom);
g2d.drawImage(image, x, y, this);
g2d.setTransform(origXform);
public Dimension getPreferredSize() {
return new Dimension((int)(image.getWidth(this) +
(image.getWidth(this) * (m_zoom - 1))),
(int)(image.getHeight(this) +
(image.getHeight(this) * (m_zoom -1 ))));
public static void main(String[] args) throws IOException{
JFrame f = new JFrame();
Container cp = f.getContentPane();
cp.setLayout(new BorderLayout());
Image testImage =
Toolkit.getDefaultToolkit().getImage("clouds.jpg");
final RotatePanel rotatePanel = new RotatePanel(testImage);
final RotatePanel zomePanel = new RotatePanel(testImage);
JButton b = new JButton ("90 degree");
JButton c = new JButton ("180 degree");
JButton d = new JButton ("270 degree");
JButton e = new JButton ("zoom in");
c.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
rotatePanel.rotate1();
d.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
rotatePanel.rotate2();
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
rotatePanel.rotate();
e.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
zomePanel.zoomIn();
cp.add(rotatePanel, BorderLayout.NORTH);
cp.add(b, BorderLayout.WEST);
cp.add(c, BorderLayout.CENTER);
cp.add(d, BorderLayout.EAST);
cp.add(e, BorderLayout.SOUTH);
// f.pack();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setSize(500,500);
f.setVisible(true);
}TRIPLE CROSS POSTED
[_http://forum.java.sun.com/thread.jspa?threadID=5314687&messageID=10342105#10342105_|http://forum.java.sun.com/thread.jspa?threadID=5314687&messageID=10342105#10342105]
Stop posting this question over and over in multiple forums please. -
Need help with calculator project for an assignment...
Hi all, I please need help with my calculator project that I have to do for an assignment.
Here is the project's specifications that I need to do"
"""Create a console calculator applicaion that:
* Takes one command line argument: your name and surname. When the
program starts, display the date and time with a welcome message for the
user.
* Display all the available options to the user. Your calculator must include
the arithmetic operations as well as at least five scientific operations of the
Math class.
-Your program must also have the ability to round a number and
truncate it.
-When you multiply by 2, you should not use the '*' operator to perform the
operation.
-Your program must also be able to reverse the sign of a number.
* Include sufficient error checking in your program to ensure that the user
only enters valid input. Make use of the String; Character, and other
wrapper classes to help you.
* Your program must be able to do conversions between decimal, octal and
hex numbers.
* Make use of a menu. You should give the user the option to end the
program when entering a certain option.
* When the program exits, display a message for the user, stating the
current time, and calculate and display how long the user used your
program.
* Make use of helper classes where possible.
* Use the SDK to run your program."""
When the program starts, it asks the user for his/her name and surname. I got the program to ask the user again and again for his/her name and surname
when he/she doesn't insert anything or just press 'enter', but if the user enters a number for the name and surname part, the program continues.
Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??
Here is the programs code that I've written so far:
{code}
import java.io.*;
import java.util.*;
import java.text.*;
public class Project {
private static String nameSurname = "";
private static String num1 = null;
private static String num2 = null;
private static String choice1 = null;
private static double answer = 0;
private static String more;
public double Add() {
answer = (Double.parseDouble(num1) + Double.parseDouble(num2));
return answer;
public double Subtract() {
answer = (Double.parseDouble(num1) - Double.parseDouble(num2));
return answer;
public double Multiply() {
answer = (Double.parseDouble(num1) * Double.parseDouble(num2));
return answer;
public double Divide() {
answer = (Double.parseDouble(num1) / Double.parseDouble(num2));
return answer;
public double Modulus() {
answer = (Double.parseDouble(num1) % Double.parseDouble(num2));
return answer;
public double maximumValue() {
answer = (Math.max(Double.parseDouble(num1), Double.parseDouble(num2)));
return answer;
public double minimumValue() {
answer = (Math.min(Double.parseDouble(num1), Double.parseDouble(num2)));
return answer;
public double absoluteNumber1() {
answer = (Math.abs(Double.parseDouble(num1)));
return answer;
public double absoluteNumber2() {
answer = (Math.abs(Double.parseDouble(num2)));
return answer;
public double Squareroot1() {
answer = (Math.sqrt(Double.parseDouble(num1)));
return answer;
public double Squareroot2() {
answer = (Math.sqrt(Double.parseDouble(num2)));
return answer;
public static String octalEquivalent1() {
int iNum1 = Integer.parseInt(num1);
String octal1 = Integer.toOctalString(iNum1);
return octal1;
public static String octalEquivalent2() {
int iNum2 = Integer.parseInt(num2);
String octal2 = Integer.toOctalString(iNum2);
return octal2;
public static String hexadecimalEquivalent1() {
int iNum1 = Integer.parseInt(num1);
String hex1 = Integer.toHexString(iNum1);
return hex1;
public static String hexadecimalEquivalent2() {
int iNum2 = Integer.parseInt(num2);
String hex2 = Integer.toHexString(iNum2);
return hex2;
public double Round1() {
answer = Math.round(Double.parseDouble(num1));
return answer;
public double Round2() {
answer = Math.round(Double.parseDouble(num2));
return answer;
SimpleDateFormat format1 = new SimpleDateFormat("EEEE, dd MMMM yyyy");
Date now = new Date();
SimpleDateFormat format2 = new SimpleDateFormat("hh:mm a");
static Date timeIn = new Date();
public static long programRuntime() {
Date timeInD = timeIn;
long timeOutD = System.currentTimeMillis();
long msec = timeOutD - timeInD.getTime();
float timeHours = msec / 1000;
return (long) timeHours;
DecimalFormat decimals = new DecimalFormat("#0.00");
public String insertNameAndSurname() throws IOException{
boolean inputCorrect = false;
while (inputCorrect == false) {
while (nameSurname == null || nameSurname.length() == 0) {
for (int i = 0; i < nameSurname.length(); i++) {
if ((nameSurname.charAt(i) > 'a') && (nameSurname.charAt(i) < 'Z')){
inputCorrect = true;
else{
inputCorrect = false;
break;
try {
BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please enter your name and surname: ");
nameSurname = inStream.readLine();
inputCorrect = true;
}catch (IOException ex) {
System.out.println("You did not enter your name and surname, " + nameSurname + " is not a name, please enter your name and surname :");
inputCorrect = false;
System.out.println("\nA warm welcome " + nameSurname + " ,todays date is: " + format1.format(now));
System.out.println("and the time is now exactly " + format2.format(timeIn) + ".");
return nameSurname;
public String inputNumber1() throws IOException {
boolean inputCorrect = false;
while (inputCorrect == false) {
try {
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
System.out.print("\nPlease enter a number you want to do a calculation with and hit <ENTER>: ");
num1 = br.readLine();
double number1 = Double.parseDouble(num1);
System.out.println("\nThe number you have entered is: " + number1);
inputCorrect = true;
} catch (NumberFormatException nfe) {
System.out.println("\nYou did not enter a valid number: " + "\""+ num1 + "\" is not a number!!");
inputCorrect = false;
return num1;
public String calculatorChoice() throws IOException {
System.out.println("Please select an option of what you would like to do with this number from the menu below and hit <ENTER>: ");
System.out.println("\n*********************************************");
System.out.println("---------------------------------------------");
System.out.println("Please select an option from the list below: ");
System.out.println("---------------------------------------------");
System.out.println("1 - Add");
System.out.println("2 - Subtract");
System.out.println("3 - Multiply");
System.out.println("4 - Divide (remainder included)");
System.out.println("5 - Maximum and minimum value of two numbers");
System.out.println("6 - Squareroot");
System.out.println("7 - Absolute value of numbers");
System.out.println("8 - Octal and Hexadecimal equivalent of numbers");
System.out.println("9 - Round numbers");
System.out.println("0 - Exit program");
System.out.println("**********************************************");
boolean inputCorrect = false;
while (inputCorrect == false) {
try {
BufferedReader inStream = new BufferedReader (new InputStreamReader(System.in));
System.out.print("Please enter your option and hit <ENTER>: ");
choice1 = inStream.readLine();
int c1 = Integer.parseInt(choice1);
System.out.println("\nYou have entered choice number: " + c1);
inputCorrect = true;
} catch (NumberFormatException nfe) {
System.out.println("You did not enter a valid choice number: " + "\""+ choice1 + "\" is not in the list!!");
inputCorrect = false;
return choice1;
public String inputNumber2() throws IOException {
boolean inputCorrect = false;
while (inputCorrect == false) {
try {
BufferedReader br2 = new BufferedReader (new InputStreamReader(System.in));
System.out.print("\nPlease enter another number you want to do the calculation with and hit <ENTER>: ");
num2 = br2.readLine();
double n2 = Double.parseDouble(num2);
System.out.println("\nThe second number you have entered is: " + n2);
System.out.println("\nYour numbers are: " + num1 + " and " + num2);
inputCorrect = true;
} catch (NumberFormatException nfe) {
System.out.println("You did not enter a valid number: " + "\""+ num2 + "\" is not a number!!");
inputCorrect = false;
return num2;
public int Calculator() {
int choice2 = (int) Double.parseDouble(choice1);
switch (choice2) {
case 1 :
Add();
System.out.print("The answer of " + num1 + " + " + num2 + " is: " + decimals.format(answer));
break;
case 2 :
Subtract();
System.out.print("The answer of " + num1 + " - " + num2 + " is: " + decimals.format(answer));
break;
case 3 :
Multiply();
System.out.print("The answer of " + num1 + " * " + num2 + " is: " + decimals.format(answer));
break;
case 4 :
Divide();
System.out.print("The answer of " + num1 + " / " + num2 + " is: " + decimals.format(answer));
Modulus();
System.out.print(" and the remainder is " + decimals.format(answer));
break;
case 5 :
maximumValue();
System.out.println("The maximum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
minimumValue();
System.out.println("The minimum number between the numbers " + num1 + " and " + num2 + " is: " + decimals.format(answer));
break;
case 6 :
Squareroot1();
System.out.println("The squareroot of value " + num1 + " is: " + decimals.format(answer));
Squareroot2();
System.out.println("The squareroot of value " + num2 + " is: " + decimals.format(answer));
break;
case 7 :
absoluteNumber1();
System.out.println("The absolute number of " + num1 + " is: " + decimals.format(answer));
absoluteNumber2();
System.out.println("The absolute number of " + num2 + " is: " + decimals.format(answer));
break;
case 8 :
octalEquivalent1();
System.out.println("The octal equivalent of " + num1 + " is: " + octalEquivalent1());
octalEquivalent2();
System.out.println("The octal equivalent of " + num2 + " is: " + octalEquivalent2());
hexadecimalEquivalent1();
System.out.println("\nThe hexadecimal equivalent of " + num1 + " is: " + hexadecimalEquivalent1());
hexadecimalEquivalent2();
System.out.println("The hexadecimal equivalent of " + num2 + " is: " + hexadecimalEquivalent2());
break;
case 9 :
Round1();
System.out.println("The rounded number of " + num1 + " is: " + decimals.format(answer));
Round2();
System.out.println("The rounded number of " + num2 + " is: " + decimals.format(answer));
break;
case 0 :
if (choice2 == 0) {
System.exit(1);
break;
return choice2;
public String anotherCalculation() throws IOException {
boolean inputCorrect = false;
while (inputCorrect == false) {
try {
BufferedReader br3 = new BufferedReader (new InputStreamReader(System.in));
System.out.print("\nWould you like to do another calculation? Y/N ");
more = br3.readLine();
String s1 = "y";
String s2 = "Y";
if (more.equals(s1) || more.equals(s2)) {
inputCorrect = true;
while (inputCorrect = true){
inputNumber1();
System.out.println("");
calculatorChoice();
System.out.println("");
inputNumber2();
System.out.println("");
Calculator();
System.out.println("");
anotherCalculation();
System.out.println("");
inputCorrect = true;
} else {
System.out.println("\n" + nameSurname + " thank you for using this program, you have used this program for: " + decimals.format(programRuntime()) + " seconds");
System.out.println("the program will now exit, Goodbye.");
System.exit(0);
} catch (IOException ex){
System.out.println("You did not enter a valid answer: " + "\""+ more + "\" is not in the list!!");
inputCorrect = false;
return more;
public static void main(String[] args) throws IOException {
Project p1 = new Project();
p1.insertNameAndSurname();
System.out.println("");
p1.inputNumber1();
System.out.println("");
p1.calculatorChoice();
System.out.println("");
p1.inputNumber2();
System.out.println("");
p1.Calculator();
System.out.println("");
p1.anotherCalculation();
System.out.println("");
{code}
*Can you please run my code for yourself and have a look at how this program is constructed*
*and give me ANY feedback on how I can better this code(program) or if I've done anything wrong from your point of view.*
Your help will be much appreciated.
Thanks in advanceSmirre wrote:
Now my question is this: How can I restrict the user to only enter 'letters' (and spaces of course) but allow NO numbers for his/her surname??You cannot restrict the user. It is a sad fact in programming that the worst bug always sits in front of the Computer.
What you could do is checking the input string for numbers. If it contains numbers, just reprompt for the Name.
AND you might want to ask yourself why the heck a calculator needs to know the users Name. -
Need help with almost completed plugin engine project
Hi all,
For a while now I have been working on a plugin engine. After a few iterations, the engine is similar to the Eclipse engine, in that plugins use extension points and extensions to allow contributions. Unlike the eclipse engine I have added the ability for plugins to fire events through the engine and other plugins can add listeners, all through the plugin.xml manifest. Dependencies are mostly handled automatically at plugin load time (when extensions get resolved to extension points, and listeners get resolved to events). For the case where a plugin needs to use classes from another plugin, dependencies are also allowed to be declared. Like the eclipse engine, activation of plugins occurs the first time a class is used within the plugin's classpath, OR a plugin can be activated after it is loaded.
What I need help with is testing, working on examples to provide with the engine project, and feedback/suggestions before we release the M1 build. I am asking for those that are interested in this type of work to volunteer to help where applicable and possible. I want to provide a solid plugin engine to the java community, one that is easy to use, works well, and is pretty effecient in terms of resource usage and performance.
Of particular interest to me right at the moment is dealing with multiple versions. As I see it, the engine will be used within an application and as such plugins would be distributed with a specific application version. The plugin version itself is more of a notification as to what version a plugin is, although I imagine it will help when updating at runtime as well.
Just a few other details of the engine. It handles (or will soon) dynamic load, unload and reload of plugins at runtime. Plugins can be distributed in an archive file format, we call .par (Plugin ARchive), with additional plugin filename extensions configurable at runtime. The plugins can be developed and deployed in an expanded directory format as they are in Eclipse as well, or in the archive format. In the archive format they do not need to be unzipped when deployed, and they can contain embeded jar/zip libraries. The engine handles finding and creating classes directly out of the .par file at runtime.
Multiple locations to find plugins are configurable before the engine starts, and even after it starts more could be added to allow additional locations to find plugins. URLs are supported, and soon the HTTP protocol will be supported so that plugins can be downloaded and installed at runtime.
The project can be found at www.sourceforge.net/projects/genpluginengine. If you would like to get involved and help out, please sign up on the dev mail list and send an email to introduce yourself to the rest of the members on the list.
I'll also add that I am working on a Swing UI Framework built entirely from plugins. It provides a ready-to-launce UI application that developers can simply add their plugins to, extending various extension points of the framework to have menu items, toolbar buttons, status bar access, help and preferences dialog additions, file i/o choosers, tons of open-source components ready to use (or extend to add on to), and like Eclipse, hopefully... draggable window frames that can be dropped on any other frame to form a tabbed frame of windows. Some of this is a ways off, some is getting there now. Presently you can add menu items that do allow plugin activation when first clicked, so plugins can be loaded but not activated until needed. The Preference dialog works but is not completed, and a plugin that adds a plugin control panel to view all loaded plugins, activate them, load/unload/reload, view extension points, extensions, dependencies, etc is partially completed. The point is, to allow a ready to run UI framework in Swing with an easy path for developers to quickly build applications with. If you are interested in this, when you join the mail list and introduce yourself, indicate that you are interested in this as well, as we need help with plugin development for it and would appreciate more help here too.
Look forward to some replies.Might I suggest setting up a project at a known project-site? I've seen your progress and questions posted here from time to time, but one of the drawbacks is that you have to fill each post with the entirity of your vision to explain what you're doing. That's a lot of text to read - and most folks will skip right over it.
On the other hand, a well-crafted, good-looking project web-site, with appropriate links and docs and vision statements, diagrams, etc. will have more likelyhood of attracting volunteers. java.net and sourceforge.net are likely spots to set up shop. In addition, you get CVS and bug-tracking systems, which can be quite valuable in such a large-scale project where there are lots of pieces. -
Need Help with a Flash Web Project
Hello, everyone. I am trying to use Flash to make a two-step
system. I want the flash document to, first, allow a person to
upload multiple image files and then, second, for the flash
document be able to create a slideshow with the uploaded images and
fade in and out from each image until the slideshow is over. I want
it to be where the flash document creates its own slideshow with
the images that are uploaded in the first step that I mentioned. I
want it to do it completely on its own so I need to know how to
give it the proper AI so that it can do this task.
So, are there any tips that anyone has on how to do this? Can
anyone tell me exactly how to do this? I really need help with this
for my new website project. Thanks in advance, everyone!The problem with the text not appearing at all has to do with you setting the alpha of the movieclip to 0%. Not within the movieclip, but the movieclip itself. The same for the xray graphic, except you have that as a graphic symbol rather than a movieclip. To have that play while inhabiting one frame you'll need to change it to a movieclip symbol.
To get the text to play after the blinds (just a minor critique, I'd speed up the blinds), you will want to add some code in the frame where you added the stop in the blinds animation. You will also need to assign instance names for the text movieclips in the properties panel, as well as place a stop(); in their first frames (inside).
Let's say you name them upperText and lowerText. Then the code you'd add at the end of the blinds animation (in the stop frame) would be...
_parent.upperText.play();
_parent.lowerText.play();
The "_parent" portion of that is used to target the timeline that is containing the item making the command, basically meaning it's the guy inside the blinds telling the guy outside the blinds to do something.
You'll probably want to add stops to the ends of the text animations as well.
If you want to have the first text trigger the second text, then you'd take that second line above and place it in the last frame of the first text animation instead of the blinds animation.
Note, on occasion, undeterminably, that code above doesn't work for some odd reason... the animation plays to the next frame and stops... so if you run into that, just put a play(); in the second frame to help push it along.
PS GotoandPlay would actually be gotoAndPlay, and for the code above you could substitute play(); with gotoAndPlay(2); -
Hi
Project Server 2013: I am using Project Server Permission Mode and need help with permission assignments?
How can I change Permissions for the individual users to see specific projects or all projects in project center and to see specific quick launch items?
For Example: if i have 4 users, A, B, C and D. what i want is:
User A can see everything and act as a project manager or Admin.
User B can view all projects in project centre but can change the schedule or resource assignment etc.
User C can only act as approver of projects and can view all projects in project centre.
User D can only view specific projects for which permissions are given.
can i have some expert help in sorting and understanding permission modes... as i was playing with project server mode permissions and can't figure out how to apply the above scenario to set of my user.
Thanks in Advance
Cheers
AJ
Ajay KumarHi Ajay,
Please refer to this link for detailed explanations about PS2013 security model.
http://technet.microsoft.com/en-us/library/cc197638(v=office.15).aspx
Actually, it will take a couple of days to explain in detail the security model that is a fundamental and tricky aspect of every PS implementation. But basically, you NEVER set permissions for a single user. You have groups in which your insert users. Groups
define "what users can do". Then you associate groups to a corresponding category. Categories define "what user can see". Thus the association of a group with a category will set "what the user can do on the objects he can see". Then, for more advanced security
level, you can use the RBS that will consist in "branches" in which you'll insert users. Based on those branches, you'll customize categories to fine-tune what user can see (for projects and resources) depending on the RBS branch and level.
I'd advice you to start "playing" in a test environment with the default categories/groups that might probably cover your need.
Concerning your 4 users:
user A : add him to the "administrator" group. Be careful that you're mentionning either project manager or administrator, which are 2 groups/categories with totally different permissions level.
user B : basically can see everything and change everything? it could be in the project manager group, assuming that there are no project visibility restrictions on the category via the RBS.
user C : waht do you mean by "approver"? Workflow approvals? Then it will be the portfolio manager group. Task update or timesheet approval? Then it is another long topic: please refer in the documentation to the "status manager" and "timesheet manager"
concepts. There are not related to the security model. In a few words, the status manager is the owner of the project plan, is defined for each task and approves tasks updates. The timesheet manager is an attribute defined for each resource in its parameters
and approves resource timesheet.
user D : you have to define which permission level must be given to this user. Basically it could be a team member that will see only projects he's in the project team. Note that team member cannot interact with the project plan in another way than submitting
timesheets and/or tasks updates which must be approved.
Once more, those are large and complex subjects that require a deep dive into your business model and tons of tests in a test environment.
Hope this helps.
Guillaume Rouyre - MBA, MCP, MCTS -
Need help with Template - unbalanced #EndEditable tag
I am unable to use this template to create a new page and get the "unbalanced #EndEditable tag" error.
If I open the file independently it looks great - otherwise I get the error.
Code for internal_students.dwt
There is an error at line 45, column 79 (absolute position 2188)
<div id="metanav"><!-- #BeginLibraryItem "/Library/metaNav.lbi" -->
<p><a href="../Library/contact/index.html">Contact Us</a></p>
<!-- #EndLibraryItem --></div>
<div id="navigation">
<div id="navigation_l">
<div id="navigation_r"><!-- #BeginLibraryItem "/Library/mainNav.lbi" --> <ul>
<li><a href="../index.html" class="first"><img src="../images/spacer.gif" alt="CAITE Homepage" width="75" height="20" border="0" /></a></li>
<li><a href="../about/index.html">About</a></li>
<li><a href="../news/index.html">News And Events</a></li>
<li><a href="../educators/index.html">For Educators</a></li>
<li><a href="../students/index.html">For Students</a></li>
<li><a href="../industry/index.html" class="last">For Industry</a></li>
</ul>
<!-- #EndLibraryItem --></div>
I need help with this as the site and templates were created 2/3 years before I arrived on the job.
Thank you
CherylOkay
- This is on-line page http://caite.cs.umass.edu/students/index.html
If you want code from template here it is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/internal_about.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>CAITE - Commonwealth Alliance for Information Technology Education</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<meta name="Description" content="Commonwealth Alliance for Information Technology Education (CAITE) to design and carry out comprehensive programs that address under representation in information technology (IT) education and the workforce. CAITE will focus on women and minorities in groups that are underrepresented in the Massachusetts innovation economy" />
<meta name="Keywords" content="Commonwealth Alliance for Information Technology Education CAITE Massachusetts women minorities information technology IT" />
<meta name="robots" content="all, index, follow" />
<meta name="revisit-after" content="14 days" />
<meta name="author" content="Outreach Web Team" />
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --><!-- InstanceEndEditable -->
<link rel="shortcut icon" href="/images/favicon.ico" />
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script type="text/javascript" src="../scripts/jquery.easing.js"></script>
<script type="text/javascript" src="../scripts/jquery.pngfix.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
$(document).ready(function() {
$("img[@src$=png], div#wrapper_l, div#wrapper_r, div#whatsnew").pngfix();
//-->
</script>
<link href="../css/screenstyle.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../css/printstyle.css" rel="stylesheet" type="text/css" media="print" />
</head>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<body>
<div id="wrapper">
<div id="metanav"><!-- #BeginLibraryItem "/Library/metaNav.lbi" -->
<p><a href="../Library/contact/index.html">Contact Us</a></p>
<!-- #EndLibraryItem --></div>
<div id="navigation">
<div id="navigation_l">
<div id="navigation_r"><!-- #BeginLibraryItem "/Library/mainNav.lbi" --> <ul>
<li><a href="../index.html" class="first"><img src="../images/spacer.gif" alt="CAITE Homepage" width="75" height="20" border="0" /></a></li>
<li><a href="../about/index.html">About</a></li>
<li><a href="../news/index.html">News And Events</a></li>
<li><a href="../educators/index.html">For Educators</a></li>
<li><a href="../students/index.html">For Students</a></li>
<li><a href="../industry/index.html" class="last">For Industry</a></li>
</ul>
<!-- #EndLibraryItem --></div>
<!-- end navigation right -->
</div><!-- end navigation left -->
</div><!-- end navigation -->
<div id="wrapper_l">
<div id="wrapper_r">
<div id="innerwrapper">
<div id="internalBanner-print"> <h1>Commonwealth Alliance for Information Technology Education (CAITE)</h1></div>
<div id="internalBanner"><!-- InstanceBeginEditable name="internalBanner" -->
<div class="students-banner">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="125" height="188" align="left" valign="top" id="homeImage"><img src="../images/logo_vertical_small.png" alt="CAITE" width="105" height="188" /></td>
<td align="left" valign="top" id="internal-banner-quote"><div id="internalQuote">
<div id="internalQuote-inner">
<p>CAITE designs and carrys out comprehensive programs that address under-representation in information technology (IT).</p>
</div>
</div></td>
</tr>
</table>
</div>
<!-- InstanceEndEditable --></div> <!-- end banner -->
<div id="internalContent">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="317" align="left" valign="top" id="secondary-content">
<!-- InstanceBeginEditable name="SecondaryNav" --><!-- #BeginLibraryItem "/Library/studentNav.lbi" -->
<h3><a href="../students/index.html">For Students</a></h3>
<div id="secondaryNav">
<ul>
<li><a href="http://www.takeITgoanywhere.org" target="_blank">TakeITgoanywhere.org</a></li>
</ul>
</div><!-- #EndLibraryItem --><!-- InstanceEndEditable -->
</td>
<td align="left" valign="top" id="contentCell"><!-- InstanceBeginEditable name="mainContent" -->
<h1>For Students</h1>
<p>The University of Massachusetts Amherst is leading a Commonwealth Alliance for Information Technology Education (CAITE) to design and carry out comprehensive programs that address under representation in information technology (IT) education and the workforce. CAITE will focus on women and minorities in groups that are underrepresented in the Massachusetts innovation economy; that is, economically, academically, and socially disadvantaged residents.</p>
<p>The project will pilot a series of outreach programs supported by educational pathways in three regions (one rural, one suburban, and one urban). The project will include work with high school teachers, staff, and counselors. CAITE will identify best practices and disseminate, deploy, extend and institutionalize these best practices statewide and nationally.</p>
<p>Community colleges are the centerpiece of CAITE because of the central role they play in reaching out to underserved populations and in serving as a gateway to careers and further higher education.</p>
<p>This project will build a broad alliance built on its leadership in and partnership with the Commonwealth Information Technology Initiative (CITI), the Boston Area Advanced Technological Education Center (BATEC), regional Louis Stokes Alliances and NSF EGEP programs, and other partnerships and initiatives focused on information technology education and STEM pipeline issues</p>
<p> </p>
<!-- InstanceEndEditable --></td>
</tr>
</table>
</div>
<div id="alliances">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30" align="left" valign="top"><h2><a href="../about/alliances.html">Alliances</a></h2></td>
</tr>
<tr>
<td align="center" valign="middle"><!-- #BeginLibraryItem "/Library/AllianceTable.lbi" --><p>
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td width="35" align="center" valign="middle"> </td>
<td align="center" valign="middle"><a href="http://www.citi.mass.edu/" target="_blank"><img src="../images/logo_citi.jpg" alt="Citi" width="65" height="50" border="0 /"></a></td>
<td align="center" valign="middle"><a href="http://www.batec.org/index.php" target="_blank"><img src="../images/logo_batec.jpg" alt="BATEC" width="69" height="46" border="0" /></a></td>
<td align="center" valign="middle"><a href="http://www.nsf.gov/index.jsp" target="_blank"><img src="../images/nsflogo.gif" alt="NSF" width="64" height="65" border="0" ></a></td>
<td align="center" valign="middle"><a href="http://www.nelsamp.neu.edu/" target="_blank"><img src="../images/nelsamplogo.gif" width="100" border="0"></a></td>
<td align="center" valign="middle"><p><a href="http://mysite.verizon.net/milnerm/" target="_blank"><img src="../images/umlsamp.png" width="85" height="63" border="0"></a></p> </td>
<td align="center" valign="middle"><a href="http://www.neagep.org/index.asp" target="_blank"><img src="../images/nealogo.gif" border="0" ></a></td>
</tr>
</table>
<!-- #EndLibraryItem --></td>
</tr>
</table>
</div>
</div> <!-- end inner wrapper -->
</div><!-- end wrapper right -->
</div><!-- end wrapper left -->
<div id="bottom">
<div id="bottom_l">
<div id="bottom_r"> </div><!-- end bottom right -->
</div><!-- end bottom left -->
</div> <!-- end bottom -->
</div><!-- end wrapper -->
<div id="copyright"><!-- #BeginLibraryItem "/Library/copyright.lbi" -->
<p>Sponsored by CAITE an NSF CISE Broadening Participation in Computing Alliance<br />
© copyright 2008 <a href="http://www.umass.edu/" target="_blank">University of Massachusetts, Amherst</a></p>
<font color="#666666"><br>
</font>
<p><font color="#666666" size=2> This material is based upon work supported by the National Science Foundation under Grant No.s NSF-0634412 and NSF-0837739. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.</font> </p>
<!-- #EndLibraryItem --></div>
<!-- end copyright -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7435501-1");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
<!-- InstanceEnd --></html> -
Ok the video that you can see on my youtube is the one I need help with. The video is actually in 1080p and I have no idea why it is showing in such a low resolution, but that is not the problem. I need to track the gun and add a null to that track, after that I want to add a red solid layer and bring down its opacity a little, to simulate a laser sight from the gun.Then I tried to parent and SHIFT parent the red solid to the track, the end product would have to look like what you can see in the picture. I have watched a TON of videos about tracking and just can not the the result I need. the laser needs to follow the gun as I aim up and bring the gun down. How should I do this.......? Please someone help or link me a tutorial that will be helpful.....
You have a couple of problems. First you don't need to use shift parent, just parent. Second, your red solid is a 3D layer and you have applied 2D tracking info to the solid. Actually, there's another mistake and it is in the tracking. You should also be tracking scale because the gun moves from left to right as well as up and down. This changes the distance between the front and back tracking points.
My workflow with this project would be:
Track Motion of the front and back of the gun including position, scale and rotation
Apply the track info to a null called GunTrack or something like that
Add a solid and apply the beam effect or mask the red solid to simulate the shape of a laser sight
Change the blend mode of the solid to ADD
Move the anchor point to the center of the starting point of the laser
Parent the solid to the Gun Track null
That should do it. -
I need help with a VB Application
I need help with building an application and I am on a tight deadline. Below I have included the specifics for what I need the application to do as well as the code that I have completed so far. I am having trouble getting the data input into
the text fields to save to a .txt file. Also, I need validation to ensure that the values entered into the text fields coincide with the field type. I am new to VB so please be gentle. Any help would be appreciated. Thanx
•I need to use the OpenFileDialog and SaveFileDialog in my application.
•Also, I need to use a structure.
1. The application needs to prompt the user to enter the file name on Form_Load.
2. Also, the app needs to use the AppendText method to write the Employee Data to the text file. My project should allow me to write multiple Employee Data to the same text file. The data should be written to the text file in the following format (comma
delimited)
FirstName, MiddleName, LastName, EmployeeNumber, Department, Telephone, Extension, Email
3. The Department dropdown menu DropDownStyle property should be set so that the user cannot enter inputs that are not in the menu.
Public Class Form1
Dim filename As String
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
Dim openFileDialog1 As New OpenFileDialog()
Dim fileLocation As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
openFileDialog1.InitialDirectory = "c:\"
openFileDialog1.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"
openFileDialog1.FilterIndex = 1
openFileDialog1.RestoreDirectory = True
If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
fileLocation = openFileDialog1.FileName
End If
'filename = InputBox("Enter output file name")
'oWrite = oFile.CreateText(filename)
cobDepartment.Items.Add("Accounting")
cobDepartment.Items.Add("Administration")
cobDepartment.Items.Add("Marketing")
cobDepartment.Items.Add("MIS")
cobDepartment.Items.Add("Sales")
End Sub
Private Sub btnSave_Click(ByValsender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'oWrite.WriteLine("Write e file")
oWrite.WriteLine("{0,10}{1,10}{2,10}{3,10}{4,10}{5,10}{6,10}{7,10}", txtFirstname.Text, txtMiddlename.Text, txtLastname.Text, txtEmployee.Text, cobDepartment.SelectedText, txtTelephone.Text, txtExtension.Text, txtEmail.Text)
oWrite.WriteLine()
End Sub
Private Sub btnExit_Click(ByValsender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
oWrite.Close()
End
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
txtFirstname.Text = ""
txtMiddlename.Text = ""
txtLastname.Text = ""
txtEmployee.Text = ""
txtTelephone.Text = ""
txtExtension.Text = ""
txtEmail.Text = ""
cobDepartment.SelectedText = ""
End Sub
End ClassHi Mikey81,
Your issue is about VB programming, so Visual Basic forum is a better forum for your case. I moved this thread there,
Thanks,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Need help with Berkeley XML DB Performance
We need help with maximizing performance of our use of Berkeley XML DB. I am filling most of the 29 part question as listed by Oracle's BDB team.
Berkeley DB XML Performance Questionnaire
1. Describe the Performance area that you are measuring? What is the
current performance? What are your performance goals you hope to
achieve?
We are measuring the performance while loading a document during
web application startup. It is currently taking 10-12 seconds when
only one user is on the system. We are trying to do some testing to
get the load time when several users are on the system.
We would like the load time to be 5 seconds or less.
2. What Berkeley DB XML Version? Any optional configuration flags
specified? Are you running with any special patches? Please specify?
dbxml 2.4.13. No special patches.
3. What Berkeley DB Version? Any optional configuration flags
specified? Are you running with any special patches? Please Specify.
bdb 4.6.21. No special patches.
4. Processor name, speed and chipset?
Intel Xeon CPU 5150 2.66GHz
5. Operating System and Version?
Red Hat Enterprise Linux Relase 4 Update 6
6. Disk Drive Type and speed?
Don't have that information
7. File System Type? (such as EXT2, NTFS, Reiser)
EXT3
8. Physical Memory Available?
4GB
9. Are you using Replication (HA) with Berkeley DB XML? If so, please
describe the network you are using, and the number of Replica’s.
No
10. Are you using a Remote Filesystem (NFS) ? If so, for which
Berkeley DB XML/DB files?
No
11. What type of mutexes do you have configured? Did you specify
–with-mutex=? Specify what you find inn your config.log, search
for db_cv_mutex?
None. Did not specify -with-mutex during bdb compilation
12. Which API are you using (C++, Java, Perl, PHP, Python, other) ?
Which compiler and version?
Java 1.5
13. If you are using an Application Server or Web Server, please
provide the name and version?
Oracle Appication Server 10.1.3.4.0
14. Please provide your exact Environment Configuration Flags (include
anything specified in you DB_CONFIG file)
Default.
15. Please provide your Container Configuration Flags?
final EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate(true); // If the environment does not
// exist, create it.
envConf.setInitializeCache(true); // Turn on the shared memory
// region.
envConf.setInitializeLocking(true); // Turn on the locking subsystem.
envConf.setInitializeLogging(true); // Turn on the logging subsystem.
envConf.setTransactional(true); // Turn on the transactional
// subsystem.
envConf.setLockDetectMode(LockDetectMode.MINWRITE);
envConf.setThreaded(true);
envConf.setErrorStream(System.err);
envConf.setCacheSize(1024*1024*64);
envConf.setMaxLockers(2000);
envConf.setMaxLocks(2000);
envConf.setMaxLockObjects(2000);
envConf.setTxnMaxActive(200);
envConf.setTxnWriteNoSync(true);
envConf.setMaxMutexes(40000);
16. How many XML Containers do you have? For each one please specify:
One.
1. The Container Configuration Flags
XmlContainerConfig xmlContainerConfig = new XmlContainerConfig();
xmlContainerConfig.setTransactional(true);
xmlContainerConfig.setIndexNodes(true);
xmlContainerConfig.setReadUncommitted(true);
2. How many documents?
Everytime the user logs in, the current xml document is loaded from
a oracle database table and put it in the Berkeley XML DB.
The documents get deleted from XML DB when the Oracle application
server container is stopped.
The number of documents should start with zero initially and it
will grow with every login.
3. What type (node or wholedoc)?
Node
4. Please indicate the minimum, maximum and average size of
documents?
The minimum is about 2MB and the maximum could 20MB. The average
mostly about 5MB.
5. Are you using document data? If so please describe how?
We are using document data only to save changes made
to the application data in a web application. The final save goes
to the relational database. Berkeley XML DB is just used to store
temporary data since going to the relational database for each change
will cause severe performance issues.
17. Please describe the shape of one of your typical documents? Please
do this by sending us a skeleton XML document.
Due to the sensitive nature of the data, I can provide XML schema instead.
18. What is the rate of document insertion/update required or
expected? Are you doing partial node updates (via XmlModify) or
replacing the document?
The document is inserted during user login. Any change made to the application
data grid or other data components gets saved in Berkeley DB. We also have
an automatic save every two minutes. The final save from the application
gets saved in a relational database.
19. What is the query rate required/expected?
Users will not be entering data rapidly. There will be lot of think time
before the users enter/modify data in the web application. This is a pilot
project but when we go live with this application, we will expect 25 users
at the same time.
20. XQuery -- supply some sample queries
1. Please provide the Query Plan
2. Are you using DBXML_INDEX_NODES?
Yes.
3. Display the indices you have defined for the specific query.
XmlIndexSpecification spec = container.getIndexSpecification();
// ids
spec.addIndex("", "id", XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
spec.addIndex("", "idref", XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// index to cover AttributeValue/Description
spec.addIndex("", "Description", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ELEMENT | XmlIndexSpecification.KEY_SUBSTRING, XmlValue.STRING);
// cover AttributeValue/@value
spec.addIndex("", "value", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// item attribute values
spec.addIndex("", "type", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// default index
spec.addDefaultIndex(XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ELEMENT | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
spec.addDefaultIndex(XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// save the spec to the container
XmlUpdateContext uc = xmlManager.createUpdateContext();
container.setIndexSpecification(spec, uc);
4. If this is a large query, please consider sending a smaller
query (and query plan) that demonstrates the problem.
21. Are you running with Transactions? If so please provide any
transactions flags you specify with any API calls.
Yes. READ_UNCOMMITED in some and READ_COMMITTED in other transactions.
22. If your application is transactional, are your log files stored on
the same disk as your containers/databases?
Yes.
23. Do you use AUTO_COMMIT?
No.
24. Please list any non-transactional operations performed?
No.
25. How many threads of control are running? How many threads in read
only mode? How many threads are updating?
We use Berkeley XML DB within the context of a struts web application.
Each user logged into the web application will be running a bdb transactoin
within the context of a struts action thread.
26. Please include a paragraph describing the performance measurements
you have made. Please specifically list any Berkeley DB operations
where the performance is currently insufficient.
We are clocking 10-12 seconds of loading a document from dbd when
five users are on the system.
getContainer().getDocument(documentName);
27. What performance level do you hope to achieve?
We would like to get less than 5 seconds when 25 users are on the system.
28. Please send us the output of the following db_stat utility commands
after your application has been running under "normal" load for some
period of time:
% db_stat -h database environment -c
% db_stat -h database environment -l
% db_stat -h database environment -m
% db_stat -h database environment -r
% db_stat -h database environment -t
(These commands require the db_stat utility access a shared database
environment. If your application has a private environment, please
remove the DB_PRIVATE flag used when the environment is created, so
you can obtain these measurements. If removing the DB_PRIVATE flag
is not possible, let us know and we can discuss alternatives with
you.)
If your application has periods of "good" and "bad" performance,
please run the above list of commands several times, during both
good and bad periods, and additionally specify the -Z flags (so
the output of each command isn't cumulative).
When possible, please run basic system performance reporting tools
during the time you are measuring the application's performance.
For example, on UNIX systems, the vmstat and iostat utilities are
good choices.
Will give this information soon.
29. Are there any other significant applications running on this
system? Are you using Berkeley DB outside of Berkeley DB XML?
Please describe the application?
No to the first two questions.
The web application is an online review of test questions. The users
login and then review the items one by one. The relational database
holds the data in xml. During application load, the application
retrieves the xml and then saves it to bdb. While the user
is making changes to the data in the application, it writes those
changes to bdb. Finally when the user hits the SAVE button, the data
gets saved to the relational database. We also have an automatic save
every two minues, which saves bdb xml data and saves it to relational
database.
Thanks,
Madhav
[email protected]Could it be that you simply do not have set up indexes to support your query? If so, you could do some basic testing using the dbxml shell:
milu@colinux:~/xpg > dbxml -h ~/dbenv
Joined existing environment
dbxml> setverbose 7 2
dbxml> open tv.dbxml
dbxml> listIndexes
dbxml> query { collection()[//@date-tip]/*[@chID = ('ard','zdf')] (: example :) }
dbxml> queryplan { collection()[//@date-tip]/*[@chID = ('ard','zdf')] (: example :) }Verbosity will make the engine display some (rather cryptic) information on index usage. I can't remember where the output is explained; my feeling is that "V(...)" means the index is being used (which is good), but that observation may not be accurate. Note that some details in the setVerbose command could differ, as I'm using 2.4.16 while you're using 2.4.13.
Also, take a look at the query plan. You can post it here and some people will be able to diagnose it.
Michael Ludwig -
Need help with navigation within a spark list...
hey guys, so in my application when you click on a list item, it opens up an image, and along with the image a few buttons are created dynamically...
the image and the url/labels for the dynamic buttons is provided through an xml/xmlListCollection.
what i need help with is the url or more specifically when you click on one of these dynamic buttons it needs to navigate me to another part of an list or display a certain set of images that is not in my spark list...
please let me know if this makes no sence
the code i have is
<code>
[Bindable] private var menuXml:XML;
[Bindable] private var imgList:XMLListCollection = new XMLListCollection();
[Bindable] private var navControl:XMLListCollection = new XMLListCollection();
[Bindable] private var fullList:XMLListCollection = new XMLListCollection();
private var returnedXml:XMLListCollection = new XMLListCollection();
private var myXmlSource:XML = new XML();
//[Bindable] private var xmlReturn:Object;
private var currImage:int = 0;
//public var userOpProv:XMLListCollection = new XMLListCollection();
//private var troubleShootProvider:XMLListCollection = new XMLListCollection();
private function myXml_resultHandeler(event:ResultEvent):void{
userOptionProvider.source = event.result.apx32.userOptions.children();
troubleShootProvider.source = event.result.apx32.troubleShooting.children();
fullList.source = event.result.apx32.children();
returnedXml.source = event.result[0].children();
myXmlSource = event.result[0];
private function myXml_faultHandler(event:FaultEvent):void{
Alert.show("Error loading XML");
Alert.show(event.fault.message);
private function app_creationComplete(event:FlexEvent):void{
userOptions.scroller.setStyle("horizontalScrollPolicy", ScrollPolicy.OFF);
myXml.send();
//trouble.scroller.setStyle("horizontalScrollPolicy", ScrollPolicy.OFF);
myXml = new HTTPService();
myXml.url = "modules/apx32/apx32TroubleshootingXml.xml";
myXml.resultFormat = "e4x";
myXml.addEventListener(ResultEvent.RESULT, myXml_resultHandeler);
myXml.addEventListener(FaultEvent.FAULT, myXml_faultHandler);
myXml.send();
private function troubleShootChange(event:IndexChangeEvent):void{
dynamicButtons.removeAllElements();
navControl.source = troubleShootProvider[event.newIndex].children();
currImage = 0;
imgList.source = troubleShootProvider[event.newIndex].images.children();
definition.source = imgList[currImage].@url;
if(imgList[currImage].@details == "true"){
if(imgList[currImage].buttons.@hasButtons == "true"){
for each(var item:XML in imgList[currImage].buttons.children()){
var newButton:LinkButton = new LinkButton();
newButton.label = item.@name;
newButton.x = item.@posX;
newButton.y = item.@posY;
newButton.setStyle("skin", null);
newButton.styleName = "dynamicButtonStyle";
dynamicButtons.addElement(newButton);
//var isMultiPage:String = navControl[2]["multiPages"];
//trace(isMultiPage);
// if(isMultiPage){
if(currImage >= imgList.length - 1){
next.visible = false;
back.visible = false;
else{
back.visible = false;
next.visible = true;
private function customButtonPressed(event:Event):void{
if(imgList[currImage].button.@changeTo != ""){
private function userOptionsChange(event:IndexChangeEvent):void{
dynamicButtons.removeAllElements();
navControl.source = userOptionProvider[event.newIndex].children();
currImage = 0;
imgList.source = userOptionProvider[event.newIndex].images.children();
definition.source = imgList[currImage].@url;
if(imgList[currImage].@details == "true"){
if(imgList[currImage].buttons.@hasButtons == "true"){
for each(var item:XML in imgList[currImage].buttons.children()){
var newButton:LinkButton = new LinkButton();
newButton.label = item.@name;
newButton.x = item.@posX;
newButton.y = item.@posY;
newButton.setStyle("skin", null);
newButton.styleName = "dynamicButtonStyle";
newButton.addEventListener(MouseEvent.MOUSE_DOWN, customButtonPressed);
dynamicButtons.addElement(newButton);
var isMultiPage:String = navControl[2]["multiPages"];
if(isMultiPage == "true"){
if(navControl[2]["next"] == "NEXT STEP"){
navContainer.x = 630;
else{
navContainer.x = 640;
next.label = navControl[2]["next"];
back.label = navControl[2]["back"];
if(currImage >= imgList.length - 1){
next.visible = false;
back.visible = false;
else{
back.visible = false;
next.visible = true;
private function nextClickHandler(event:MouseEvent):void{
currImage += 1;
dynamicButtons.removeAllElements();
if(currImage >= imgList.length-1){
currImage = imgList.length - 1;
//next.visible = false;
next.label = "YOU'RE DONE";
else
next.label = navControl[2]["next"];
back.visible = true;
if(imgList[currImage].@details == "true"){
if(imgList[currImage].buttons.@hasButtons == "true"){
for each(var item:XML in imgList[currImage].buttons.children()){
var newButton:LinkButton = new LinkButton();
newButton.label = item.@name;
newButton.x = item.@posX;
newButton.y = item.@posY;
newButton.setStyle("skin", null);
newButton.styleName = "dynamicButtonStyle";
dynamicButtons.addElement(newButton);
definition.source = imgList[currImage].@url;
private function backClickHandler(event:MouseEvent):void{
currImage -= 1;
dynamicButtons.removeAllElements();
if(currImage == 0){
back.visible = false;
next.visible = true;
next.label = navControl[2]["next"];
if(imgList[currImage].@details == "true"){
if(imgList[currImage].buttons.@hasButtons == "true"){
for each(var item:XML in imgList[currImage].buttons.children()){
var newButton:LinkButton = new LinkButton();
newButton.label = item.@name;
newButton.x = item.@posX;
newButton.y = item.@posY;
newButton.setStyle("skin", null);
newButton.styleName = "dynamicButtonStyle";
dynamicButtons.addElement(newButton);
definition.source = imgList[currImage].@url;
</code>
i have attached a copy of the xml that i have right now to this post for reference...
any help will be greatly appretiated!!! i've been stuck on this problem for the last week and my project is due soon
again thank you in advance...hey david... just nevermind my previous post... I was able to subclass a link button, so i now have two variables that get assigned to a link button,
one is "tabId" <-- contains the information on which tab to swtich to, and the second is, "changeTo"... this contans the label name which it needs to switch to
I'm just stuck on how to change my selected item in my tabNavigator/list
the code i have right now is
private function customButtonPressed(event:Event):void{
if(event.currentTarget.tabId == "troubleShooting"){
for each(var item:Object in troubleShootProvider){
if(item.@label == event.currentTarget.changeTo){
private function userOptionsChange(event:IndexChangeEvent):void{
dynamicButtons.removeAllElements();
navControl.source = userOptionProvider[event.newIndex].children();
currImage = 0;
imgList.source = userOptionProvider[event.newIndex].images.children();
definition.source = imgList[currImage].@url;
if(imgList[currImage].@details == "true"){
if(imgList[currImage].buttons.@hasButtons == "true"){
for each(var item:XML in imgList[currImage].buttons.children()){
var newButton:customLinkButton = new customLinkButton();
newButton.label = item.@name;
newButton.tabId = item.@tab;
newButton.changeTo = item.@changeTo;
newButton.x = item.@posX;
newButton.y = item.@posY;
newButton.setStyle("skin", null);
newButton.styleName = "dynamicButtonStyle";
newButton.addEventListener(MouseEvent.MOUSE_DOWN, customButtonPressed);
dynamicButtons.addElement(newButton);
var isMultiPage:String = navControl[2]["multiPages"];
var videoPresent:String = navControl[1]["videoPresent"];
if(videoPresent == "true"){
if(isMultiPage != "true"){
navContainer.x = 825;
if(isMultiPage == "true"){
if(navControl[2]["next"] == "NEXT STEP"){
navContainer.x = 630;
else{
navContainer.x = 640;
next.label = navControl[2]["next"];
back.label = navControl[2]["back"];
if(currImage >= imgList.length - 1){
next.visible = false;
back.visible = false;
else{
back.visible = false;
next.visible = true;
as you know, my xml gets divided into two saperate xmllistcollections one is the userOptionProvider, and the troubleshootingProvider
as is in the following xml
<mx:TabNavigator id="tabNav" width="275" tabStyleName="tabStyle" fontWeight="bold" height="400" paddingTop="0"
tabWidth="137.5" creationPolicy="all" borderVisible="false">
<mx:VBox label="USER OPTIONS" width="100%" height="100%" horizontalScrollPolicy="off" verticalScrollPolicy="off">
<s:List id="userOptions" width="100%" height="100%" itemRenderer="modules.apx32.myComponents.listRenderer"
borderVisible="false" contentBackgroundColor="#e9e9e9"
change="userOptionsChange(event)">
<s:dataProvider>
<s:XMLListCollection id="userOptionProvider" />
</s:dataProvider>
</s:List>
</mx:VBox>
<mx:VBox label="TROUBLESHOOTING">
<s:List id="trouble" width="100%" height="100%" itemRenderer="modules.apx32.myComponents.listRenderer"
borderAlpha="0" borderVisible="false" contentBackgroundColor="#e9e9e9"
change="troubleShootChange(event)">
<s:dataProvider>
<s:XMLListCollection id="troubleShootProvider" />
</s:dataProvider>
</s:List>
</mx:VBox>
</mx:TabNavigator>
Im having some trouble updating my list... basically change to the troubleshooting tab, and then select the one that i need...
hopefully that makes sence... -
I need help with this portion of my program, it's supposed to loop through the array and pull out the highest inputted score, currently it's only outputting what is in studentScoreTF[0].
private class HighScoreButtonHandler implements ActionListener
public void actionPerformed(ActionEvent e)
double highScore = 0;
int endScore = 0;
double finalScore = 0;
String tempHigh;
String tempScore;
for(int score = 0; score < studentScoreTF.length; score++)
tempHigh = studentScoreTF[score].getText();
tempScore = studentScoreTF[endScore].getText();
if(tempHigh.length() < tempScore.length())
highScore++;
finalScore = Double.parseDouble(tempScore);
JOptionPane.showMessageDialog(null, "Highest Class Score is: " + finalScore);This is another part of the program, it's supposed to loop through the student names array and pull out the the names of the students with the highest score, again it's only outputting what's in studentName[0].
private class StudentsButtonHandler implements ActionListener
public void actionPerformed(ActionEvent e)
int a = 0;
int b = 0;
int c = 0;
double fini = 0;
String name;
String score;
String finale;
String finalName = new String();
name = studentNameTF[a].getText();
score = studentScoreTF.getText();
finale = studentScoreTF[c].getText();
if(score.length() < finale.length())
fini++;
name = finalName + finale;
JOptionPane.showMessageDialog(null, "Student(s) with the highest score: " + name);
} Any help would be appreciated, this is getting frustrating and I'm starting to get a headache from it, lol.
Edited by: SammyP on Oct 29, 2009 4:18 PM
Edited by: SammyP on Oct 29, 2009 4:19 PMHeres a working example:
class Compare {
public int getHighest(int[] set) {
int high = set[0];
for(int i = 0; i < set.length; i++) {
if(set[i] > high) {
high = set;
return high; -
Need help with CS4 transitions
Hi,
I am trying to use a cross dissolve transition. To make it simple, I have two clips. I'm obviously doing something wrong here. I've watched the Adobe TV tutorial and all the guy does is to select cross dissolve from the effects box, and drags it over to the clip on the timeline. I think I am doing the exact same thing, but when I play my clip back, I can see no transition effect played back.
Maybe I'm putting it in the wrong place I thought, so I tried putting it in front of the split between the two clips. Then again at the beginning of the second clip. Neither of them worked, so I shut CS4 down, and booted it up again. I started a new project, and put two new clips in it. I put the dissolve transition at the beginning of the second clip, and it worked like a charm. Then to see if that was a fluke, went to a point about 3 minutes earlier in the timeline. So now I am on clip one. I go and make a cut in the timeline, and try to place another Cross dissolve at this spot. It appears to place the transition there because it creates the rectangular box, and it has the name cross dissolve in that rectangular box,but when I try to play it to see the transition, it isn't working. Go back to the beginning of the second clip, and that one still works perfectly.
I noticed that there is a difference in the appearance of the two cross dissolve rectangular boxes. The one that works has a single diagonal line that goes from lower left to upper right in the cross dissolve box, and then there are a whole series of diagonal lines that go from upper left to lower right all across the cross dissolve box . It looks like a whole bunch of dark gray and white backslashes. In the one that doesn't work, there is just that single diagonal line that goes from lower left to upper right. No backslashes on this one. What am I doing right in the first one, but not in the second?
I find that it will work perfectly if I put in a new clip. If I put in the Cross Dissolve at the beginning of a new clip that I add to the timelime, it will work perfectly. It is only when I try to split a clip that is already on the timeline, and then put the cross dissolve in at that point.
Perhaps it is not possible to do what I am attempting to do. Maybe you can't split a clip and place the transition at that point?When I am shooting video, it is not unusual for me to be taping a scene of a mountain, for example, and then put the camera on pause, while I briefly position myself to take video of the river that is flowing at my feet. That is what is happened on this clip that I am attempting to put the transition in between. Rather than having the scene just instantly change at this point, from the mountain to the river, it would be nice to have a smoother transition then that.
My mind was working on the problem while sleeping last night, and I think I might understand how to handle it. It might have been too simple for me to think about yesterday. I haven't tried it yet, but would it not work, to insert the mountain scene from my source monitor into the timeline, and then go back and insert the river scene into the time line instead of inserting both of them at the same time. Would these not now be two separate clips on the timeline, and the transition could now be applied?
Your analogy with the DJ is very good, but it isn't quite the same. You are correct in that he would be only fading from one song to the same spot on the same song. In my case I am going from an image of a mountain to an image of a river. Same clip, but different images. I appreciate the help, and your thoughts.
Terry Lee Martin
Date: Sat, 22 Aug 2009 23:15:55 -0600
From: [email protected]
To: [email protected]
Subject: Need help with CS4 transitions
From a creative standpoiint, I don't understand the desire to transition from one clip to the exact same spot on that same clip. That's like a DJ at a night club fading from one song to the exact same spot on that same song being played on a second CD player. What's the point?
>
Maybe you are looking for
-
Can I just consolidate and copy to the journaled hard drive over the network? Will a pc recognize a Mac formatted hard drive? I have searchd the forum and online for hours and can't seem to find anything that specifically address this. Does anyone
-
How to fix sever error in my mail
out going mail is not sendingout mail becouse of a server conection error i am singed in under the right username and password but it is not going out? can some one help me?
-
The filename you entered already exists...
When I attempt to save over an existing page (in order to replace it), I get the following error message: The filename you entered already exists. Please enter a different filename. How can a save over a file without being roadblocked by this error?
-
How to set query title or heading
Hi, How can I set the query title or query heading. And also how can I creat text variable for query description. Thank you Joe
-
I recently purchased a new laptop with Windows 8 which accordingly has Flash Player already installed. I later went to upload pictures on Facebook only for a pop up message to say that I do not have the latest version installed. I therefore, went on