as3 Native Alert

I’m currently working on this mobile project that requires using a StageWebView component. The problem with that component is as some of You have noticed it’s not in the standard flash display list. It’s a component that can cover everything even a popup displaying a error message. There are two ways to solve that popup error.
One is :every time something should be shown use the drawViewPortToBitmapData method.
The second solution is to use the native extension to create a native alert like in this tutorial liquid-photo

Love the work that the guys form Liquid-photo have done. But… I can’t imagine to debug everything on IOS. Using windows to do that is long and annoying.So I made some changes to their project on github.

The basic change is that I’v added a extension for Windows platform.So there is no more annoying error of incompatible components.
First I was using a simple trace message. But that didn’t work. It doesn’t allow everything that a simple popup with multiple buttons can do.

The second change is in the action script library. In Air on desktop there is a library called Alert. It enables static method show. I’v tried to make my library similar.

Grab the source from github:
https://github.com/mateuszmackowiak/NativeAlert

Usage:

NativeAlert.show( "some message" , "title" , "first button label" , "otherButtons,LabelsSeperated,WithAComma" , someAnswerFunction);

Remember to always dispose before closing the app.

NativeAlert.dispose();

I’v also added a static function isSupported Like adobe recommends.

Advertisements

4 thoughts on “as3 Native Alert

  1. T Graham says:

    Great work. Thanks for sharing all of these extensions.

    A note: you’ve implemented isSupported as a property instead of a method, which means the example code in README.md throws an error. There’s also a typo. It should be:

    if(NativeAlert,isSupported) …

  2. T Graham says:

    …and I see there’s a typo in my first post. That comma should be a period:

    if (NativeAlert.isSupported)

  3. Just tested the apk on my Asus Transformer Prime ICS 4.0.3 and.. works fine :-)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: