Gesture Events and StageWebView - apache-flex

Greetings! I have a Flex 4.5 Mobile project rolling, and I've hit a pretty crazy snag. I'm using a StageWebView object to render web pages, embedded within the rest of my spark layouts. I'm trying to add a gesture event to the component that contains the StageWebView, but since the StageWebView object doesn't belong to the Flex stack (it inherits from EventDispatcher, not UIComponent) all of my events seem to be getting eaten. Any mouse based event (click, gesture, etc) doesn't seem to register, and I'm not sure how to get around it. The gesture events work if I use the area where the browser is not rendered. How can I get the gesture event from the outer SkinnableContainer?
StageWebView Reference:
http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/flash/media/StageWebView.html
UIComponent Wrapped StageWebView:
http://soenkerohde.com/2010/11/air-mobile-stagewebview-uicomponent/
Thanks!

I guess you might have to wire up the gesture events yourself, just doing a quick digging in UIComponent.as, it has these:
[Event(name="touchInteractionStarting", type="mx.events.TouchInteractionEvent")]
[Event(name="touchInteractionStart", type="mx.events.TouchInteractionEvent")]
[Event(name="touchInteractionEnd", type="mx.events.TouchInteractionEvent")]

it's not a bug, from what i understand any mouse interaction over a stagewebview means an interaction with the html currently loaded in itself. you should capture events there and trigger it back to the swf.
surely there are some jquery plugins or something that have gestures to help achieving that.
it's a bit of a bummer that you cant overlay stuff over them though.

Related

Possible to implement draggable view with Xamarin Forms without using native Andriod/IOS code?

Is it possible to implement a draggable view with Xamarin View? Is there basically an event that I can use that gets triggered when a finger is pressed on the screen, then moved and then released without having to use native Android/iOS code? I don't mean a swipe event, I know this exists. I am looking for a event so I can let the user be able to drag a rectangle across the screen for example.
Looked for it on the internet, but can only seem to find just normal Touch, Swipe and Tap events. (Although I found it is possible using native Android/IOS code.

Does Flex fire an event after a chart is rendered in UI?

I am looking for an event which is fired (if any) after a chart is rendered (visible in UI) in Flash, we are using Flex SDK 3.0. We have to capture the screenshot after the chart is rendered, current implementation adds a huge delay in update_complete event callback, this is slowing down the whole job of generating images.
I tried to use EXIT_FRAME event, but this doesn't seem to serve the purpose. Any help to resolve this issue is highly appreciated.
Regards,
Dan
Adobe use this event : mx.events.FlexEvent.TRANSFORM_CHANGE
But if you want to use it, you are obligate to inherit from Chart Component classes. Take a look at DataTransform Class.
http://help.adobe.com/es_ES/FlashPlatform/reference/actionscript/3/mx/charts/chartClasses/DataTransform.html
I suggest you to look at the DisplayObject liveDoc, where there are several types of events. Some are fired before the rendering (Event.RENDER), some are fired after specific operation (ResizeEvent, for instance). But if you really want to know when you chart has been rendered, why don't you watch for the validation methods (updateDisplayList(), commitProperties()) by overriding them in a child class and fire a custom event in there ?

Best way to do loaders in a flex application?

What is the best way to do a loader in a flex application? I have an animated .gif that is to be used as our loader (whenever I need to wait for an action to complete), and I am not sure the best way to do it.
This is how I am thinking:
Have the loader be a custom component.
On the parent application, add an event listener for my custom event AceEvent.SHOW_LOADER.
In the event listener, use the PopUpManager to show the loader.
Listen for AceEvent.HIDE_LOADER.
Get rid fo the loader via PopUpManager.
What do you think about this? Is there a better way to do it?
Thanks!
Andrew
Well, last I checked, animated gifs don't work in Flex unless you have a workaround. Still, I wouldn't use an animated gif to create an animation because of their low quality. I would just recreate it using Flash.
The way I would do the loader however would be very different. personally, I don't believe in 'system loaders' unless it's your application's preloader. The reason for this is that there could be more than one thing loading at the same time (which might not know about each other) which means that the loader popup could disappear before everything is loaded (first one loads, dispatches event and removes popup, while the other is still loading).
What I like to do is create a custom component for the popup loader (since it will be reused quite a bit) and from there I can either use states the are appropriate for my view or have a boolean flag binded to show the popup when true (this can easily be done using frameworks like Parsley). The popup would only cover the part of the system that's actually loading data (since I doubt that your whole app is loading data at the same time) which makes for a better UX.
I ended up using as3gif (until I can get this recreated as a .swf). The way I do this is by using my custom event class (AceEvent.SHOW_LOADER and AceEvent.HIDE_LOADER), which bubbles up to the top. I then use the PopUpManager to add/remove this with modal to disable the application.

Can a flex app (or a portion of a flex app) be made transparent to mouse clicks?

I need to superimpose my Flex app above a plain HTML control on a web page, and be able to click through the Flex app to interact with the HTML control. Is there any way to do this? No permutation of mouseEnabled="false" or mouseChildren="false" seems to have the desired effect.
Context: trying to integrate Google Earth API (JavaScript/HTML) with my flex app. I am leaving a portion of the flex app transparent and empty, and positioning the Google Earth widget just below that point in the z-index. Google Earth has to be behind flex, because there are some Flex controls periodically displayed in that space.
I'm pretty sure there is no direct way for you to get mouse events to go through a Flash app.
You may be able to accomplish this with a combination of Javascript. Flash can call Javascript on your page, so you can create a function that passes clicks detected by Flash to the function and it will send the event to the page below it. I'm not 100% this will work but it's worth a try (You might have some trouble getting the correct coordinates).
Have you considered embedding Google Earth into the Flex app?
Some example here

Context menu for loaded SWF

I have a Flex app with a viewport that loads a series of other swfs. I would like to place a context menu over top of the SWFs when the user right-clicks. To that end, I have set up a fairly standard context menu where each item has a ContextMenuEvent.MENU_ITEM_SELECT event handler. One problem: The eventHandler never gets called.
If I place the context-menu code anywhere else in the app, i.e. not on top of a loaded SWF, everything works fine. However, when I place the exact same code on the SWF viewport, the context menu items appear, but the eventHandlers are never called. Any ideas?
I'm not sure I understand your problem, but this is my insight.
The SWF is embedded and can only be expected to change the visual appearance of your Flex app, but you cannot expect the embedded SWF to do the work of dispatching events as well. You will need to "bubble out" the events into the SWF's parent(s) and let the parent deal with the event.
http://www.adobe.com/devnet/flex/articles/itemrenderers_pt1.html
Let me know, thanks!
i think is because the event doesn't bubble up to your app where you have the listeners.

Resources