Adobe Flex: How can I cancel an effect during a start delay? - apache-flex

I've got a Glow effect (glowIn) being applied to an object on the roll over which has a startDelay applied. I have another glow effect (glowOut) on roll out. If the user mouses out of the control during the startDelay of glowIn, I want to cancel the effect. How do I do this?
In this instance, I'm using a glow effect with a startDelay of 300ms. I want a short pause before the item actually shows the effect, but I don't want the effect playing if the user mouses out during this time. I'm setting the properties as follows:
component.setStyle("rollOverEffect", glowIn);
component.setStyle("rollOutEffect", glowOut);
I don't think it matters much, but the component in question is a Series within a chart that gets created at runtime so I would prefer a solution in actionscript rather than mxml if possible.

I was unable to find a perfect solution to this issue so what I ended up doing was setting up a mouse-event handler for MouseOver and MouseOut on the control, setting up the effects globally and checking effect.isPlaying() within the mouse event handler.
There are some inconsistencies, however, in interrupting the effect while the start delay is playing and there are some weird results. I set up a basic Resize effect and found that if I mouse out during the start delay, the effect is correctly cancelled. But if I mouseOut when the effect has started, the control continues to grow out of control.

Related

Stopping Swiperjs mid-transition

I would like to know a way to stop the swiperjs transition at the exact spot while it's transitioning.
What I currently have is a continuous autoplay loop combined with transition-timing-function : linear; on the swiper wrapper. This makes it look like it's constantly sliding one way in a fluent motion. On the background it is however always transitioning from slide to slide (and the transition-timing property makes it look fluent). What I would like to implement is when I hover the swiper, it stops at the exact position and when I leave the mouse it starts again. I have already implemented a fix to make it stop at the exact position using this link. When hovering out though, it moves too fast to the next translate3d point. This is because when starting it again, it takes the stopped position as the starting position of the transition, which is of different length so it moves at a different speed.
I've already gone as far as implementing an interval with the same speed count as the slider property to determine the progress of the animation from point to point so to from there be able to determine the transition-duration. For example when the slide transition is half way (in my case 3.5 seconds later as the speed I set is 7 seconds), I set the transition duration to 3500 on the swiper wrapper so that it moves at the same speed to the next point when hovering out.
This however is very buggy and relies on a continuous counter that starts upon loading the page (in mounted()), which isn't correct anymore after hovering a few times.
It's maybe a bit of a complex story but I would like to know if there are other ways of implementing this functionality, or how to somehow be able to know the current progression of the transition.
I'm building this in Nuxt 3 (vue.js framework) using the vue swiperjs library.
Thanks in advance

Android fragment transition callbacks

is there a way to detect that a fragment has started transition (in or out). What I am trying to acheve:
I have a fragment whcih has a SurfaceView with complex graphics in it. When I click on a button I want this fragment to slide away from the screen. But we all know, that SurfaceView can't be animated. So I want to replace it with a drawing cache bitmap before I start the transition.
There fore I need to know when the fragment starts transition. This is especially important for open transitions, because I call replace with image routine manually before out transition, but I need to know when the open transition was complete. Is there a better way than a timer (which seems awful to me).
Thanks.
P. S. compatibility lib
Off the top of my head I'd say attach an animation listener to the animations you are using (see Animation Listeners in the Android docs) ..depending on your situation this might mean you need to create and attach the animations in code, or you may be able to retrieve the animation and attach the listener when you create the component (activity/fragment). It depends on how your current implementation works, but the basic idea is to attach a listener to the animation that is about to run. The animation listener will tell you when the animation actually starts and actually finishes..

Flex 3 - sporadic erroneous mouse out events on slider thumb

The slider thumbs in my Flex 3 application usually work correctly, but often they seem to become insensitive to mouse downs on what should be thumbPress events.
It turns out that mouseOut events are being fired as the mouse moves away from the edge of the thumb towards the center. The thumb is sensitive to mouseDown events only when it is in the "over" state.
I am seeing the same behavior:
-- Displaying the default thumb rather than my custom class
-- Using a hitArea sprite (I tried a child TextInput sized to cover the thumb with alpha 0).
Can anyone suggest either a fix or a workaround? I can identify the faulty mouse out events, but then don't know how to compensate, for example, by reestablishing the "over" state, or perhaps with programmatic control of the mouse.
Thanks,
Peter
Nevermind, I figured this out myself. The mouse-out events are due to mostly invisible objects in the way -- the result of a workaround from long ago that I forgot about! :-(

fix needed for bug in TextField/Text

Sort of a complicated scenario - just curious if anyone else could come up with something:
I have a Text control and when I scroll it and stop the scroll with the cursor over some text that has a url, the cursor doesn't revert to a hand, and also flash player starts acting as if a selection is being made from the last cursor position. So IOW a bonafide bug in flash as far as I can determine.
The above probably wasn't completely clear so let me elaborate. If you grab a scrollbar thumb and start moving it up and down, you don't actually have to keep the mouse pointer on the thumb while doing so. When you stop the scroll, the mouse pointer could be outside the browser window, inside your flash application, but not currently on the scroll bar thumb, or wherever. The previously mentioned bug occurs when you stop the scroll with the mouse pointer positioned over text with an html anchor (a hyperlink). At that point the cursor enters into some state of limbo, and doesn't show the url hand pointer, and furthermore acts as if some text selection is taking place from the last cursor position prior to the scroll.
So the question would be, what sort of event could I simulate in code to jolt flash out of this erroneous state it is in. And furthermore in what event could I perform this simulated event (given that for example there is no AS3 event to signal the end of a scroll.)
To be clear, the Text control in question is on a canvas, and that canvas (call it A) is on another canvas which actually owns the scrollbar, and scrolling takes place by changing the scrollRect of canvas A.
I have run into this exact same problem with the TextArea in Flex 4: Scroll (textarea content is large than it's container) and release the mouse when over a link, and the cursor doesn't act right.
I think it's a bug, try submitting it to the Adobe Bug and Issue Management System. I will vote for it :).
Are you using Flex 3 or 4? If you're in Flex 4, I can make some suggestions. As a base, I would examine the TextArea and related source code in the Flex 3 SDK and figure out what events are being dispatched from links and whatnot. If you can eliminate the possibility that it's a Flash TextField (which TextArea uses), then it's a Flex bug. Try dispatching events that they're dispatching within the TextArea, from the things that are dispatching it (Event.CHANGE is all I can see taking a quick glance).
Good luck!
This is really in response to viatropos.
I was just able to duplicate the bug using the code example from the end of the Text documentation page in Flex 3.5 reference.
Just replace their htmlText in that example with a huge block of htmlText containing anchors tags (<a>...</a>). Then make the browser window small. Then click some arbitrary area of the htmlText with the mouse (That step is important.) Then scroll using the thumb. Stop the scroll with the cursor directly over one of the hyperlinks you created and release the mouse. The entire block of htmlText is selected and highlighted and the mouse pointer will not revert to a hand. (Well it will after you click somewhere else.)
As far as reporting this to adobe through their bug tracking system, I guess if I want to wait several months for it to be fixed. I reported another genuine bug over a year ago that was never fixed.
But examining their source code as you suggested - probably my best bet.

Flex: How can I drag the actual element rather than a proxy?

I'm trying to implement a dragging system which can only be described as similar to dragging the map on Google Maps. I can set up dragging easily in Flex, but unfortunately the standard model of dragging i.e. dragging an element proxy and dropping it in another element is not what I'm after.
Is there anything built into flex where the actual element rather than a proxy can be repositioned in a different place within the same parent? Or will I have to hand code something using mouse events as you would if implementing a solution in JavaScript?
Cheers,
Chris
DragManager and its associated constructs are specifically for dragging and dropping. You will likely want to place your draggable item inside of a canvas with scroll policies turned off, and capture MOUSE_DOWN on the object, then activate MOUSE_MOVE, translating its origin analogous to the change in mouse position, deactivating the MOUSE_MOVE listener when MOUSE_UP or Event.MOUSE_LEAVE fires on the stage.
Ok found a much more simple solution! Most elements have a dragStart and dragStop method which can be attached to the mouse down/up events.

Resources