My new ANE for displaying «Loading» status [Updated for x64 ARM support]

Share Button

Update 08-01-2015: I received a lot of emails about x64 CPU support in this extension. Sorry for delay, I was on Christmas holidays. Extension is ready and uploaded at same place.

Today I started my own labs — http://labs.gamespoweredby.com. Will update when have a new content.

At this moment you can grab my newest Adobe Air native extension for iOS. Using it you can add screen overlay with spinning preloader like this one:
UIActivityIndicatorView

There is no predefined sets of styles. You can customize it as you wish :)
- Change background color using ARGB uint (0xFF 100% alpha, 0xFF 100% red and so on..)
- Change spinner color using ARGB uint
- Change spinner style. There is only two styles available

After show() call — Adobe Air will be blocked from any MouseEvent or TouchEvent. Call hide() for unblocking the same as for removing spinner from display.

Controller will be opened by 100% width and 100% height with centered spinner.

Reference available here. Native Extensions is here.

Usage:

    import gamespoweredby.ui.UIActivityIndicatorView;
    import gamespoweredby.ui.UIActivityIndicatorViewStyle;

    // Add spinning overlay
    UIActivityIndicatorView.show(UIActivityIndicatorViewStyle.UIActivityIndicatorViewStyleWhite, 0xaa000000,0xff000000);

    // Remove spinning overlay
    UIActivityIndicatorView.hide();

Any ideas are welcome!

UPD: I added Callback function. Use it if you need to know when Spinner on the screen. Seems AIR hogs CPU on some huge computations and native spinner can’t be shown if it added immediately before CPU was loaded. Simple Display can’t be redrawn immediately. So using Callback you can easy get full power of it:

import flash.events.MouseEvent;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.StageScaleMode;
import flash.display.StageAlign;

import gamespoweredby.ui.UIActivityIndicatorViewStyle;
import gamespoweredby.ui.UIActivityIndicatorView;
import flash.events.Event;

stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;

var img : Bitmap = new Bitmap();
addChildAt(img,0);

test.addEventListener(MouseEvent.CLICK, onTest);

function onTest(e:MouseEvent):void{	 
	UIActivityIndicatorView.show(UIActivityIndicatorViewStyle.UIActivityIndicatorViewStyleWhiteLarge, 0xaa000000,0xffffffff, loadCPU);
}

function loadCPU(){

	var bitmap : BitmapData = new BitmapData(2048, 2048, false);
	bitmap.noise(7);
	img.bitmapData = bitmap;

	UIActivityIndicatorView.hide();

}

FAQ:
Q: Ok, why only iOS?
A: I don’t have own Android. My job is iOS apps. But if you can help with porting this iOS solution to Android — this may be great! Contact me!

Q: You have a lot of typo in your English!
A: Yes, I know. I never learned it. If you can correct my mistakes — email me!

Share Button

This Post Has Been Viewed 9,813 Times

My new ANE for displaying «Loading» status [Updated for x64 ARM support]: 15 комментариев

  1. Jeff Ward

    So, I presume this is useful as a native extension because it allows a moving on-screen spinner while the CPU is throttled in AS3 (which means the display does not update)?

    1. TheRabbit Автор записи

      Yes, Jeff. When Adobe Air display is not updating — this spinner still works because it’s native. In my own project users must wait without any updates on the display and they think ‘app have bugs or stuck’.

      Using this extension you can show some activity when Adobe Air doing something and not updating it’s display.

      In the near future (really soon) I will add Android support and text caption ;)

  2. Уведомление: Нативный загрузчик | FlashPress.ru - ActionScript 3.0 и Adobe Flash

  3. paul

    Hey i get this warning when deploying my app ( otherwise it works fine ) // —> on iOS7
    »
    Packaging successful!
    Packaging output:
    ld: warning: CPU_SUBTYPE_ARM_ALL subtype is deprecated: /Users/pol/DEV/air14_sdk
    _mac/lib/aot/lib/libNoDebugger1.arm-air.a(avmplusDebuggerStubs.cpp.o)
    »
    any idea?

        1. TheRabbit Автор записи

          Ok as I see that warnings comes when I publish ANE with next cpu type:
          -armv7
          -armv7s
          -arm64

          Adobe Air can’t use armv7s and arm64 cpu’s code and just ignoring it and showing that warnings. So don’t worry. Adobe Air will automatically use armv7 compile it for iOS. If I recompile only with armv7 support — Adobe Air SDK will not show similar warnings. But finally this not affect on Adobe Air app.

    1. TheRabbit Автор записи

      Actually I use Adobe Flash CC 2014 and it’s (as all prevoius) extract ID’s during linking. In your case you can extract ActivityIndicator.ane as default ZIP file and there you can find META-INF\ANE\ folder.

      Open there extension.xml and you will see gamespoweredby.ui.UIActivityIndicatorView

  4. Paul Ollivier

    Hi, thanks for the amazing work!

    I’ve been using your ANE so far in my apps and it’s working great,
    but with the new 64bit SDK i now get the following error when packaging :

    Packaging failed!
    Packaging error message:
    Error: libActivityIndicator.a is required to have universal iOS libraries.
    Please contact the ANE developer(s) to get the same.

    is it possible for you to re-compile and include the universal iOS libraries? Thanks in advance!

  5. Fréderic Cox

    Hi,

    Tried your native extension and it is working really nice! Great stuff! Is it also possible to display a custom loader? We use custom loaders in our applications and it would be perfect if we could use the same one in your native extension. Possible to add the path to a gif file or image sequence / spritesheet ?

Добавить комментарий

Ваш e-mail не будет опубликован.

Blue Captcha Image Новый проверочный код

*

Можно использовать следующие HTML-теги и атрибуты: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>