mouseEvents

Hello everyone,

I'm fairly new to AS3 and I have 2 questions on an animation that I am putting together. So far, I've been able to do Flash and stop the animation at the end I made a button background so when you press it, it will blink again. I used the mouse click event handlers event code snippets, and I can't understand the code to replace the trace event. Code is below:

Stop();

startButton.addEventListener (MouseEvent.CLICK, fl_MouseClickHandler_2);

function fl_MouseClickHandler_2 (event: MouseEvent): void

{

trace ("clicked mouse")

}

The question I have is how the animation code so that the eyes can follow where the mouse is. Is it even possible with AS3 or do I need to learn another form of code to do this?

I appreciate any and all help that you can give me as well as more resources for learning easy in Flash CS5 and AS3. Currently, I am unable to view the videos online, so written tutorials are a great help for me.


Once again, thank you and have a wonderufl day.

Select this path (...) and start typing your code.

Use google to search for an eye-track tutorial.

Tags: Adobe Animate

Similar Questions

  • MouseEvents or TouchEvents?

    Hey,.

    I just wanted to ask if you have used MouseEvents or TouchEvents.

    I used MouseEvents for my application I need a single touch point, Multitouch will be added later.

    He worked in the Simulator, I hope this works on the real device, but as far as I know the first TouchEvent also generates a MouseEvent.

    Hello

    on a mobile device, when you tap on the screen, you will receive two MouseEvents and TouchEvents for backward compatibility (using MouseEvents applications in their code). If you start coding, you always have the choice, you must use the TouchEvents instead of MouseEvents.

    Be careful with the. MOVE those who can carry a lot of overhead and spread too many times. Best thing to do is an event. ENTER_FRAME event listener and check the stage.mouseX / stage.mouseY properties. It's the thing more optimized to mobile for MOTION events.

  • Where do the lot of MouseEvents come from?

    Hi all,

    I have a simple MousEventhandler, which is just supposed to listen if the mouse is pressed and released.

    I'm events gainig more the waiting... Happen how and which can reduce them?

    Here is the Manager and his registratin I'll stat-routine

    EventHandler < MouseEvent > mouseEvtHandler = new EventHandler < MouseEvent >)

    {

    private m_startPoint Point2D = null;

    @Override

    public void handle (MouseEvent evt)

    {

    System.out.println("evt:"+evt);

    If (m_startPoint == null & & evt.isPrimaryButtonDown ())

    {

    m_startPoint = new Point2D (evt.getScreenX (), evt.getScreenY ());

    System.out.println ("mouse down!" (+ m_startPoint);

    }

    ElseIf (m_startPoint! = null & &! evt.isPrimaryButtonDown ())

    {

    root.setTranslateX (m_startPoint.getX ())

    m_startPoint = null;

    System.out.println ("mouse released!" (+ m_startPoint);

    }

    on the other

    {

    System.out.println ("mouse event does!");

    }

    }

    };

    stage.addEventHandler (MouseEvent.MOUSE_PRESSED, mouseEvtHandler);

    stage.addEventHandler (MouseEvent.MOUSE_RELEASED, mouseEvtHandler);

    Here is the result

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_PRESSED, consumed eventType = false, 310.0 = x, y = 50.0, button = PRIMARY, primaryButtonDown]

    Mouse down! Point2D [x = 950,0, y = 274,0]

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    evt:MouseEvent [source = javafx.stage.Stage@24024c39 target = javafx.scene.Scene@12da44a7, = MOUSE_RELEASED, consumed eventType = false, x = 305,0, y = 195,0, button = PRIMARY]

    Mouse exit! null

    Thanks for the advice in advance

    Malta

    This really looks like a bug. I did a quick test and not a not reproduce. Could you please fill out a bug in https://javafx-jira.kenai.com/ ? Please do not forget to specify the version of FX and operating system you are using.

  • Drag, drop AND MouseEvents

    I am trying to build a mapping application and data running on the issues of the event presented with DND. I would like to draw a line "stretching" between "ports". When the target port, I would like to drop some info on it. The commented code below (with the _port.setOnDragDetected method) is the stretch described (ports are expanded to the demonstration).  If this block of code is uncommented, the drop works as I need to, but events are delivered to the linework.  Problem is that I need two.
    public class DataXferView extends Application {
    
        private Line connection;
        private Group root;
        private HashMap<String, Color> colorMap;
    
        private void init(Stage primaryStage) {
            colorMap = new HashMap<String, Color>();
            colorMap.put("1", Color.LIGHTBLUE);
            colorMap.put("2", Color.ORANGE);
            root = new Group();
            primaryStage.setScene(new Scene(root, 400, 300));
    
            Group outPort1 = createOutPort(50.0, 50.0, "1");
            Group outPort2 = createOutPort(50.0, 125.0, "2");
            Group inPort = createInPort(250.0, 75.0);
    
            root.getChildren().add(inPort);
            root.getChildren().add(outPort1);
            root.getChildren().add(outPort2);
        }
    
        private Group createOutPort(double _topLeftX, double _topLeftY, String _portId) {
            Group outPortBox = new Group();
            Rectangle borderBox = RectangleBuilder.create().x(_topLeftX).y(_topLeftY)
                    .width(100).height(40).fill(Color.WHITE).stroke(Color.BLACK).build();
    
            Circle port = CircleBuilder.create().centerX(_topLeftX + 80)
                    .centerY(_topLeftY + 20).radius(10.0f)
                    .fill(colorMap.get(_portId)).stroke(Color.DARKGREY).build();
            port.setUserData(_portId);
    
            setOutPortEvents(port);
            outPortBox.getChildren().addAll(borderBox, port);
            return outPortBox;
        }
    
        private void setOutPortEvents(final Circle _port) {
            _port.setOnMousePressed(new EventHandler<MouseEvent>() {
    
                @Override
                public void handle(MouseEvent me) {
                    connection = LineBuilder.create().stroke(_port.getFill()).strokeWidth(2.0)
                            .startX(_port.getCenterX()).startY(_port.getCenterY())
                            .endX(_port.getCenterX()).endY(_port.getCenterY()).build();
                    root.getChildren().add(connection);
                 }
            });
    
            _port.setOnMouseDragged(new EventHandler<MouseEvent>() {
    
                @Override
                public void handle(MouseEvent me) {
                    connection.setEndX(me.getSceneX());
                    connection.setEndY(me.getSceneY());
                }
            });
    
    //        _port.setOnDragDetected(new EventHandler<MouseEvent>() {
    //
    //            @Override
    //            public void handle(MouseEvent me) {
    //               Dragboard db = _port.startDragAndDrop(TransferMode.ANY);
    //                // Put a string on a dragboard
    //                ClipboardContent content = new ClipboardContent();
    //                content.putString((String)_port.getUserData());
    //                db.setContent(content);
    //            }
    //        });
            
        }
    
        private Group createInPort(double _topLeftX, double _topLeftY) {
            Group inPortBox = new Group();
            Rectangle borderBox = RectangleBuilder.create().x(_topLeftX).y(_topLeftY)
                                                .width(100).height(40).fill(Color.WHITE).stroke(Color.BLACK).build();
    
            Circle port = CircleBuilder.create().centerX(_topLeftX + 20).centerY(_topLeftY + 20)
                                .radius(10.0f).fill(Color.WHITE).stroke(Color.DARKGREY).build();
                                
            setInPortEvents(port);
            inPortBox.getChildren().addAll(borderBox, port);
            return inPortBox;
        }
    
        private void setInPortEvents(final Circle _port) {
            _port.setOnDragOver(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                   if (event.getGestureSource() != _port
                            && event.getDragboard().hasString()) {
                       event.acceptTransferModes(TransferMode.ANY);
                    }
                    event.consume();
                }
            });
    
            _port.setOnDragEntered(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                    if (event.getGestureSource() != _port
                            && event.getDragboard().hasString()) {
                        _port.setStroke(Color.RED);
                    }
                    event.consume();
                }
            });
    
            _port.setOnDragExited(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                    _port.setStroke(Color.DARKGREY);
                    event.consume();
                }
            });
    
            _port.setOnDragDropped(new EventHandler<DragEvent>() {
    
                @Override
                public void handle(DragEvent event) {
                   Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasString()) {
                         _port.setFill(colorMap.get(db.getString()));
                        success = true;
                    }
                    event.setDropCompleted(success);
                    event.consume();
                }
            });
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception {
            init(primaryStage);
            primaryStage.show();
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
    This is the problem that is described here: http://javafx-jira.kenai.com/browse/RT-16916?

    And the solution will be included in the final version of 2.1 (I am current using 2.1 b07)?

    Workaround advice are appreciated. Thank you.

    The attached code contains the following changes:
    -the block of initialization of the DND is no comment
    -the MouseDragged Manager is removed, instead, the DragOver filter is added to the stage
    -the line is marked mouseTransparent, otherwise he keeps eating the DragOver events that we want to be delivered to the port target

    He deserves a little more work, for example, it allows a transfer of data between applications, but not for the lines between applications, but the basic idea should be clear.

    public class DataXferView extends Application {
    
        private Line connection;
        private Group root;
        private HashMap colorMap;
    
        private void init(Stage primaryStage) {
            colorMap = new HashMap();
            colorMap.put("1", Color.LIGHTBLUE);
            colorMap.put("2", Color.ORANGE);
            root = new Group();
            Scene scene = new Scene(root, 400, 300);
            primaryStage.setScene(scene);
    
            scene.addEventFilter(DragEvent.DRAG_OVER, new EventHandler() {
                @Override
                public void handle(DragEvent me) {
                    if (me.getGestureSource() != null) {
                        connection.setEndX(me.getSceneX());
                        connection.setEndY(me.getSceneY());
                    }
                }
            });
    
            Group outPort1 = createOutPort(50.0, 50.0, "1");
            Group outPort2 = createOutPort(50.0, 125.0, "2");
            Group inPort = createInPort(250.0, 75.0);
    
            root.getChildren().add(inPort);
            root.getChildren().add(outPort1);
            root.getChildren().add(outPort2);
        }
    
        private Group createOutPort(double _topLeftX, double _topLeftY, String _portId) {
            Group outPortBox = new Group();
            Rectangle borderBox = RectangleBuilder.create().x(_topLeftX).y(_topLeftY)
                    .width(100).height(40).fill(Color.WHITE).stroke(Color.BLACK).build();
    
            Circle port = CircleBuilder.create().centerX(_topLeftX + 80)
                    .centerY(_topLeftY + 20).radius(10.0f)
                    .fill(colorMap.get(_portId)).stroke(Color.DARKGREY).build();
            port.setUserData(_portId);
    
            setOutPortEvents(port);
            outPortBox.getChildren().addAll(borderBox, port);
            return outPortBox;
        }
    
        private void setOutPortEvents(final Circle _port) {
            _port.setOnMousePressed(new EventHandler() {
    
                @Override
                public void handle(MouseEvent me) {
                    connection = LineBuilder.create().stroke(_port.getFill()).strokeWidth(2.0)
                            .startX(_port.getCenterX()).startY(_port.getCenterY())
                            .endX(_port.getCenterX()).endY(_port.getCenterY()).build();
                    connection.setMouseTransparent(true);
                    root.getChildren().add(connection);
                 }
            });
    
            _port.setOnDragDetected(new EventHandler() {
    
                @Override
                public void handle(MouseEvent me) {
                   Dragboard db = _port.startDragAndDrop(TransferMode.ANY);
                    // Put a string on a dragboard
                    ClipboardContent content = new ClipboardContent();
                    content.putString((String)_port.getUserData());
                    db.setContent(content);
                }
            });
    
        }
    
        private Group createInPort(double _topLeftX, double _topLeftY) {
            Group inPortBox = new Group();
            Rectangle borderBox = RectangleBuilder.create().x(_topLeftX).y(_topLeftY)
                                                .width(100).height(40).fill(Color.WHITE).stroke(Color.BLACK).build();
    
            Circle port = CircleBuilder.create().centerX(_topLeftX + 20).centerY(_topLeftY + 20)
                                .radius(10.0f).fill(Color.WHITE).stroke(Color.DARKGREY).build();
    
            setInPortEvents(port);
            inPortBox.getChildren().addAll(borderBox, port);
            return inPortBox;
        }
    
        private void setInPortEvents(final Circle _port) {
            _port.setOnDragOver(new EventHandler() {
    
                @Override
                public void handle(DragEvent event) {
                   if (event.getGestureSource() != _port
                            && event.getDragboard().hasString()) {
                       event.acceptTransferModes(TransferMode.ANY);
                    }
                    event.consume();
                }
            });
    
            _port.setOnDragEntered(new EventHandler() {
    
                @Override
                public void handle(DragEvent event) {
                    if (event.getGestureSource() != _port
                            && event.getDragboard().hasString()) {
                        _port.setStroke(Color.RED);
                    }
                    event.consume();
                }
            });
    
            _port.setOnDragExited(new EventHandler() {
    
                @Override
                public void handle(DragEvent event) {
                    _port.setStroke(Color.DARKGREY);
                    event.consume();
                }
            });
    
            _port.setOnDragDropped(new EventHandler() {
    
                @Override
                public void handle(DragEvent event) {
                   Dragboard db = event.getDragboard();
                    boolean success = false;
                    if (db.hasString()) {
                         _port.setFill(colorMap.get(db.getString()));
                        success = true;
                    }
                    event.setDropCompleted(success);
                    event.consume();
                }
            });
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception {
            init(primaryStage);
            primaryStage.show();
        }
    
        public static void main(String[] args) {
            launch(args);
        }
    }
    
  • How can I prevent children from shrink to infinitesimal values on MouseEvents?

    Hello.

    I have the following code:

    ////////////////////////////////////////////////////////////////////////////////////

    http://forums.Adobe.com/message/3450898#3450898

    property of square_mc.y edited by kglad AND NedMurphy both

    but kglad introduced the variable yGap, allowing

    space between user-defined video clips.  This solved my

    problem of spacing evenly distributed between video clips

    all the other code I generated either my own previous

    or to think of the solution and work files

    at his home.

    import flash.display.MovieClip;

    import flash.events.Event;

    import flash.events.MouseEvent;

    var nextY: Number = 0;

    var yGap:int = 2;

    var container: MovieClip = new MovieClip();

    var containerBig:MovieClip = new MovieClip();

    containerBig.x = 50;

    containerBig.y = 50;

    containerBig.scaleX = 1;

    containerBig.scaleY = 1;

    addChild (container);

    addChild (containerBig);

    stage.addEventListener (Event.ENTER_FRAME, myFunc);

    / * var imageHolder_mc:MovieClip = new MovieClip();

    imageHolder_mc.graphics.beginFill (0 x 888888);

    imageHolder_mc.graphics.lineTo (300,0);

    imageHolder_mc.graphics.lineTo (300,200);

    imageHolder_mc.graphics.lineTo (0.200);

    imageHolder_mc.graphics.lineTo (0,0);

    */

    var myFrames:Array = new Array();

    for (var i: int = 0; i < 12; i ++) {}

    myFrames.push ("my_" + i + "_mc");

    trace (myFrames + "myFrames");

    var square_mc:MovieClip = new MovieClip();

    square_mc. Graphics.beginFill (0xFF0000);

    square_mc. Graphics.LineTo (200.0);

    square_mc. Graphics.LineTo (200,200);

    square_mc. Graphics.LineTo (0.200);

    square_mc. Graphics.LineTo (0,0);

    container.addChild (square_mc);

    square_mc. Name = "My_" + i + "_mc";

    trace (square_mc. (Name)

    square_mc.addEventListener (MouseEvent.MOUSE_OVER, myFunc2);

    square_mc.addEventListener (MouseEvent.MOUSE_OUT, myFunc3);

    square_mc. ScaleX=.25+(.13*Math.Sin(i/Math.pi)) * mouseY *. 005;

    square_mc. ScaleX =. 25;

    square_mc. ScaleY = square_mc. ScaleX;

    square_mc.Alpha = i *. 1 +. 3;

    square_mc.y is nextY + MouseY *(-1);.

    nextY += square_mc.height + yGap;

    }

    function myFunc(e:Event):void {}

    Container.y =-1 * mouseY + stage.height;

    trace (container.y + "containerY");

    }

    function myFunc2(e:MouseEvent):void {}

    e.target.scaleX * = 1.2;

    trace (stage.height + "stageHeight");

    e.target.addEventListener (MouseEvent.MOUSE_DOWN, myFunc4);

    e.target.mouseChildren = false;

    }

    function myFunc3(e:MouseEvent):void {}

    e.target.scaleX/=1.2;

    e.target.removeEventListener (MouseEvent.MOUSE_OVER, myFunc2);

    }

    Add ImageHolder_mc MovieClip library and go to section

    coinciding with the value of table looping for...

    var imageHolder_mc:ImageHolder_mc = new ImageHolder_mc();

    function myFunc4(e:MouseEvent):void {}

    containerBig.addChild (imageHolder_mc);

    for (var j: int = 0; j < 12; j ++) {}

    {if(e.target.name=="my_"+j+"_mc")}

    imageHolder_mc.gotoAndStop (j);

    }

    }

    trace (e.target.y + "e.target.y");

    }

    ////////////////////////////////////////////////////////////////////////////////////

    You can solve the problem by adding a frame 12 MovieClip in your library when you test this code and give the name that I've referenced above in bold.

    This means that anyone who has the time to help me.

    The problem I am facing with is not with the content of the Clip, loading (although I could encounter problems with it later when I try to load dynamic SWF files) because as for now I have just placeholders on images.

    I want to know is why my red squares on the left navigation keep getting smaller, as I repeat the MouseOver and mouseout/mouseouthandler() events.  It does not appear that these squares follow the logic of the code the way I wrote it.  The code generated from a previous post with the help of contributors.

    Now, I again met a light barrier with the mathematics of coding correctly.  Initially when I tested the code it worked fine without any current "shrinkage".  However, now with more code added the red navigation square do not bounce back to their original countries, they just keep getting smaller.

    Can someone help me with this?

    Thanking you in advance,

    -markerline

    import flash.display.MovieClip;

    import flash.events.Event;

    import flash.events.MouseEvent;

    var alreadyExecuted:Boolean;

    {if(!alreadyExecuted)}

    alreadyExecuted = true;

    var nextY: Number = 0;

    var yGap:int = 2;

    var container: MovieClip = new MovieClip();

    var containerBig:MovieClip = new MovieClip();

    containerBig.x = 50;

    containerBig.y = 50;

    containerBig.scaleX = 1;

    containerBig.scaleY = 1;

    addChild (container);

    addChild (containerBig);

    stage.addEventListener (Event.ENTER_FRAME, myFunc);

    / * var imageHolder_mc:MovieClip = new MovieClip();

    imageHolder_mc.graphics.beginFill (0 x 888888);

    imageHolder_mc.graphics.lineTo (300,0);

    imageHolder_mc.graphics.lineTo (300,200);

    imageHolder_mc.graphics.lineTo (0.200);

    imageHolder_mc.graphics.lineTo (0,0);

    */

    var myFrames:Array = new Array();

    for (var i: int = 0; i<12;>

    myFrames.push ("my_" + i + "_mc");

    trace (myFrames + "myFrames");

    var square_mc:MovieClip = new MovieClip();

    square_mc. Graphics.beginFill (0xFF0000);

    square_mc. Graphics.LineTo (200.0);

    square_mc. Graphics.LineTo (200,200);

    square_mc. Graphics.LineTo (0.200);

    square_mc. Graphics.LineTo (0,0);

    container.addChild (square_mc);

    square_mc. Name = "My_" + i + "_mc";

    trace (square_mc. (Name)

    square_mc.addEventListener (MouseEvent.MOUSE_OVER, myFunc2);

    square_mc.addEventListener (MouseEvent.MOUSE_OUT, myFunc3);

    square_mc. ScaleX=.25+(.13*Math.Sin(i/Math.pi)) * mouseY *. 005;

    square_mc. ScaleX =. 25;

    square_mc. ScaleY = square_mc. ScaleX;

    square_mc.Alpha = i *. 1 +. 3;

    square_mc.y is nextY + MouseY *(-1);.

    nextY += square_mc.height + yGap;

    }

    function myFunc(e:Event):void {}

    Container.y =-1 * mouseY + stage.height;

    trace (container.y + "containerY");

    }

    function myFunc2(e:MouseEvent):void {}

    e.target.scaleX * = 1.2;

    trace (stage.height + "stageHeight");

    e.target.addEventListener (MouseEvent.MOUSE_DOWN, myFunc4);

    e.target.mouseChildren = false;

    }

    function myFunc3(e:MouseEvent):void {}

    e.target.scaleX/=1.2;

    e.target.removeEventListener (MouseEvent.MOUSE_OVER, myFunc2);

    }

    Add ImageHolder_mc MovieClip library and go to section

    coinciding with the value of table looping for...

    var imageHolder_mc:ImageHolder_mc = new ImageHolder_mc();

    function myFunc4(e:MouseEvent):void {}

    containerBig.addChild (imageHolder_mc);

    for (var j: int = 0; j<12;>

    {if(e.Target.Name=="My_"+j+"_mc")}

    imageHolder_mc.gotoAndStop (j);

    }

    }

    trace (e.target.y + "e.target.y");

    }

    }

  • MouseEvents, page navigation

    Hello

    I want to create 2 buttons and 2 pages (in the future, it must be able to change to 3 or 4 or etc...).

    If I click on button1 I see page 1, if I click button2 I see page2.

    I have a queestion.

    1. Please look at the button in the Flash IDE. There, I created dymanic label field. And now he look like when I change this label I'll see the same text on my 2 buttons. How can I make just a button and a label on flash IDE library and writing .as for button1 Text1 and Text2 for button2?


    2. open the .swf and the button for the thumb. When I have more mouse on the text, I don't see thumb. Just when I'm apart of the label and still stand on the sidelines, I can see thumb... So what's the problem?

    3. How can I optimize the code? Because everything now seems the same names of button just changing for example.

    Code:

    package 
    {
         import flash.display.MovieClip;
         import flash.events.MouseEvent;
         
         import fl.transitions.Tween;
         import fl.transitions.easing.*;     
    
         public class  Pages extends MovieClip
         {
              //constructor
              public function Pages()
              {
                   mainMenu();
              }
              
              public function mainMenu():void
              {
                   homeBtn.buttonMode = true;
                   homeBtn.addEventListener(MouseEvent.CLICK, homeBtnEvent);
                   homeBtn.addEventListener(MouseEvent.MOUSE_UP, homeBtnUp);
                   homeBtn.addEventListener(MouseEvent.MOUSE_OVER, homeBtnOver);
                   homeBtn.addEventListener(MouseEvent.MOUSE_OUT, homeBtnOut);               
                   //homeBtn.homeLabel.text = "HOME";
                   
                   aboutBtn.buttonMode = true;
                   aboutBtn.addEventListener(MouseEvent.CLICK, aboutBtnEvent);
                   aboutBtn.addEventListener(MouseEvent.MOUSE_UP, aboutBtnUp);
                   aboutBtn.addEventListener(MouseEvent.MOUSE_OVER, aboutBtnOver);
                   aboutBtn.addEventListener(MouseEvent.MOUSE_OUT, aboutBtnOut);               
                   //aboutBtn.homeLabel.text = "ABOUT";
              }
              
              
              
              public function homeBtnEvent(event:MouseEvent):void
              {
                   trace("home button clicked");
                   gotoAndStop('p1');
                   var homePage:Tween = new Tween(homePage_mc, "x", Elastic.easeOut, -200, 19, 2, true);
              }
              public function homeBtnUp(event:MouseEvent):void
              {
                   homeBtn.gotoAndPlay('up');
              }
              public function homeBtnOver(event:MouseEvent):void
              {
                   homeBtn.gotoAndPlay('over');
              }
              public function homeBtnOut(event:MouseEvent):void
              {
                   homeBtn.gotoAndPlay('out');
              }
              
              
              
              public function aboutBtnEvent(event:MouseEvent):void
              {
                   trace("about button clicked");
                   gotoAndStop('p2');
                   var aboutPage:Tween = new Tween(aboutPage_mc, "x", Elastic.easeOut, -200, 19, 2, true);
              }
              public function aboutBtnUp(event:MouseEvent):void
              {
                   aboutBtn.gotoAndPlay('up');
              }
              public function aboutBtnOver(event:MouseEvent):void
              {
                   aboutBtn.gotoAndPlay('over');
              }
              public function aboutBtnOut(event:MouseEvent):void
              {
                   aboutBtn.gotoAndPlay('out');
              }
         }     
    }
    

    I can attach an example. But see not the button attach: (help please?

    Is your button, a component, or a clip? If you change the text of a single instance, in the IDE, the text of the other instance of the same object is modified. In code, you can set the text independently.

    For the hand cursor work on the text, you must disable the mouse for that: homeBtn.homeLabel.mouseEnabled = false;

    You can use event.currentTarget to get the target of event - so you must separate the functions for everything. So instead of saying homeBtnOut just do btnOut:

    private void btnOut(e:MouseEvent):void

    {

    e.currentTarget.gotoAndPlay ("out");

    }

    And really, these functions should be private, not public, since they are called from inside the class only.

  • Forwarding MouseEvents?

    I have a custom list that listens to the mouseDown and mouseUp events.  He always receives the mouseDown events, but mouseUp events are swallowed if they occur on an itemRenderer.  Is there a way to make the forwarding of these events itemRenderer?  I know that I could send a custom event, but since MouseEvent event has all the properties, I care, it would be nice to just pass.

    Make a small suitcase to test and see if your problem exists.

  • MouseEvents on main sprite

    This is probably a question of beginners, but I remain very puzzled for a few days.

    This works as expected (imports omitted):
    SerializableAttribute public class Test extends Sprite {}
    public void Test() {}
    var circle: Sprite = new Sprite();
    circle.graphics.lineStyle (1);
    circle.graphics.beginFill (0xFF8000);
    circle.graphics.drawCircle (50, 50, 10);
    circle.addEventListener (MouseEvent.MOUSE_DOWN, down);
    addChild (circle);
    }
    private void down(evt:MouseEvent):void {}
    trace ("Down");
    }
    }

    However if I remove the circle object and draw directly on the main sprite, it does not work:

    SerializableAttribute public class Test extends Sprite {}
    public void Test() {}
    graphics.lineStyle (1);
    graphics.beginFill (0xFF8000);
    graphics.drawCircle (50, 50, 10);
    addEventListener (MouseEvent.MOUSE_DOWN, down);
    }
    private void down(evt:MouseEvent):void {}
    trace ("Down");
    }
    }
    No matter where I click, I can't event to be fired.
    I know that I can reach the listener to the stage, but I wonder why it does not work on the sprite directly.

    I'm sure that there is a reasonable explanation, I just can't understand it.
    Can someone help?

    Thanks in advance,
    Peter

    The problem is that you are trying to listen to an object. A standard procedure is to create the object, attach this object, then listen to this object, but if you create an object and listen to the internal characteristics of what he calls, he can not (graphic is not interactive, but sprite is interactive). The scope of graphics inside a Sprite creates an internal 'form' - the Sprite "has" a form in there - but it is not interactive. Everything that extends InteractiveObject can have demonstrations including the Shape object is not. Hope this helps sir :)

  • List drop-down events

    Can someone point me to information on events from the drop-down list? I want to deal with when the selection in the drop-down list has changed.

    myDropDown.addEventListener (Event.SELECT, myFunction, true, 0, true);

    The foregoing is not to do the trick.  I see MouseEvents.CLICK events if I change the event above.

    Thanks in advance.

    Hey kaptuafj,

    According to the API reference page:

    http://www.BlackBerry.com/developers/docs/airapi/1.0.0/QNX/UI/listclasses/dropdown.html

    the event that should be listened to is Event.SELECT. I'll write a program and run it to confirm.

    Edit: Just run the program and it works very well. Event is triggered and captured. Just make sure that your listener function looks something like that with the event in parentheses:

    public function myFunction(e:Event):void
    

    Edit #2: Hey just used your line:

    myDropDown.addEventListener(Event.SELECT, myFunction, true, 0, true);
    

    and it does not. If you set the argument usecapture false it will start working. unless you have a specific reason to be true, usually this option is set to false by default. unless you need all these arguments usually just using this line also does the trick:

    myDropDown.addEventListener(Event.SELECT, myFunction);
    

    Here are the details for the argument usecapture if you need a deeper look:

    http://www.ActionScript.org/resources/articles/860/3/understanding-the-AS3-event-flow/page3.html

    Let me know if it works!

  • Respond to touch simultaneously

    Hello world

    I have 3 HSlider in my Flex app, and I would like the user to be able to drag them all together (simultaneously).

    The problem now is that when the user is dragging a HSlider, the application does not meet the second touch on the other HSlide (user can only drag a cursor at a time)

    How would I be able to allow the user to drag several cursor at the same time?

    Thank you!!

    I tried

    Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
    
    AND
    
    Multitouch.inputMode=MultitouchInputMode.GESTURE;
    

    But it still does not work...

    First of all, you need to set the inputMode:

    Multitouch.inputMode=MultitouchInputMode.TOUCH_POINT;
    

    And then you have to write your own slider component. The default HSliders are built to meet MouseEvents and therefore will not work with multitouch.

  • Behavior of MouseEvent on PB

    How is the MouseEvent behaves on the hardware?

    On the Simulator, I can fly with my mouse and implement a function to mouseMove (Event) to do something like the flat mouse. Obviously on the Tablet, I don't have the functionality of sensitives.

    If I touch with one finger and move around the screen, which would be equivalent to Rt-click of the mouse and drag?

    Can I use MouseEvent to trigger user keys or is there another favorite method?

    Hey labels,

    You can use safely the event MouseEvent class to simulate the events of button on the screen. In my view, the TouchEvent comes into play when you use multi touch actions. right now there is no way to test this functionality so its safe to say you can start with MouseEvents since they fit even in most of the cases.

  • Clickable image

    Can someone tell me how to make it appear a dialog box by clicking on an image?

    Here is my sample code:

    var pos2:Shape = new Shape();
                pos2.graphics.beginFill(0xFF0000);
                pos2.graphics.drawRect(382,50,260,240);
                pos2.graphics.endFill();
                pos2.addEventListener(MouseEvent.CLICK, openDialog);
    addChild(pos2);
    
    ...
    
    private function openDialog(event:MouseEvent):void
            {
                stage.nativeWindow.close();
                var alert = new AlertDialog();
                alert.title = "Warning";
                alert.message = "This operation may harm your computer. Do you still want to proceed?";
                alert.addButton("OK");
                alert.addButton("CANCEL");
                alert.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, alertButtonClicked);
                alert.show();
            }
    

    Please and thank you!

    Hey gyubok,

    You can listen only MouseEvents on objects that implement or extend another class that implements the InteractiveObject class. Shapes are not part of this package. You will need to you something like a sprite in order to meet the MouseEvents such as click. Try to replace your shape with a sprite and see how that works for you:

    var pos2:Sprite = new Sprite();          pos2.graphics.beginFill(0xFF0000);            pos2.graphics.drawRect(382,50,260,240);           pos2.graphics.endFill();          pos2.addEventListener(MouseEvent.CLICK, openDialog);addChild(pos2);
    

    Hope that helps. Good luck!

  • How to use multitouch in Webworks app?

    Hello!

    After my first problems in the development of the app for BB in Webworks I still made my app. I have to use multitouch now, but I have no idea how. I did find samples with multitouch. I found only this: http://developer.blackberry.com/html5/apis/touchevent.html#targetTouches but I don't know how to use this function. Can you help me?

    PS. Sorry for my bad English

    And that's that

    The following example is an implementation of filling of touch

    I decided to leave the bind to the mouse in that it is probably useful to others

    It is a living example of an ePub with blow gettures reader and touch

    The code is a little complex, so I will answer any other than Gregs Qs

    Basically what this did that target an iFrame and control

    Anywhere you see a reference to my target frame - ignore it and replace with what you want to do

    The hardest things to understand for the novice, here are the angle and the time (both are included)

    Without much explain this sets @ high tell the manager what to do

    A call to bindtouch (target) does what it says but is native, you must pass the name of the div tag

    A binding triggers all important events

    Angles and timing are still developing

    Timing is crucial if you need one no doubt

    Angle is optional and depends on how the finger is moved, but requires a JS call very expensive Math.atan2 (point1, point2)

    Basically Angle you indicate where you moved your finger after the first touch so you can probably kill such things

    The County touch gets the correct contact and doing what it takes with it based on defines it

    Look - I told you it was very complicated

    Oh - bind it to the mouse allows you to transfer the call to a mouse event - I thought it might be useful for other readers

    The target an iFrmae is also very convenient as it is scrolling

    I leave you for that suit your needs

    function bindtouch (target) {}
    var TOUCH_TAP_DIST = 30;
    var TOUCH_TAP_TIME = 150;
    var TOUCH_DRAG_DIST = 50;
    var TOUCH_DRAG_TIME = 500;
    var TOUCH_DRAG_VELOCITY = 50;
    var TOUCH_SWIPE_DIST = 50;
    var TOUCH_SWIPE_TIME = 500;
    var TOUCH_SWIPE_VELOCITY = 75;

    var SWIPE_NONE = 0;
    var SWIPE_RIGHT = 1;
    var SWIPE_UP = 2;
    var SWIPE_LEFT = 4;
    var SWIPE_DOWN = 8;

    var _TOUCH_DRAG_VELOCITY = TOUCH_DRAG_VELOCITY * TOUCH_DRAG_VELOCITY;
        
    var touch = [];

    var el = target;

    function squangle (p1, p2) {}
    ((p2.y-p1.y) return math.atan2, (p2.x - p1.x));
    }

    el.addEventListener ('touchend', Function {}
    e.preventDefault ();
    var TB = e.changedTouches;
    for (var i = 0; i)
    CTI var is ct [i] .identificateur;.
    CTO var = ct [i];
    {if (CTO. ClientX)}
    Touch [sic] = {sx: cto.clientX,}
    SY: cto.clientY,
    TX: cto.clientX,
    Ty: cto.clientY,
    BX: cto.clientX,
    by: cto.clientY,
    PV: 0,
    {TM: e.timeStamp};
    var id = "#tch" + ct;
                    
    evt var = document.createEvent ("MouseEvents");
    evt.initMouseEvent ("mousedown", true, true, window,
    0, cto.screenX, cto.screenY,.
    cto.clientX, cto.clientY, false, false, false, false, 0, null);
    e.srcElement.dispatchEvent (evt);
    }
    }
    });

    el.addEventListener ('touchmove', Function {}
    e.preventDefault ();
    var TB = e.changedTouches;
    for (var i = 0; i)
    CTO var = ct [i];
    TCO var = touch [cto.identifier];
    var ms = e.timeStamp - tco.tm;
    {if (CTO. ClientX)}
    TCO. TX = cto.clientX;
    TCO. Ty = cto.clientY;
    TCO. PV = Math.sqrt (((tco.sx-tco.tx) * (tco.sx - tco.tx)))
    + ((tco.sy-tco.ty) * (tco.sy - tco.ty)));
    if(e.touches.Length == 2) {}
    dreadful var = e.touches.length;
    }
    if(e.touches.Length == 1) {}
    var dx = Math.abs(tco.bx-tco.sx);
    var dy = Math.abs(tco.by-tco.sy);

    If (tco.pv< _touch_drag_velocity)="">
    If ((smode == SCALE_ZOOM) & (fsize > 1.00)) {}
    $(frames['appframe'].document).scrollLeft ($(frames['appframe'].document).scrollLeft () + (tco.sx - tco.tx));
    //                            }
    EB var = $(frames['appframe'].document);
    St var = eb.scrollTop ();
    $(frames['appframe'].document).scrollTop (st + (tco.sy - tco.ty));
    .SX Touch [i] = e.touches [i] .clientX;
    .Sy Touch [i] = e.touches [i] .clientY;
    }
    }
                    
    TCO. SX = cto.clientX;
    TCO. Sy = cto.clientY;
    }
    }
    });
                
    el.addEventListener ('touchstart', Function {}
    e.preventDefault ();
    var TB = e.changedTouches;
    for (var i = 0; i)
    CTO var = ct [i];
    TCO var = touch [cto.identifier];
    var ms = e.timeStamp - tco.tm;
    var dx = Math.abs(tco.bx-tco.sx);
    var dy = Math.abs(tco.by-tco.sy);
    evt var = document.createEvent ("MouseEvents");

    If ((dx< touch_tap_dist)="" &&="" (dy="">< touch_tap_dist)="" &&="" (ms=""><= touch_tap_time))="">
    evt.initMouseEvent ("click", true, true, window,
    0, tco.sx, tco.sy, tco.sx, tco.sy, false, false, false, false, 0, null);
    e.srcElement.dispatchEvent (evt);
    }
    ElseIf (((dx > TOUCH_SWIPE_DIST) |)) (dy > TOUCH_SWIPE_DIST)) & (Mrs.<= touch_swipe_time))="">
    if(DX > TOUCH_SWIPE_DIST) {}
    If (TCO. BX > TCO. SX) {}
    swipex = SWIPE_RIGHT;
    }
    else {}
    swipex = SWIPE_LEFT;
    }
    }
    else {}
    swipex = SWIPE_NONE;
    }
                        
    if(dy > TOUCH_SWIPE_DIST) {}
    if(TCO.by > TCO.) SY) {}
    swipey = SWIPE_UP;
    }
    else {}
    swipey = SWIPE_DOWN;
    }
    }
    else {}
    swipey = SWIPE_NONE;
    }
                        
    If ((swipey == SWIPE_NONE) & (swipex == SWIPE_RIGHT))
    {
    switchPage (1);
    }
    If ((swipey == SWIPE_NONE) & (swipex == SWIPE_LEFT))
    {
    switchPage(-1);
    }

    evt.initMouseEvent ("mouseup", true, true, window,
    0, tco.sx, tco.sy, tco.sx, tco.sy, false, false, false, false, 0, null);
    e.srcElement.dispatchEvent (evt);
    }
    else {}
    evt.initMouseEvent ("mouseup", true, true, window,
    0, tco.sx, tco.sy, tco.sx, tco.sy, false, false, false, false, 0, null);
    }

    }
    });
    }

  • Touch events in Webworks widget

    I'm trying capture key events in an application of webworks OS 6 and having a little pain with what the browser webkit supports...

    I checked on quirksmode and I see an ad that the BB webkit supports touchstart, touchstart and some other events.

    So, for a shot at him, I try a code similar to this...

    try {
      document.touchstart = startTouch;
      document.touchend = endTouch;
    }
    catch (err) {
      alert('error loading touch.js: ' + err.description);
    }
    
    var _origPos = -1;
    
    function startTouch(e) {
      _origPos = e.screenX;
    }
    
    function endTouch(e) {
      if (_origPos == e.screenX) {
        alert('click: ' + _origPos + ' ' + e.screenX);
      }
      else {
        alert('Drag Touch: ' + _origPos + ' ' + e.screenX);
      }
    }
    

    None of these events fire... so I dropped 6 OS browser documentation and seen that there is no sign of touch under the API of events (see here).

    My only choice is to capture mouseevents and filter combinations to catch gestures?

    i.e.

    :::::PSEUDO CODE::::::
    
    var old_clientX = -1;
    
    function performOnMouseDown(e) {
      old_clientX = e.clientX;
    }
    
    function performOnMouseRelease(e) {
      if (old_clientX == e.clientX) {
        alert('only a click');
      } else {
        alert('drag performed');
      }
    }
    

    Thanks for mentioning that Tim... It is sad that I had already forgotten this example?

    My problem is that I should have registered the event 'ontouchstart', not 'touchstart ".

    document.ontouchstart = function(e) {...}
    document.ontouchend = function(e) {...}
    

    Those who would be in the documentation of the browser? I couldn't find them, but I'm assuming that they would be under the event API.

  • Press the 2 buttons at the same time

    Hello

    I thought I was doing a game of Pinball this morning.  Because the PlayBook a 4-point multitouch, is possible to detect the pressure/holding a button left flipper, a right flipper button or both flippers at the same time.  How about the two buttons a fraction of the second part?  QNX is a real-time operating system, but I have not found this type of control in the AIR SDK.

    Harry

    There should be no problem to do that, but I think you want to use the flash.ui.Multitouch API

    Here's a video that shows how to do this, but you will end by edit it just follow your TouchEvents rather than MouseEvents...

    In response to Touch raw data

    Hope that helps

Maybe you are looking for