Handling MouseEvent on FlexGlobals.topLevelApplication

Hey I would like to handle MouseEvent on FlexGlobals.topLevelApplication, like this one
FlexGlobals.topLevelApplication.addEventListener(MouseEvent.MOUSE_DOWN, evidenceOut)
it works nicely, but when modal dialog is opened, it's not fired. Maybe it's feature, don't know. But is there any option to handling click anywhere on stage, when modal dialog is opened?
Thank you

systemManager

Similar Messages

  • Gumbo FlexGlobals.topLevelApplication data binding issues

    Hi
    what is the reccomended way to bind a datasource of a sub-component to a Bindable collection in the top level application location.
    in 3, for this I would use {Application.application.instance_of_bindable_variable}, now I get a warning saying that data binding will not be able to detect assingments to  {FlexGlobals.topLevelApplication.instance_of_bindable_variable}
    so, how do i bind a data source of a sub-component to a variable instantiated at the Application level in Flex 4?
    Thanks,
    Jed

    Hi Alex, thanks for the reply.
    i added an import statement to mx.core.Application to the component and cast the FlexGlobals.topLevelApplication call, as you suggested, and it will not find the property now : "Eror 1119, access of possibly undefined property."
    I am trying to bind to a public ArrayCollcection that is marked with metadata as bindable in the toplevelApplication mxml file. as such
    ## index.mxml
    [Bindable]
    public var myArrayCollection:ArrayCollection;
    ## myComponent.mxml
    <myComponent source = "{Application(FlexGlobals.topLevelApplication).myArrayCollection}" />
    The project is imported from a Flex 3.x project and we are trying to move it over. Would it matter if the namespace for the script tag is mx vs fx, eg <mx:Script> | <fx:Script> ?
    any help would be much appreciated. Thanks in advance.

  • Flash Builder 4.7: Preloader, stageWidth is 1200 but FlexGlobals.topLevelApplication.width is 800

    Hello
    I am writting code to center my preloader. Using Flash Builder 4.7 when I request this.stage.stageWidth on my Asus tablet I get 1200, then when FlexGlobals.topLevelApplicaiton becomes available I use FlexGlobals.topLevelApplication.width and it gives me the value I am looking for which is 800. I have it working where the display is delayed until the FlexGlobals.topLevelApplication is not null but it would be nice if the loader could start showing from the very start.
    One thing I really liked about FB 4.7 was that it resized the main view to fit the screen better vs having it too big. How do I access the "scale" that's being applied so I can just calculate the stageWidth before topLevelApplication is ready.
    Thanks!

    Hello
    I am writting code to center my preloader. Using Flash Builder 4.7 when I request this.stage.stageWidth on my Asus tablet I get 1200, then when FlexGlobals.topLevelApplicaiton becomes available I use FlexGlobals.topLevelApplication.width and it gives me the value I am looking for which is 800. I have it working where the display is delayed until the FlexGlobals.topLevelApplication is not null but it would be nice if the loader could start showing from the very start.
    One thing I really liked about FB 4.7 was that it resized the main view to fit the screen better vs having it too big. How do I access the "scale" that's being applied so I can just calculate the stageWidth before topLevelApplication is ready.
    Thanks!

  • What is the recommended way to handle mouse click events for custom nodes that subclass Panes?

    Hi,
    I have created a custom node that is a StackPane containing a Label on top of a Polygon.
    import javafx.scene.control.Label;
    import javafx.scene.layout.StackPane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Polygon;
    public class CustomHexagon extends StackPane {
        private Polygon hexagon;
        private Label overlayText;
        public CustomHexagon( String text, double... points ) {
            this.hexagon = new Polygon( points );
            this.overlayText = new Label( text );
            overlayText.setStyle( "-fx-font-weight: bold;" );
            hexagon.setStroke( Color.GREEN );
            hexagon.setStrokeWidth( 5.0 );
            hexagon.setFill( Color.WHITE );
            this.getChildren().addAll( hexagon, overlayText );
    // Lays out the node where it should be according to the points provided for the Polygon.
            this.setLayoutX( points[0] - getLayoutBounds().getMinX() );
            this.setLayoutY( points[1] - getLayoutBounds().getMinY() );
    // Show the border of the StackPane.
            this.setStyle( "-fx-border-color: black; -fx-border-width: 1; -fx-border-style: dashed;");
        public String getOverlayText() {
            return overlayText.getText();
    I want to display a tesselation of these custom hexagons. Because a CustomHexagon is a StackPane, not a Polygon, MouseClick events can be picked up when the mouse is clicked outside of the stroke of the hexagon but still within the StackPane (which takes up a rectangle larger than the hexagon). The following program demonstrates this.
    public class Main extends Application {
        @Override
        public void start(Stage primaryStage) {     
            Group root = new Group();
            CustomHexagon[] hexagons = {
                new CustomHexagon( "00", 10.0, 10.0, 30.0, 10.0, 40.0, 27.3205080756, 30.0, 44.6410161512, 10.0, 44.6410161512, 0.0, 27.3205080756 ),
                new CustomHexagon( "01", 70.0, 10.0, 90.0, 10.0, 100.0, 27.3205080756, 90.0, 44.6410161512, 70.0, 44.6410161512, 60.0, 27.3205080756 ),
                new CustomHexagon( "02", 130.0, 10.0, 150.0, 10.0, 160.0, 27.3205080756, 150.0, 44.6410161512, 130.0, 44.6410161512, 120.0, 27.3205080756 ),
                new CustomHexagon( "03", 190.0, 10.0, 210.0, 10.0, 220.0, 27.3205080756, 210.0, 44.6410161512, 190.0, 44.6410161512, 180.0, 27.3205080756 ),
                new CustomHexagon( "04", 250.0, 10.0, 270.0, 10.0, 280.0, 27.3205080756, 270.0, 44.6410161512, 250.0, 44.6410161512, 240.0, 27.3205080756 ),
                new CustomHexagon( "10", 40.0, 27.3205080756, 60.0, 27.3205080756, 70.0, 44.6410161512, 60.0, 61.961524226799995, 40.0, 61.961524226799995, 30.0, 44.6410161512 ),
                new CustomHexagon( "11", 100.0, 27.3205080756, 120.0, 27.3205080756, 130.0, 44.6410161512, 120.0, 61.961524226799995, 100.0, 61.961524226799995, 90.0, 44.6410161512 ),
                new CustomHexagon( "12", 160.0, 27.3205080756, 180.0, 27.3205080756, 190.0, 44.6410161512, 180.0, 61.961524226799995, 160.0, 61.961524226799995, 150.0, 44.6410161512 ),
                new CustomHexagon( "13", 220.0, 27.3205080756, 240.0, 27.3205080756, 250.0, 44.6410161512, 240.0, 61.961524226799995, 220.0, 61.961524226799995, 210.0, 44.6410161512 ),
                new CustomHexagon( "14", 280.0, 27.3205080756, 300.0, 27.3205080756, 310.0, 44.6410161512, 300.0, 61.961524226799995, 280.0, 61.961524226799995, 270.0, 44.6410161512 ),
                new CustomHexagon( "20", 10.0, 44.6410161512, 30.0, 44.6410161512, 40.0, 61.961524226799995, 30.0, 79.2820323024, 10.0, 79.2820323024, 0.0, 61.961524226799995 ),
                new CustomHexagon( "21", 70.0, 44.6410161512, 90.0, 44.6410161512, 100.0, 61.961524226799995, 90.0, 79.2820323024, 70.0, 79.2820323024, 60.0, 61.961524226799995 ),
                new CustomHexagon( "22", 130.0, 44.6410161512, 150.0, 44.6410161512, 160.0, 61.961524226799995, 150.0, 79.2820323024, 130.0, 79.2820323024, 120.0, 61.961524226799995 ),
                new CustomHexagon( "23", 190.0, 44.6410161512, 210.0, 44.6410161512, 220.0, 61.961524226799995, 210.0, 79.2820323024, 190.0, 79.2820323024, 180.0, 61.961524226799995 ),
                new CustomHexagon( "24", 250.0, 44.6410161512, 270.0, 44.6410161512, 280.0, 61.961524226799995, 270.0, 79.2820323024, 250.0, 79.2820323024, 240.0, 61.961524226799995 ),
                new CustomHexagon( "30", 40.0, 61.961524226799995, 60.0, 61.961524226799995, 70.0, 79.2820323024, 60.0, 96.602540378, 40.0, 96.602540378, 30.0, 79.2820323024 ),
                new CustomHexagon( "31", 100.0, 61.961524226799995, 120.0, 61.961524226799995, 130.0, 79.2820323024, 120.0, 96.602540378, 100.0, 96.602540378, 90.0, 79.2820323024 ),
                new CustomHexagon( "32", 160.0, 61.961524226799995, 180.0, 61.961524226799995, 190.0, 79.2820323024, 180.0, 96.602540378, 160.0, 96.602540378, 150.0, 79.2820323024 ),
                new CustomHexagon( "33", 220.0, 61.961524226799995, 240.0, 61.961524226799995, 250.0, 79.2820323024, 240.0, 96.602540378, 220.0, 96.602540378, 210.0, 79.2820323024 ),
                new CustomHexagon( "34", 280.0, 61.961524226799995, 300.0, 61.961524226799995, 310.0, 79.2820323024, 300.0, 96.602540378, 280.0, 96.602540378, 270.0, 79.2820323024 ),
                new CustomHexagon( "40", 10.0, 79.2820323024, 30.0, 79.2820323024, 40.0, 96.602540378, 30.0, 113.9230484536, 10.0, 113.9230484536, 0.0, 96.602540378 ),
                new CustomHexagon( "41", 70.0, 79.2820323024, 90.0, 79.2820323024, 100.0, 96.602540378, 90.0, 113.9230484536, 70.0, 113.9230484536, 60.0, 96.602540378 ),
                new CustomHexagon( "42", 130.0, 79.2820323024, 150.0, 79.2820323024, 160.0, 96.602540378, 150.0, 113.9230484536, 130.0, 113.9230484536, 120.0, 96.602540378 ),
                new CustomHexagon( "43", 190.0, 79.2820323024, 210.0, 79.2820323024, 220.0, 96.602540378, 210.0, 113.9230484536, 190.0, 113.9230484536, 180.0, 96.602540378 ),
                new CustomHexagon( "44", 250.0, 79.2820323024, 270.0, 79.2820323024, 280.0, 96.602540378, 270.0, 113.9230484536, 250.0, 113.9230484536, 240.0, 96.602540378 )
            EventHandler<MouseEvent> mouseClickedHandler = new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent t) {
                    CustomHexagon h = (CustomHexagon) t.getSource();
                    System.out.println( h.getOverlayText() );
            for ( CustomHexagon hexagon : hexagons ) {
                hexagon.setOnMouseClicked( mouseClickedHandler );
            root.getChildren().addAll( hexagons );
            Scene scene = new Scene(root, 400, 400);
            primaryStage.setTitle("Example");
            primaryStage.setScene(scene);
            primaryStage.show();
        public static void main(String[] args) {
            launch(args);
    After running this program, when one clicks within the intersection of two StackPanes (borders shown by dashed lines), the target of the mouse click event will be the StackPane on top as determined by the order in which they were added to their parent.
    This is a problem because there is only a small "T" shaped area within each hexagon that when clicked will target that hexagon with an event, rather than adjacent nodes.
    I would appreciate any reccomendations to solve this problem.
    Thanks,
    James Giller

    Hello, this is an evergreen. Just call setPickOnBounds(false) on the CustomHexagon.
    An issue tracking this problem is open here: https://javafx-jira.kenai.com/browse/RT-17024

  • OnMouseClicked event handler not working

    I'm currently playing with Netbeans 7.0 and JavaFX 2.0-beta (Java 1.6.0_26, OS Windows XP) and noticed, that the onMouseClicked event handler doesn't seem to work properly.
    I added one to the scene but it got triggered only very sporadical, when I hit the mouse button several times really fast. The onMousePressed and onMouseReleased handlers on the other side work as expected.
    I also tried adding a click event handler to other nodes like a Rectangle or a Pane but it's always the same behaviour.
    Is this a (known) bug or limitation of the beta release or am I missing something here?
    Here is a a short example:
    public void start(Stage primaryStage) {
            primaryStage.setTitle("JavaFX");
            final BorderPane root = new BorderPane();
            final Scene scene = new Scene(root, 800, 600, Color.BLACK);
            scene.setOnMouseClicked(new EventHandler<MouseEvent>() {
                public void handle(MouseEvent event) {
                    System.out.println("click");
            primaryStage.setScene(scene);
            primaryStage.centerOnScreen();
            primaryStage.setVisible(true);
    }Regards,
    Kai
    Edited by: 865264 on 11.06.2011 13:29 (thanks for the tip, Darryl)

    To get better help sooner, post a SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
    Don't forget to read the announcements at the top of the forum listing and the FAQ linked from every page so you'll know how to format your code correctly.

  • Drag event handling in JFXPanel has performance implications with expensive event handlers

    We have a drag event handler that is a little expensive, takes something like 20ms. The respective code must be run in a synchronous manner however.
    That is no problem in a pure JavaFX environment, as less drag events are created when CPU load is high.
    However, when embedded into Swing using JFXPanel this adaptation doesn't kick in, lots of drag events are created and the application becomes sluggish.
    Is there a way to mimic what JavaFX does in the JFXPanel scenario?
    The code below is a self-contained example that demonstrates what I'm describing.
    Some results I had:
    -eventHandlerSleep=5 -noswing --> 128 drag events
    -eventHandlerSleep=30 -noswing --> 46 drag events
    -eventHandlerSleep=5  --> 136 drag events
    -eventHandlerSleep=30  --> 135 drag events
    {code}import java.util.Arrays;
    import javax.swing.*;
    import com.sun.glass.ui.Robot;
    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.embed.swing.JFXPanel;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.BorderPane;
    import javafx.stage.Stage;
    public class DragHandlingTester {
        private static long EVENT_HANDLER_SLEEP = 30;
        public static void main(String[] args) {
            for (String arg : args) {
                if (arg.startsWith("-eventHandlerSleep=")) {
                    EVENT_HANDLER_SLEEP = Long.parseLong(arg.split("=")[1]);
            if (Arrays.asList(args).contains("-noswing")) {
                Application.launch(JavaFXDragHandlingTestApp.class, args);
            } else {
                new SwingDragHandlingTestApp();
        static class SwingDragHandlingTestApp {
            SwingDragHandlingTestApp() {
                JFrame frame = new JFrame();
                final JFXPanel fxMainPanel = new JFXPanel();
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        DragTestScene dragTestScene = new DragTestScene();
                        fxMainPanel.setScene(dragTestScene.createScene());
                frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                frame.getContentPane().add(fxMainPanel);
                frame.setSize(800, 600);
                frame.setVisible(true);
        public static class JavaFXDragHandlingTestApp extends Application {
            @Override
            public void start(Stage primaryStage) {
                primaryStage.setWidth(800);
                primaryStage.setHeight(600);
                primaryStage.setX(0.0);
                primaryStage.setY(0.0);
                DragTestScene dragTestScene = new DragTestScene();
                primaryStage.setScene(dragTestScene.createScene());
                primaryStage.show();
        static class DragTestScene {
            private int drags = 0;
            public Scene createScene() {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            // after 1 second drag mouse across window
                            Thread.sleep(1000);
                            Robot robot = com.sun.glass.ui.Application.GetApplication().createRobot();
                            robot.mouseMove(50, 50);
                            robot.mousePress(1);
                            for (int i = 20; i &lt; 700; i = i + 5) {
                                robot.mouseMove(i, 50);
                                Thread.sleep(10);
                            robot.mouseRelease(1);
                        } catch (Exception e) {
                            e.printStackTrace();
                }).start();
                BorderPane borderPane = new BorderPane();
                borderPane.setOnMouseDragged(new EventHandler() {
                    @Override
                    public void handle(MouseEvent mouseEvent) {
                        drags++;
                        try {
                            Thread.sleep(EVENT_HANDLER_SLEEP);
                        } catch (InterruptedException ignored) {
                        System.out.println("Number of drag events: " + drags);
                return new Scene(borderPane);
    {code}

    Ok, I expected something like this to be the reason. We'll probably have to live with it.
    My workaround right now is to use background tasks with an executor that has a single element queue handling the events in order, but rejecting any additional events as long as there is a queued event.
    Still not the same performance as in JavaFX, but at least it's usable now.

  • Issue with a class extending EventHandler MouseEvent

    Hello all,
    I originally had a nested class that was a used for mouseEvents. I wanted to make this it's own class, so I can call it directly into other class objects I have made, but for some reason it isn't working and I'm getting an eror
    here is the code:
    public class MouseHandler implements EventHandler<MouseEvent>
        private double sceneAnchorX;
        private double sceneAnchorY;
        private double anchorAngle;
        private Parent parent;
        private final Node nodeToMove ;
       MouseHandler(Node nodeToMove)
           this.nodeToMove = nodeToMove ;
        @Override
        public void handle(MouseEvent event)
          if (event.getEventType() == MouseEvent.MOUSE_PRESSED)
            sceneAnchorX = event.getSceneX();
            sceneAnchorY = event.getSceneY();
            anchorAngle = nodeToMove.getRotate();
            event.consume();
          else if (event.getEventType() == MouseEvent.MOUSE_DRAGGED)
              if(event.isControlDown())
                  nodeToMove.setRotationAxis(new Point3D(sceneAnchorY,event.getSceneX(),0));
                  nodeToMove.setRotate(anchorAngle + sceneAnchorX -  event.getSceneX());
                  sceneAnchorX = event.getSceneX();
                  sceneAnchorY = event.getSceneY();
                  anchorAngle = nodeToMove.getRotate();
                  event.consume();
              else
                double x = event.getSceneX();
                double y = event.getSceneY();
                nodeToMove.setTranslateX(nodeToMove.getTranslateX() + x - sceneAnchorX);
                nodeToMove.setTranslateY(nodeToMove.getTranslateY() + y - sceneAnchorY);
                sceneAnchorX = x;
                sceneAnchorY = y;
                event.consume();
          else if(event.getEventType() == MouseEvent.MOUSE_CLICKED)
            //  nodeToMove.setFocusTraversable(true);
               nodeToMove.requestFocus();
               event.consume();
                         nodeToMove.setOnKeyPressed((KeyEvent)
    ->{
         if(KeyCode.UP.equals(KeyEvent.getCode()))
             nodeToMove.setScaleX(nodeToMove.getScaleX()+ .1);
             nodeToMove.setScaleY(nodeToMove.getScaleY()+ .1);
             nodeToMove.setScaleZ(nodeToMove.getScaleZ()+ .1);
             System.out.println("kaw");
             KeyEvent.consume();
         if(KeyCode.DOWN.equals(KeyEvent.getCode()))
             if(nodeToMove.getScaleX() > 0.15)
             nodeToMove.setScaleX(nodeToMove.getScaleX()- .1);
             nodeToMove.setScaleY(nodeToMove.getScaleY()- .1);
             nodeToMove.setScaleZ(nodeToMove.getScaleZ()- .1);
             System.out.println(nodeToMove.getScaleX());
             KeyEvent.consume();
         nodeToMove.setOnScroll((ScrollEvent)
                 ->{
             if(nodeToMove.isFocused())
                        if(ScrollEvent.getDeltaY() > 0)
                            nodeToMove.setTranslateZ(10+nodeToMove.getTranslateZ());
                        else
                            nodeToMove.setTranslateZ(-10+nodeToMove.getTranslateZ());
           ScrollEvent.consume();
    }This is the class where I call it.
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.Pane;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.PhongMaterial;
    import javafx.scene.shape.Box;
    * @author Konrad
    public class Display extends Pane
        Box b;
        PhongMaterial pm = new PhongMaterial(Color.GRAY);
        public Display(Double x, Double y,Double width, Double height)
             super();
             b = new Box(width, height,10);
             setPrefSize(width,height);
             relocate(x, y);
             b.setMaterial(pm); 
             b.addEventFilter(MouseEvent.ANY, new MouseHandler(this));
             getChildren().add(b);
    }There is no red dot stating the class doesn't exist, or anything is wrong, but when I run it I get an error.
    here is the error:
    C:\Users\Konrad\Documents\NetBeansProjects\3D\src\3d\Display.java:29: error: cannot find symbol
             b.addEventFilter(MouseEvent.ANY, new MouseHandler(this));
      symbol:   class MouseHandler
      location: class DisplayThis is another class from the one that it was originally "nested" in(sorry if I'm not using correct terms). The other class, as well as this, produce the same error(this one was just smaller and eaiser to use as an example).
    The code is exactly the same.
    Originally I thought that the MouseEvent class wasn't an FX class, so I switched it and thought it worked, tried it on the Display class it didn't, tried it on the first one and yeah still didn't, so not too sure what happened there :(.
    Thanks,
    ~KZ
    Edited by: KonradZuse on Jun 7, 2013 12:15 PM
    Edited by: KonradZuse on Jun 7, 2013 12:38 PM
    Edited by: KonradZuse on Jun 7, 2013 12:39 PM

    Last time that was the issue I was having for a certain case; however this seems to be different, here is the list of imports for each class.
    MouseHandler:
    import javafx.event.EventHandler;
    import javafx.geometry.Point3D;
    import javafx.scene.Node;
    import javafx.scene.Parent;
    import javafx.scene.input.KeyCode;
    import javafx.scene.input.MouseEvent;Display:
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.Pane;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.PhongMaterial;
    import javafx.scene.shape.Box;draw:
    import java.io.File;
    import java.sql.*;
    import javafx.application.Application;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.event.ActionEvent;
    import javafx.geometry.Rectangle2D;
    import javafx.scene.Group;
    import javafx.scene.PerspectiveCamera;
    import javafx.scene.PointLight;
    import javafx.scene.Scene;
    import javafx.scene.control.Label;
    import javafx.scene.control.ListCell;
    import javafx.scene.control.ListView;
    import javafx.scene.control.Menu;
    import javafx.scene.control.MenuBar;
    import javafx.scene.control.MenuItem;
    import javafx.scene.control.TextField;
    import javafx.scene.input.ClipboardContent;
    import javafx.scene.input.DataFormat;
    import javafx.scene.input.DragEvent;
    import javafx.scene.input.Dragboard;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.TransferMode;
    import javafx.scene.layout.GridPane;
    import javafx.scene.layout.Pane;
    import javafx.scene.paint.Color;
    import javafx.scene.paint.PhongMaterial;
    import javafx.scene.shape.TriangleMesh;
    import javafx.stage.FileChooser;
    import javafx.stage.FileChooser.ExtensionFilter;
    import javafx.stage.Screen;
    import javafx.stage.Stage;
    import javafx.stage.StageStyle;
    import jfxtras.labs.scene.control.window.Window;
    import org.controlsfx.dialogs.Action;
    import org.controlsfx.dialogs.Dialog;Edited by: KonradZuse on Jun 7, 2013 2:27 PM
    Oddly enough I tried it again and it worked once, but the second time it error-ed out again, so I'm not sure what the deal is.
    then I ended up getting it to work again in the draw class only but when I tried to use the event I get this error.
    J a v a M e s s a g e : 3 d / M o u s e H a n d l e r
    java.lang.NoClassDefFoundError: 3d/MouseHandler
         at shelflogic3d.draw.lambda$5(draw.java:331)
         at shelflogic3d.draw$$Lambda$16.handle(Unknown Source)
         at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
         at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
         at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
         at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
         at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
         at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
         at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
         at javafx.event.Event.fireEvent(Event.java:202)
         at javafx.scene.Scene$DnDGesture.fireEvent(Scene.java:2824)
         at javafx.scene.Scene$DnDGesture.processTargetDrop(Scene.java:3028)
         at javafx.scene.Scene$DnDGesture.access$6500(Scene.java:2800)
         at javafx.scene.Scene$DropTargetListener.drop(Scene.java:2771)
         at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler$3.run(GlassSceneDnDEventHandler.java:85)
         at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler$3.run(GlassSceneDnDEventHandler.java:81)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.javafx.tk.quantum.GlassSceneDnDEventHandler.handleDragDrop(GlassSceneDnDEventHandler.java:81)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleDragDrop(GlassViewEventHandler.java:595)
         at com.sun.glass.ui.View.handleDragDrop(View.java:664)
         at com.sun.glass.ui.View.notifyDragDrop(View.java:977)
         at com.sun.glass.ui.win.WinDnDClipboard.push(Native Method)
         at com.sun.glass.ui.win.WinSystemClipboard.pushToSystem(WinSystemClipboard.java:234)
         at com.sun.glass.ui.SystemClipboard.flush(SystemClipboard.java:51)
         at com.sun.glass.ui.ClipboardAssistance.flush(ClipboardAssistance.java:59)
         at com.sun.javafx.tk.quantum.QuantumClipboard.flush(QuantumClipboard.java:260)
         at com.sun.javafx.tk.quantum.QuantumToolkit.startDrag(QuantumToolkit.java:1277)
         at javafx.scene.Scene$DnDGesture.dragDetectedProcessed(Scene.java:2844)
         at javafx.scene.Scene$DnDGesture.process(Scene.java:2905)
         at javafx.scene.Scene$DnDGesture.access$8500(Scene.java:2800)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3564)
         at javafx.scene.Scene$MouseHandler.process(Scene.java:3379)
         at javafx.scene.Scene$MouseHandler.access$1800(Scene.java:3331)
         at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1612)
         at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2399)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:312)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:237)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:354)
         at com.sun.glass.ui.View.handleMouseEvent(View.java:514)
         at com.sun.glass.ui.View.notifyMouse(View.java:877)
         at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
         at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
         at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:101)
         at java.lang.Thread.run(Thread.java:724)
    Caused by: java.lang.ClassNotFoundException: shelflogic3d.MouseHandler
         at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
         at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:353)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
         ... 50 more
    Exception in thread "JavaFX Application Thread" E..........After the E comes a bunch of random stuff with drag and drop and such (since I'm dragging an item, and then creating it and giving it the event in question).
    Line 331 is                      b.addEventHandler(MouseEvent.ANY, new MouseHandler(b));

  • Skins that effect the host component behaviour.

    There was an interesting question that was raised in the pre-release forums about what is the appropriate way to handle animations between the skin and its host. Basically the issue was if there is an animation in the host and another in the skin what would be the best way to code it so that both animations ran in parallel, My thoughts are why not do it all in the skin. this example animates a container by resizing it and centering it in the application.
    I figured it would be an interesting topic for those that are trying adding extra component functionality into the skin.
    @PD - Maybe you could apply a little of your magic to something like this and add it your blog.
    David
    The App
    =============================================================
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/halo"
      creationComplete="application1_creationCompleteHandler(event)" width="100%" height="100%">
    <s:layout>
    <s:BasicLayout/>
    </s:layout>
    <fx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.events.FlexEvent;
    protected function application1_creationCompleteHandler(event:FlexEvent):void
    menu1.verticalCenter=height/2*-1 + 35; 
    menu1.horizontalCenter=width/2*-1 + 110;
    ]]>
    </fx:Script>
    <s:SkinnableContainer id="menu1" left="10" top="10" width="200" height="50"
    skinClass="SkinnableContainerSkin2" backgroundColor="#A16969">
    </s:SkinnableContainer>
    </s:Application>
    =============================================================
    The Skin
    =============================================================
    <?xml version="1.0" encoding="utf-8"?>
    <s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:fb="http://ns.adobe.com/flashbuilder/2009" alpha.disabled="0.5" creationComplete="skin1_creationCompleteHandler(event)">
    <fx:Declarations>
    <s:Parallel id="sizer">
    <s:Animate target="{hostComponent}" duration="2000" repeatCount="1">
    <s:SimpleMotionPath id="setheight" property="height" valueTo="500"/>
    </s:Animate>
    <s:Animate target="{hostComponent}" duration="2000" repeatCount="1">
    <s:SimpleMotionPath id="setvertical" property="verticalCenter" valueTo="0"/>
    </s:Animate>
    <s:Animate target="{hostComponent}" duration="2000" repeatCount="1">
    <s:SimpleMotionPath id="sethorizontal" property="horizontalCenter" valueTo="0"/>
    </s:Animate>
    </s:Parallel>
    </fx:Declarations>
    <fx:Metadata>
        <![CDATA[
            [HostComponent("spark.components.SkinnableContainer")]
        ]]>
        </fx:Metadata>
        <fx:Script fb:purpose="styling">
            <![CDATA[       
    import mx.events.FlexEvent;
    import mx.core.FlexGlobals;
    private var Vert:int;
    private var Horz:int;
                override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number) : void
                    bgFill.color = getStyle("backgroundColor");
                    bgFill.alpha = getStyle("backgroundAlpha");
                    super.updateDisplayList(unscaledWidth, unscaledHeight);
    protected function resizeMe(e:MouseEvent): void
    Vert = int(FlexGlobals.topLevelApplication.contentGroup.height/2*-1)+35;
    Horz = int(FlexGlobals.topLevelApplication.contentGroup.width/2*-1)+110;
    if (hostComponent.height < 51)
    setheight.valueTo=500;
    setvertical.valueTo=0;
    sethorizontal.valueTo=0;
    else
    setheight.valueTo=50;
    setvertical.valueTo=Vert;
    sethorizontal.valueTo=Horz;
    sizer.play();
    protected function skin1_creationCompleteHandler(event:FlexEvent):void
    Vert = int(FlexGlobals.topLevelApplication.contentGroup.height/2*-1);
    Horz = int(FlexGlobals.topLevelApplication.contentGroup.width/2*-1);
            ]]>       
        </fx:Script>
        <s:states>
            <s:State name="normal" />
            <s:State name="disabled" />
        </s:states>
        <s:Rect left="0" right="0" top="0" bottom="0">
            <s:fill>
                <s:SolidColor id="bgFill" color="0x00DDDD"/>
            </s:fill>
        </s:Rect>
        <s:Group id="contentGroup" left="0" right="0" top="0" bottom="0" minWidth="0" minHeight="0" click="resizeMe(event)">
            <s:layout>
                <s:BasicLayout/>
            </s:layout>
        </s:Group>
    </s:Skin>

    This is a good question.
    There's no hard and fast rule to apply which says "this belongs in the skin" vs. "this belongs in the component".  Similarly, there are also no hard and fast rules around when to use a the new skinning architecture vs. just creating a custom component.  Just do whatever you feel comfortable with and makes your job easier.  At the end of the day, it's about productivity and not living up to ideals.  That said, there are probably some easier and more logical ways to do some things.
    On the skinning architecture vs. custom component debate, with a SkinnableComponent we have a clear separation of the component properties and behavior on one side and the look and feel of the component on the Skin side.  Also, there's a clear contract we use to talk back and forth to one another.  The reason for the separation between the Skin and the SkinnableComponent is so that we can have one Button SkinnableComponent and multiple Skins for that Button which all tweak the visual appearance of it.
    It doesn't make sense for every component to be skinnable.  If you know what your component is going to be and look like and don't need the extra flexibility skinning provides, then you can get rid of the extra overhead that skinning requires (like having 2 classes).  An example custom component is:
    <s:Group>
    <s:Rect>
    </s:Rect>
    <mx:Image src="..." />
    <s:Panel skinClass="myCustomSkinClass">
    </s:Panel>
    </s:Group>
    If you want more flexibility and want the ability to easily change the look and feel of the component (i.e. skin it), then you'd extend SkinnableComponent, fill out the skinning lifecycle methods, and create a default Skin for its appearance.
    Now, when you're building a SkinnableComponent, there's always a question of what to put in the component vs. what to put in the skin.  In general, we try to put the core properties and behaviors in the component and anything visual in the skin.  However, another guideline to consider is whether all skins would want this behavior.  If so, then it makes sense (and makes your life easier) to put it in the SkinnableComponent rather than the Skin.  We do this in the framework for components like VSlider, where the logic for positioning the y-axis of the thumb is in the component and not the skin, even though it's a "visual" thing.  We also have discussed how we would build up a ColorPicker component, and I think the way we would go about it is by putting a lot of the "visual" logic in the component because otherwise we'd have to duplicate it across all skins.
    Now, the other question you guys are asking here are "when do I bake effects (or any behavior) in to the component (either in the skin or in the SkinnableComponent AS class) vs. when do I declare effects alongside the component".  Again, I think the answer to that is whether you want all your components to have this behavior.  If that was the case, then I'd lose no sleep baking it in to the component.  However, if it's not the case, then I'd make the end-developer delcare it when they use your component, like:
    <s:MyCustomComponent id="myComponent" />
    <s:Resize id="resizer" widthTo="100" heightTo="50" target="{myComponent}"/>
    I would think most of the time, you probably wouldn't want to bake an effect like that in to the component, especially because it has some sizing information on it.  However, we have some effects baked in to some of the framework components, like when the thumb of a Slider moves around due to someone clicking on the track.  I think it's fine that it's baked in to the component, but I do think it should probably be stylable so that a user can customize it (that's on our list of lower-priority things to do btw).
    The framework has definitely evolved.  I think we started out with a more purist attitude and wanted a clear separation between the skin and the component.  However, as we built out components, we realized it's not always practical to do that.  Similarly, we wanted our skins to be pure MXML; however, for usability reasons, we decided that our skins should be styleable, and that requires a little bit of ActionScript code.  Border is a great example where it doesn't really follow a lot of these guidelines, but it's just a styleable component; however, this component makes other people's jobs easier.  At the end of the day, it's about productivity and usability, and hopefully the Spark architecture is a step in the right direction.
    Anyways, I hope that helps some.  These are just some guidelines.  As people play around with the architecture more, I'm sure some other people will have some good advice to share as well.
    -Ryan

  • Problem adding elements to a group after removing everything...

    Hi everyone,
    I would really appreciate some help on something. I have a Group that has some Buttons in it. This Group is in one of fours States, and there is a componant for each State. After the user goes through the rest of the program and comes back to this State, I want to remove the old buttons, and add new buttons with new values. Bascially, I want to refresh the componant when it is visited a second time. I have a problem adding new Buttons to the group when the user revisits the componant / state.
    The group is created:
              <s:VGroup id="buttons"  x="0" y="35"  height="400" width="280" />
    When the init function for that componant is called, buttons are added from an array of buttons:
    for(var i:int = 0; i < 10; i++){
              var button:Button = questions[i];
              trace(button);
              button.addEventListener(MouseEvent.CLICK, myEventHandler);
              trace(buttons);
              buttons.addElement(button);
    When the user moves on to the next State, the buttons are removed:
    if(counter == 4){
              buttons.removeAllElements();
              FlexGlobals.topLevelApplication.currentState = 'Summary';
    When the user comes back to the initial state, the buttons are not added to the Group like they are the first time. The output of the trace as each button is added is also different the second time:
    First time: (successful)
    Main.MainBackground2.contentGroup.gameComp.buttons
    button8
    Second time:
    buttons
    button8
    Can anyone point me in the right direction? And better question, is there a better way I should be doing this?
    Is there a better way to refresh everything within a component upon viewing it s second time?
    Thanks in advance!

    I'm not sure why you are using addElement() to add the buttons. Aren't you supposed to let the state functionality handle when the buttons should be visible? That's the cleanest way to do it in most cases. You may want to post a larger code sample, where you have boiled down the code into a minimal sample that still enhibits the issue.
    If this post answers your question or helps, please mark it as such.
    Greg Lafrance - Flex 2 and 3 ACE certified
    www.ChikaraDev.com
    Flex Training and Support Services

  • Does anyone have an example to share of using a variable in a proc call?

    I would like to use a value from a table to call a procedure in ActionScript. Can anyone share an example with me? TIA,
    Deb.
    (For example
      var proc_name_from_table:String;
       var command_proc:String;
      command_proc="mx.core.FlexGlobals.TopLevelApplication." + proc_name_from_table;
      command;
    Or something like that (just to give you an idea where I am heading).
    It is for a site map application that gets values from a table and I don't want to write a huge if statement with specific, hard-coded calls.)

    You have to use the Call Library Function Node to call Windows API functions. The animatewindow function itself has some pretty simple parameters. You first need to get the window handle. There are a set of Windows API Function Utilities (32-bit) for LabVIEW that you can use. In there there is a VI (Get Window Refnum) that gets the window handle. It's a simple call to a Windows API function. You would call the animatewindow function in the same way. In this case there are 3 parameters: the window handle (returned by a FindWindow API call), a DWORD (32-bit integer) for the duration, and another DWORD for the flags.

  • ItemEditEnd hell - event fires gazillion times

    Well I was making great progress with my first major flex app when I hit a wall. The last element I put in place was to enable user to edit one column in a datagrid. Before I send the changes back to a web service I thought I would confirm that it is firing correctly and passing correct values. To my surprise the event fires over and over again. I believe its something to do with the use of the accordian and multiple canvases. Sorry but this is happening on both flex 3 and 4 platforms (its worse in 4 for some reason). I have not had a chance to scale down the project and simply it so apologies if the code is lenghty.
    Any ideas how to solve this?
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   creationPolicy= "all">
        <fx:Declarations>
                <mx:WebService
                id="nwCL2"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchRequestAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <IncRecItems>{IncRecItems}</IncRecItems>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <AgeItems>{AgeItems}</AgeItems>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL3"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchDirectPOAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler3(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <IncRecItems>{IncRecItems}</IncRecItems>
                        <AgeItems>{AgeItems2}</AgeItems>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL4"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="FetchDirectPODELAsTableToArray"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler4(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL5"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="SendMailMessage"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler5(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <from>
                            {from}
                        </from>
                        <recepient>
                            {recepient}
                        </recepient>
                        <bcc>
                            {bcc}
                        </bcc>
                        <cc>
                            {cc}
                        </cc>
                        <subject>
                            {subject}
                        </subject>
                        <body>
                            {myEmailBody}
                        </body>
                        <CallProc>
                            {CallProc}
                        </CallProc>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            <mx:WebService
                id="nwCL6"
                wsdl="http://finance-web/BannerWebServices/BannerService.asmx?WSDL">
                <mx:operation name="InsRecordFYPOAUD"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler6(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <myuserID>{myuserID}</myuserID>
                        <DocCode>{DocCode}</DocCode>
                    </mx:request>
                </mx:operation>
                <mx:operation name="DelRecordFYPOAUD"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler6(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                        <DocCode>{DocCode}</DocCode>
                    </mx:request>
                </mx:operation>
                <mx:operation name="FetchUserID"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler7(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
                <mx:operation name="InsGUIDAudit"
                              resultFormat="object"
                              showBusyCursor="true"
                              result="resultHandler8(event)"
                              fault="onFault(event)">
                    <mx:request>
                        <PmyGUID>{myGUID}</PmyGUID>
                    </mx:request>
                </mx:operation>
            </mx:WebService>
            </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.collections.IViewCursor;
                import mx.controls.Alert;
                import mx.controls.ToolTip;
                import mx.controls.dataGridClasses.DataGridColumn;
                import mx.controls.dataGridClasses.DataGridItemRenderer;
                import mx.core.mx_internal;
                import mx.events.DataGridEvent;
                import mx.events.ListEvent;
                import mx.rpc.events.FaultEvent;
                import mx.rpc.events.ResultEvent;
                //added after upgrading to flex 4
                import mx.core.FlexGlobals;
                import mx.controls.RichTextEditor
                //import flash.events.Event;
                [Bindable] public var IncRecItems:String;
                [Bindable] public var myGUID:String;
                [Bindable] public var myData:ArrayCollection;
                [Bindable]public var serverData:ArrayCollection; 
                [Bindable]public var serverData3:ArrayCollection;
                [Bindable]public var serverData4:ArrayCollection;
                [Bindable]public var serverData5:ArrayCollection;    
                [Bindable] public var IncRecItems3:String;
                [Bindable] public var from:String;
                [Bindable] public var recepient:String;
                [Bindable] public var bcc:String;
                [Bindable] public var cc:String;
                [Bindable] public var subject:String;
                [Bindable] public var body:String;
                [Bindable] public var CallProc:String;
                [Bindable] public var myEmailBody:String;
                [Bindable] public var myuserID:String;
                [Bindable] public var DocCode:String;
                [Bindable] public var AgeItems:String;
                [Bindable] public var AgeItems2:String;
                [Bindable] public var DocItem:Number;
                [Bindable] public var DocText:String;
                //this adds event listener for mouse over event so I can display descriptive text about various columns values
                //POFromRequest.addEventListener(ListEvent.ITEM_ROLL_OVER, declarePosition);
                //USE ROLLOVER VERSUS MOUSEOVER EVENT AS THE LATTER CAUSES BLINKING
                private function createToolTip(event:ListEvent):void {
                //var col:DataGridColumn = POFromRequest.columns[event.columnIndex];
                //var newValue:String = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                if (event.columnIndex==13)
                var str:String =  "P-Y=Paid and Completed" + "\r"  + "O-Y=Open and Completed" + "\r"  + "O-R=Open and Unmatched" ;
                //this code works and will fetch active mouse over datagrid values!           
                var col:DataGridColumn = POFromRequest.columns[event.columnIndex];
                var newValue:String = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                else if (event.columnIndex==21||event.columnIndex==22)
                var col21:DataGridColumn = POFromRequest.columns[21];
                var col22:DataGridColumn = POFromRequest.columns[22];
                var Value21:Number = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col21.dataField];
                var Value22:Number = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col22.dataField];
                //21=Bal not Rec(BNR);22=Bal not Inv(BNI)
                //evaluate BNR/BNI and give approp message which represents
                //action required by end user (ie they don't have to think!)
                var str:String
                if (Value21>0 && Value22<=0)
                str = "Case1:All invoices sent to AP but we are missing a receiving. Please contact receiving.";
                else if(Value21>0 && Value22>0)
                str = "Case2:We are missing invoices and receiving. Please contact both departments ASAP.";
                else if(Value21<=0 && Value22>0)
                str = "Case3:All receiving completed but we are missing invoices. Please contact AP and forward any invoices to them ASAP.";
                else if(Value21==0 && Value22==0)
                str = "Case4:All documents received. No action required. You can hide these items by clicking/turning off the box:Include Balance of 0 Items? ";
                //var str:String = Value21.toString()+Value22.toString()
                else
                //var str:String = "Row :"  +event.rowIndex + "Column : " +event.columnIndex;
                POFromRequest.toolTip = str;
                private function deleteToolTip(obj:Object):void {
                POFromRequest.toolTip = null;
                //start mouse over code for directPO datagrid
                private function createToolTip2(event:ListEvent):void {
                //var col:DataGridColumn = DirectPOGrid.columns[event.columnIndex];
                //var newValue:String = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                if (event.columnIndex==1)
                var str:String =  "If you know for sure that this item is not yours then highlight item by left clicking, then hit the delete button below. Hold the ctrl key to select multiple items." ;               
                if (event.columnIndex==12)
                var str:String =  "P-Y=Paid and Completed" + "\r"  + "O-Y=Open and Completed" + "\r"  + "O-R=Open and Unmatched" ;
                //this code works and will fetch active mouse over datagrid values!           
                var col:DataGridColumn = DirectPOGrid.columns[event.columnIndex];
                var newValue:String = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                //Alert.show("You are hovering over:" +newValue);
                else if (event.columnIndex==20||event.columnIndex==21)
                var col20:DataGridColumn = DirectPOGrid.columns[20];
                var col21:DataGridColumn = DirectPOGrid.columns[21];
                var Value20:Number = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col20.dataField];
                var Value21:Number = ArrayCollection(DirectPOGrid.dataProvider).getItemAt(event.rowIndex)[col21.dataField];
                //21=Bal not Rec(BNR);22=Bal not Inv(BNI)
                //evaluate BNR/BNI and give approp message which represents
                //action required by end user (ie they don't have to think!)
                var str:String
                if (Value20>0 && Value21<=0)
                str = "Case1:All invoices sent to AP but we are missing a receiving. Please contact receiving.";
                else if(Value20>0 && Value21>0)
                str = "Case2:We are missing invoices and receiving. Please contact both departments ASAP.";
                else if(Value20<=0 && Value21>0)
                str = "Case3:All receiving completed but we are missing invoices. Please contact AP and forward any invoices to them ASAP.";
                else if(Value20==0 && Value21==0)
                str = "Case4:All documents received. No action required. You can hide these items by clicking/turning off the box:Include Balance of 0 Items? ";
                //var str:String = Value21.toString()+Value22.toString()
                else
                //var str:String = "Row :"  +event.rowIndex + "Column : " +event.columnIndex;
                DirectPOGrid.toolTip = str;
                private function deleteToolTip2(obj:Object):void {
                DirectPOGrid.toolTip = null;
                //end tool tip code
                private function GetData():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                //var MyurlParams:Dictionary = new Dictionary();
                //MyurlParams = getUrlParamaters();
                //myGUID = MyurlParams['myGUID'];
                nwCL2.FetchRequestAsTableToArray.send();
                private function GetData3():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                nwCL3.FetchDirectPOAsTableToArray.send();
                NotifyDel();
                private function GetData4():void
                //IncRecItems = "Y"
                //IncRecItems = "Y"
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                nwCL4.FetchDirectPODELAsTableToArray.send();
                NotifyStatus();
                public function resultHandler(event:ResultEvent):void {
                serverData = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler3(event:ResultEvent):void {
                serverData3 = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler4(event:ResultEvent):void {
                serverData4 = new ArrayCollection(event.result.source);
                //             Alert.show("getdata fired");
                public function resultHandler5(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                var Response:String;
                if(FunctionResult != "Success")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                Alert.show("The email was sent successfully.");
                //             Alert.show("getdata fired");
                public function resultHandler6(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                var Response:String;
                if(FunctionResult != "Success")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                Alert.show("Item moved.");
                //refresh both datagrids for deleted/ins records
                //need to call diff proc which does the same but does not show the initial message box
                ReloadTables()
                public function resultHandler7(event:ResultEvent):void {
                var FunctionResult:String=event.result.toString();
                if(FunctionResult == "Invalid GUID")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                myuserID = FunctionResult;
                myGlobVar.globMyUserID = FunctionResult;
                public function resultHandler8(event:ResultEvent):void {
                //we don't really care about handling this event
                var FunctionResult:String=event.result.toString();
                if(FunctionResult == "Invalid GUID")
                Alert.show("A problem has occurred. " + FunctionResult);
                else
                //myuserID = FunctionResult;
                private function initApp():void
                //code for grabing guid passed from .net ldap authentication page
                //this file is located on finance-web box along with guid database.
                //the web service is also located on finance-web
                //and flex source code is on box fin-selement3 but is saved to U and published to finance-web
                //(this is because flex is installed on fin-selement3 only
                //GurfeedTbl = nwCL.FetchFTVACCTAsTable();
                flash.system.Security.allowDomain("*");flash.system.Security.allowInsecureDomain("*");
                //siteData.send();
                //trace("Hello from Flex Debugging!");
                //Alert.show("Init app fired");
                //first get focus of email tab (if we don't then a bug exists;error on object creation)
                //I have tried various techniques for some reason I can't load back to base 0
                //ac.selectedIndex = 3;
                //Alert.show("Please remember to audit documents on all tabssss!");
                //ac.selectedIndex = 1;
                Alert.show("HardCoded GUID in place. Remove after testing")
                myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //need to set initial value
                AgeItems = "N";
                AgeItems2 = "N";
                myBody.text = "Body";
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                //var MyurlParams:Dictionary = new Dictionary();
                //MyurlParams = getUrlParamaters();
                //myGUID = MyurlParams['myGUID'];
                //Alert.show("HardCoded GUID in place. Remove after testing")
                //myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //insert audit trail record
                nwCL6.InsGUIDAudit.send();
                nwCL6.FetchUserID.send(); //for some reason when this was located inside the proc it was called from it would not
                //set the global variable until after it was required resulting in null error
                //myGlobVar.globMyUserID = myUserID ;
                //Alert.show
                private function checkBoxZero_change(evt:Event):void {
                if(checkBoxZero.selected == true) IncRecItems = "Y" else IncRecItems ="N";
                //Alert.show(IncRecItems.toString())
                GetData() ;
                private function checkBoxAge_change(evt:Event):void {
                //if(checkBoxAge.selected == true) AgeItems = "Y" else AgeItems ="N";
                if(checkBoxAge.selected == true) AgeItems = "N" else AgeItems ="Y";
                GetData() ;
                private function checkBoxAge2_change(evt:Event):void {
                //if(checkBoxAge.selected == true) AgeItems = "Y" else AgeItems ="N";
                if(checkBoxAge2.selected == true) AgeItems2 = "N" else AgeItems2 ="Y";
                GetData3() ;
                private function checkBoxZero3_change(evt:Event):void {
                if(checkBoxZero3.selected == true) IncRecItems3 = "Y" else IncRecItems3 ="N";
                //Alert.show(IncRecItems.toString())
                GetData3() ;
                private function onFault(event:FaultEvent):void {
                Alert.show(event.fault.toString());
                private function RemoveItems():void {
                var selectedItems:Array = DirectPOGrid.selectedItems;
                var listItem:Object;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                //nwCL6.FetchUserID.send();
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                var newValue:String = listItem["PO"].toString()
                //Alert.show(newValue);
                DocCode = listItem["PO"].toString()
                //call proc to set userid was not working here as it was getting fired after so I moved it to initapp
                //nwCL6.FetchUserID.send();
                myuserID = myGlobVar.globMyUserID;
                //myUserID = 'testuser';
                nwCL6.InsRecordFYPOAUD.send();
                //Alert.show("doc:"+DocCode+" guid:"+myGUID+"user:"+myGlobVar.globMyUserID);
                //Alert.show(selectedItems[i][PO].toString());
                private function RemoveItems4():void {
                var selectedItems:Array = DirectPOGridNotMine.selectedItems;
                var listItem:Object;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                var newValue:String = listItem["PO"].toString()
                //Alert.show(newValue);
                //Alert.show(selectedItems[i][PO].toString());
                DocCode = listItem["PO"].toString()
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL6.DelRecordFYPOAUD.send();
                private function NotifyDel():void {
                Alert.show("These PO's were not created from requests and we are only guessing that they might belong to you. If you don't want to see specific PO's then you can remove them. This is done by highlighting items (left clicking on row), then clicking the delete button below. Hold the ctrl key to select multiple items.") ;   
                private function NotifyStatus():void {
                Alert.show("These PO's were not created from requests and are displayed here because you have marked them as not belonging to you. If you have accidentally deleted these and they really belong to you then hit the delete button below to reactivate them.") ;   
                private function POSendEmailAP():void {
                var selectedItems:Array = POFromRequest.selectedItems;
                var listItem:Object;
                var newValue:String;
                var ValEmailTO:String = "[email protected],[email protected]";
                var myString:String;
                var txtBody:String;
                var num:int;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                // emailTO.text = ValEmailTO ;
                txtBody = myBody.text.toString()
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                newValue = listItem["PO"].toString();
                //Alert.show(newValue);
                emailTO.text = ValEmailTO;
                if (emailSUBJECT.text.toString()=="subject")
                emailSUBJECT.text = newValue ;   
                else
                if (emailSUBJECT.text.indexOf(newValue,0)<0)//this ensures that we only show distinct PO values
                emailSUBJECT.text = emailSUBJECT.text.toString()+"/"+newValue ;   
                //code for email body
                if (txtBody=="Body")
                txtBody = "Dear AP/Receiving:" + "\r" + "\r" + "Please note that I have received the following items directly from the vendor(s): " + "\r" + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";
                else
                txtBody = txtBody + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";   
                myBody.text = txtBody;
                //public variable for sending body text to email service in correct format
                //body = txtBody;
                Alert.show("Items copied to email tab.");
                POFromRequest.selectedIndex=-1;
                private function POSendEmailAPDirectStuff():void {
                var selectedItems:Array = DirectPOGrid.selectedItems;
                var listItem:Object;
                var newValue:String;
                var ValEmailTO:String = "[email protected],[email protected]";
                var myString:String;
                var txtBody:String;
                if (selectedItems.length < 1)
                Alert.show("You did not highlight any items. Highlight items by left clicking the mouse. To select multiple items, hold the ctrl key down while left clicking.");
                // emailTO.text = ValEmailTO ;
                txtBody = myBody.text.toString()
                for (var i:int = 0; i < selectedItems.length; i++)
                listItem = selectedItems[i];
                //DirectPOGrid.removeItem(listItem);
                //TargetList.addItem(listItem);
                //var newValue:String = ArrayCollection("selectedItems").getItemAt(i)["PO"];
                newValue = listItem["PO"].toString();
                //Alert.show(newValue);
                emailTO.text = ValEmailTO;
                if (emailSUBJECT.text.toString()=="subject")
                emailSUBJECT.text = newValue ;   
                else
                if (emailSUBJECT.text.indexOf(newValue,0)<0)//this ensures that we only show distinct PO values
                emailSUBJECT.text = emailSUBJECT.text.toString()+"/"+newValue ;   
                //code for email body
                if (txtBody=="Body")
                txtBody = "Dear AP/Receiving:" + "\r" + "\r" + "Please note that I have received the following items directly from the vendor(s): " + "\r" + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";
                else
                txtBody = txtBody + "\r" + listItem["PO"].toString() + " POItem:" + listItem["POItem"].toString() + " " + listItem["CMDDESC"].toString()  + " " + "QTYRCVD:" + listItem["BALNOTRECD"].toString() + " ";   
                myBody.text = txtBody;
                Alert.show("Items copied to email tab.");
                DirectPOGrid.selectedIndex=-1;
                private function ClearEmail():void {
                myBody.text = "Body";
                emailSUBJECT.text = "Subject";
                private function SEmail():void {
                //hardcode until we fetch via guid
                //Alert.show("Insert code to fetch username from guid. For now its hard coded.");
                CallProc = "FLEX"; //This notifies web service so it parses out \r to <p>
                //from = "[email protected]"
                var MyurlParams:Dictionary = new Dictionary();
                MyurlParams = getUrlParamaters();
                myGUID = MyurlParams['myGUID'];
                //myGUID = "c25ef14a-bff4-4e07-bfa5-f9c0725c3fd0";
                //from = myuserID+"@aus.edu";
                from = myGlobVar.globMyUserID+"@aus.edu";
                recepient =  emailTO.text.toString();
                cc = emailCC.text.toString();
                bcc = "[email protected]"
                subject = emailSUBJECT.text.toString();   
                //var stuffToReplace:RegExp = /\r\n|\n\r/g;
                //the key to this function is the /g means global and means to replace ALL instances of search variable!!!
                var stuffToReplace:RegExp = /\r/g;
                //myEmailBody = myEmailBody.replace("\r","*123");
                myEmailBody = myBody.text.replace(stuffToReplace,"*123*");
                //myEmailBody = myBody.text.replace("\r","*\r").toString();
                //myEmailBody = myBody.text ;
                //myEmailBody.replace("\r","*\r");
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL5.SendMailMessage.send();
                private function ReloadTables():void
                //myGUID = "d5ef405a-d64a-489f-8583-38dd087de502"
                nwCL4.FetchDirectPODELAsTableToArray.send();
                nwCL3.FetchDirectPOAsTableToArray.send();    
                private function getUrlParamaters():Dictionary
                var urlParams:Dictionary = new Dictionary();
                if (ExternalInterface.available)
                var fullUrl:String = ExternalInterface.call('eval', 'document.location.href');
                var paramStr:String = fullUrl.split('?')[1];
                if (paramStr != null)
                var params:Array = paramStr.split('&');
                for (var i:int=0; i < params.length; i++)
                var kv:Array = params[i].split('=');
                urlParams[kv[0]] = kv[1];
                else
                    urlParams = FlexGlobals.topLevelApplication.parameters;
                //urlParams = Application.application.parameters;
                    //urlParams = sparks.components.application.parameters;
                return urlParams;
                private function RefData(event:DataGridEvent):void {
                    var dataGrid:DataGrid = event.target as DataGrid;
                    var dsColumnIndex:Number = event.columnIndex;
                    var col:DataGridColumn = dataGrid.columns[dsColumnIndex];
                    var colPO:DataGridColumn = dataGrid.columns[1];
                    var colPOItem:DataGridColumn = dataGrid.columns[5];
                    var colNotes:DataGridColumn = dataGrid.columns[23];
                    var newValue:String = dataGrid.itemEditorInstance[col.editorDataField];
                    var newValue2:String = dataGrid.itemEditorInstance[colNotes.editorDataField];   
                    var dbval:String;
                    var dbvalLen:Number;
                    DocCode = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[colPO.dataField];
                    DocItem = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[colPOItem.dataField ];
                    dbval = ArrayCollection(POFromRequest.dataProvider).getItemAt(event.rowIndex)[col.dataField];
                    if (dbval.length != null)
                    dbvalLen = dbval.length;
                    else
                    dbvalLen = 0;
                    //Alert.show("key=" +myGlobVar.KeyPress)
                    if (newValue2.substr(0,3)!='P00') //this is silly code that is necessary until I sort the whole problem of audit note Dec 2010
                        //When the user hits the tab key the cursor goes to the next line and for some reason assigns PO field value to notes field value
                        //this line of code ignores in that case       
                        //if (dbval==null && newValue2!=null && newValue2!='')
                        //if (newValue2!=null || newValue2!='')
                        //if (newValue2!=null || dbvalLen>=1)
                        Alert.show("grid value" +DocCode+":"+DocItem+"Notes:"+newValue+"colNotes:"+newValue2+"dbvnotes:"+dbval);                
                    //nwCL6.UpdateFYPOAUD.send();
                    //tempCnt
                    //if datagrid edit is true then this will fire       
                    //all the code below is checking if value from datagrid has changed
                    //as compared to value stored in source data so we don't need this in this project
                    //var dsFieldName:String = event.dataField;
                    //var author:VOAuthor = event.itemRenderer.data as VOAuthor;
                    //if (newValue == author[dsFieldName])
                    //    return;
                    //get the new value for the first name or last name
                    //author[dsFieldName] = newValue;
                    //myRemote.saveData(author);
            ]]>
        </fx:Script>
        <mx:Panel title="Auditing of Purchase Order Delivery and Invoicing Status by User:" height="100%" width="100%"
                  creationComplete="initApp()" paddingTop="5" paddingBottom="5" paddingLeft="5" paddingRight="5" fontSize="15" horizontalAlign="left" color="#701193">
            <mx:Accordion id="ac"
                          width="100%"
                          height="100%"
                          selectedIndex="0"
                          historyManagementEnabled="false"  >
                <mx:Canvas width="100%" height="400"  label="Detailed Data for which a PO was issued from a Request" id="POfromReq" backgroundColor="#D2E9DA" color="#A60831">
                    <mx:Button click="GetData()" label="Press to load Data" width="305"></mx:Button>
                    <mx:FormItem label="HeaderWordWrap:" x="335">
                        <mx:CheckBox id="checkBox" selected="true" />
                    </mx:FormItem>
                    <mx:FormItem label="Include Balance of 0 Items?:" x="550">
                        <mx:CheckBox id="checkBoxZero" selected="false" change="checkBoxZero_change(event);"  />
                    </mx:FormItem>
                    <mx:FormItem label="Only Show Items > 30 Days?:" x="850">
                        <mx:CheckBox id="checkBoxAge" selected="true" change="checkBoxAge_change(event);"  />
                    </mx:FormItem>
                    <mx:DataGrid id="POFromRequest"  allowMultipleSelection="true" doubleClickEnabled="true" editable="True" horizontalScrollPolicy="auto" width="3500" height="300" dataProvider="{serverData}" y="36" itemRollOut="deleteToolTip(event)" itemRollOver="createToolTip(event)" itemEditEnd="RefData(event)">
                        <mx:columns>
                            <fx:Array>
                                <mx:DataGridColumn headerText="UserName"  editable="false" dataField="SOURCEREQUESTUSERID" width="100"/>
                                <mx:DataGridColumn headerText="PO" dataField="PO" width="100"/>
                                <mx:DataGridColumn headerText="Vendor" dataField="VENDOR" width="270"/>
                                <mx:DataGridColumn headerText="Po Date" dataField="PO_Date" width="120"/>
                                <mx:DataGridColumn headerText="Ordered QTY (A)" headerWordWrap="{checkBox.selected}" dataField="Ord_Qty" width="120" />
                                <mx:DataGridColumn headerText="PO Item" dataField="POItem" width="100" />
                                <mx:DataGridColumn headerText="Commodity Description" dataField="CMDDESC" width="300"/>
                                <mx:DataGridColumn headerText="PO Unit Price" dataField="POUNITPRICE" width="120"/>
                                <mx:DataGridColumn headerText="Org code" dataField="ACTGORG" width="100"/>
                                <mx:DataGridColumn headerText="Receiving Document" dataField="RECEIVE_DOC_NUM" headerWordWrap="{checkBox.selected}" width="120"/>
                                <mx:DataGridColumn headerText="Received Qty (B)" dataField="RECQTY" width="150"/>
                                <mx:DataGridColumn headerText="Inv Document #" dataField="INVCODE" width="150"/>
                                <mx:DataGridColumn headerText="Vendor Invoice #" dataField="VENDINV" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Status" dataField="INVSTATUS" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Due Date" dataField="DUEDATE" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Date" dataField="VENDORINVDATE" width="120"/>
                                <mx:DataGridColumn headerText="Fund" dataField="FUNDCODE" width="80"/>
                                <mx:DataGridColumn headerText="Account" dataField="ACCT" width="80"/>
                                <mx:DataGridColumn headerText="Org" dataField="ORG" width="80"/>
                                <mx:DataGridColumn headerText="Prg" dataField="PROG" width="80"/>
                                <mx:DataGridColumn headerText="Net Invoiced (C)" headerWordWrap="{checkBox.selected}" dataField="NETINVD" width="130"/>
                                <mx:DataGridColumn headerText="Balance not Received (A-B)" headerWordWrap="{checkBox.selected}" dataField="BALNOTRECD" width="175"/>
                                <mx:DataGridColumn headerText="Balance not Invoiced (B-C)" headerWordWrap="{checkBox.selected}" dataField="BALNOTINVD" width="175"/>
                                <mx:DataGridColumn headerText="Notes" headerWordWrap="{checkBox.selected}" dataField="NOTES" width="300"/>
                            </fx:Array>
                        </mx:columns>
                    </mx:DataGrid>
                    <mx:List id="square"  visible="false" x="298" y="266"></mx:List>
                    <mx:Button click="POSendEmailAP()" label="Press to copy selected items to body of email template" width="478" y="344"></mx:Button>
                </mx:Canvas>
                <mx:Canvas width="100%" height="400"  label="Direct PO Details: PO not created from request" id="DirectPO" backgroundColor="#D2E9DA" color="#A60831">
                    <mx:Button click="GetData3()" label="Press to load Data" width="305"></mx:Button>
                    <mx:FormItem label="HeaderWordWrap:" x="335">
                        <mx:CheckBox id="checkBox3" selected="true" />
                    </mx:FormItem>
                    <mx:FormItem label="Include Balance of 0 Items?:" x="550">
                        <mx:CheckBox id="checkBoxZero3" selected="false" change="checkBoxZero3_change(event);"  />
                    </mx:FormItem>
                    <mx:FormItem label="Only Show Items > 30 Days?:" x="850">
                        <mx:CheckBox id="checkBoxAge2" selected="true" change="checkBoxAge2_change(event);"  />
                    </mx:FormItem>
                    <mx:DataGrid id="DirectPOGrid"  allowMultipleSelection="true" horizontalScrollPolicy="auto" width="3500" height="300" dataProvider="{serverData3}" y="36" itemRollOut="deleteToolTip2(event)" itemRollOver="createToolTip2(event)" itemEditEnd="RefData(event)">
                        <mx:columns>
                            <fx:Array>
                                <mx:DataGridColumn  headerText="PossibleUserName" dataField="PossibleSourceUserid" width="160"/>
                                <mx:DataGridColumn headerText="PO" dataField="PO" width="100"/>
                                <mx:DataGridColumn headerText="Vendor" dataField="VENDOR" width="270"/>
                                <mx:DataGridColumn headerText="Po Date" dataField="PO_Date" width="120"/>
                                <mx:DataGridColumn headerText="Ordered QTY (A)" headerWordWrap="{checkBox3.selected}" dataField="Ord_Qty" width="120" />
                                <mx:DataGridColumn headerText="PO Item" dataField="POItem" width="100" />
                                <mx:DataGridColumn headerText="Commodity Description" dataField="CMDDESC" width="300"/>
                                <mx:DataGridColumn headerText="PO Unit Price" dataField="POUNITPRICE" width="120"/>
                                <mx:DataGridColumn headerText="Org code" dataField="ACTGORG" width="100"/>
                                <mx:DataGridColumn headerText="Received Qty (B)" dataField="RECQTY" width="150"/>
                                <mx:DataGridColumn headerText="Inv Document #" dataField="INVCODE" width="150"/>
                                <mx:DataGridColumn headerText="Vendor Invoice #" dataField="VENDINV" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Status" dataField="INVSTATUS" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Due Date" dataField="DUEDATE" width="150"/>
                                <mx:DataGridColumn headerText="Invoice Date" dataField="VENDORINVDATE" width="120"/>
                                <mx:DataGridColumn headerText="Fund" dataField="FUNDCODE" width="80"/>
                                <mx:DataGridColumn headerText="Account" dataField="ACCT" width="80"/>
                                <mx:DataGridColumn headerText="Org" dataField="ORG

    Thanks...I was using Alert instead of trace to make sure events were firing along with correct parameter values before calling web service. I never thought in a million years that would be causing the problem. However, when user hits return it drops the focus to the next row which causes a second itemEditEnd to fire (so it still doesn't work smoothly). At any rate, I approached it another way by wiring up a pop up box.

  • How to get the properties of application anywhere in the project?

    Hello,
    Application
         |__Component1
                   |___Component2
                                 |___Component3 -----> Component4 ( as Popup)
    this is the actal scenario in my flex application..
    Do you know any best way to access the properties on the Application Object ??
    i want to set the popup component in the middle of the browser screen..
    for that i have tried the way...
    - Component 4
    <!-- PopupWindow.mxml -->
    <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx">
         <s:layout>
              <s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
         </s:layout>
         <s:BorderContainer id="bcPopupWindow" width="700" height="500" backgroundAlpha="0.8" borderAlpha="0.5"
                           borderVisible="true" cornerRadius="20" dropShadowVisible="true">
    ==     Some designing part   ==
         </s:BorderContainer>
    </s:Group>
    and for showing this
    in Component 3 -
    protected function btnShowPopup_clickHandler(event:MouseEvent):void
         myPopup= new PopupWindow();
         myPopup.width = this.parent.parent.parent.width;
         myPopup.height =this.parent.parent.parent.height;
         PopUpManager.addPopUp(myPopup,this,true);

    hi
    try changing this line:
    PopUpManager.addPopUp(myPopup,this,true);  //adds popup to current object
    to this:
    PopUpManager.addPopUp(myPopup, root, true); //adds popup to top level object
    it should fix the popup not centering properly - it is centering itself, but with respect to the current visual object (where your open popup code is). changing to root will add the popup to the top level and so centering it there will center it with respect to the application itself.
    also, add this line below the one above:
    trace(FlexGlobals.topLevelApplication.width);
    and see what it traces out (in debug mode) - is it giving the correct value?

  • Variable URL in data service

    I'm new to Flex and trying to create a proof of concept Air App.  I have it connecting to an http service to retrieve data but I want the URL to be configurable.  I created a preferences page which is working, but I can't seem to load the URL preference into a variable for the http service.  Below is my code:
    <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.events.FlexEvent;
                import services.exadatademo.newUrl;
                //public var testDbUrl:String = "http://localhost/pls/apex/";
                public var testDbUrl:String;
                private function init():void
                    var storedDatabaseUrl:ByteArray = EncryptedLocalStore.getItem("DatabaseUrl");
                    testDbUrl = storedDatabaseUrl.readUTFBytes(storedDatabaseUrl.length);
                    services.exadatademo.newUrl = 'bar';
                    trace(testDbUrl);
                protected function getPrefs():void
                    var storedDatabaseUrl:ByteArray = EncryptedLocalStore.getItem("DatabaseUrl");
                    dbUrlTxt.text = storedDatabaseUrl.readUTFBytes(storedDatabaseUrl.length);
                    testDbUrl = dbUrlTxt.text;
                    var storedDatabaseUserName:ByteArray = EncryptedLocalStore.getItem("DatabaseUserName");
                    dbUsernameTxt.text = storedDatabaseUserName.readUTFBytes(storedDatabaseUserName.length);
                    var storedDatabasePassword:ByteArray = EncryptedLocalStore.getItem("DatabasePassword");
                    dbPasswdTxt.text = storedDatabasePassword.readUTFBytes(storedDatabasePassword.length);
                private function savePrefs():void
                    var bytes:ByteArray = new ByteArray();
                    //write string text as UTF8 bytes
                    bytes.writeUTFBytes(dbUrlTxt.text);
                    EncryptedLocalStore.setItem("DatabaseUrl", bytes);
                    bytes = new ByteArray();
                    bytes.writeUTFBytes(dbUsernameTxt.text);
                    EncryptedLocalStore.setItem("DatabaseUserName", bytes);
                    bytes = new ByteArray();
                    bytes.writeUTFBytes(dbPasswdTxt.text);
                    EncryptedLocalStore.setItem("DatabasePassword", bytes);
                protected function button1_clickHandler(event:MouseEvent):void
                    trace('foo');
                    savePrefs();
                    currentState = "Main";
                protected function linkbutton1_clickHandler(event:MouseEvent):void
                    currentState = "Preferences";
                    getPrefs();
                protected function InterconnectTraffic_creationCompleteHandler(event:FlexEvent):void
                    //GetEmployeesResult.token = exadataDemo.GetEmployees();
                protected function button2_clickHandler(event:MouseEvent):void
                    // TODO Auto-generated method stub
                    GetEmployeesResult.token = exadataDemo.GetEmployees();
            ]]>
        </fx:Script>
    package services.exadatademo
        import mx.core.FlexGlobals;
        public var newUrl:String = null;
    public class ExadataDemo extends _Super_ExadataDemo
        public function ExadataDemo():void
            super();
            trace(newUrl+'hello');
            trace(FlexGlobals.topLevelApplication['testDbUrl']);
            _serviceControl.baseURL = FlexGlobals.topLevelApplication['testDbUrl'];
    Thanks,
    Tyler

    I tried something similar quite some time ago, spend a lot of
    time on this task, but never got to a real solution.
    As far as I remember there was no way to do it in with shared
    libraries that do have different urls.
    There might be a workaround to build a php/asp/jsp script
    that pipes through the content of a configured shared lib to flash,
    pretending it would be the requested shared lib.

  • State transitions within components

    Hi
    Im having troubling getting a button within a custom component to change the state of another custom component. For example, I have custom component A and custom component B within a page of my application. I want a button in custom component A to change the state of custom component B. When i try to select the state to transition to its not in the drop down list. Is there a way I can edit the source code to make this work?
    thanks,
    Luke.

    Hi Luke,
    There isn't a way to do this from the Flash Catalyst UI currently. If you import the project into Flash Builder, there are a number of ways you can do it in code. Here's the simplest way:
    1. In your Main.mxml file, assign an id to the instance of the component you want to control (in your example, Component B), like this:
    <components:ComponentB x="100" y="100" id="compB"/>
    (If it already has an id, just note it down and go to the next step.)
    2. In the ComponentA.mxml file (which should be in the "components" folder in your project), add a click handler to the button, like this
    <s:Button label="Click me!" x="100" y="100" click="FlexGlobals.topLevelApplication.compB.currentState='StateName'"/>
    where StateName is the name of the ComponentB state you want to switch to when the button is clicked. (If the instance of the component in Main.mxml already had some other id, just use that here instead of "compB".)
    Note that while this is the easiest way to do it, it's not the cleanest. A better way to do it is to have ComponentA dispatch an event when the button is clicked, and then have the application handle the event by changing ComponentB's state. That's a little more code though.
    Let me know if this doesn't work for you.
    Thanks,
    nj

  • Flex Mobile Projet - ActionBar position

    Hi, I have created a Flex mobile project, with ViewNavigatorApplication layout.  I want to position the ActionBar in the bottom of the app, rather than the default top aligned. How can I do that?
    I tried by setting the this.navigator.actionBar.y = 300; in the creationComplete of the application, but as I navigate to any other view, it jumps back to top.
    Please suggest.

    If you can't find a better solution, extend the View class and add the code to this extended view. All your view will then have to extend this view.
    You would have to add something like navigator.actionBar.y = FlexGlobals.topLevelApplication.height - navigator.actionBar.height; in the creationCompleteHandler (i would use a callLater because your change will be overwrited by the view_creationCompleteHandler) and in the viewActivate Handler. The navigator will always flash at the top when you switch view... It's why I hope you'll find a better way to do it.

Maybe you are looking for