How do to call the BlackBerry menu form share an Adobe Air application?

Hello

I'm looking for a tutorial or demo code that describes how to call the BlackBerry menu sharing an Adobe Air based application.

I found a tutorial of waterfalls for it - there's one for Adobe Air too?
- http://bbcascadescode.tumblr.com/post/38998702671/invoke-share-for-bb10

This is a screenshot of the Action menu:

Advice welcome!

Here you go:

package com.lib.playbook.invocation
{
    import com.lib.playbook.controls.List;
    import com.lib.playbook.pages.TitlePage;
    import com.lib.playbook.renderers.IconListRenderer;

    import flash.events.Event;
    import flash.events.IEventDispatcher;

    import qnx.events.InvokeEvent;
    import qnx.events.InvokeQueryTargetEvent;
    import qnx.fuse.ui.core.Action;
    import qnx.fuse.ui.events.ActionEvent;
    import qnx.fuse.ui.events.ListEvent;
    import qnx.invoke.ActionQuery;
    import qnx.invoke.InvokeManager;
    import qnx.invoke.InvokeRequest;
    import qnx.invoke.InvokeTarget;

    public class InvokeSearchPage extends TitlePage
    {
        private var request : InvokeRequest = null;
        private var targets : List = new List();

        /////////////////////////////////////////////////////////////////////////////////////////
        public function InvokeSearchPage()
        {
            super();
            this.title = 'Search With';
            this.titlebar.dismissAction = new Action( 'Cancel', null, {id:'cancel'} );
            this.titlebar.addEventListener(ActionEvent.ACTION_SELECTED, ActionSelected );

            this.targets.cellRenderer = com.lib.playbook.renderers.IconListRenderer;
            this.targets.addEventListener(ListEvent.ITEM_CLICKED, TargetSelected );
            this.targets.rowHeight = 140;
            this.addChild( this.targets );
        }

        ///////////////////////////////////////////////////////////////////////////////////////////
        public function filter( request :InvokeRequest ) : void
        {
            this.targets.removeAll();

            this.request = request;

            //trace( 'filter ' + request.mimeType );
            InvokeManager.invokeManager.addEventListener( InvokeQueryTargetEvent.SUCCESS, TargetsFound );
            InvokeManager.invokeManager.queryInvokeTargets( request.mimeType, request.uri, request.action, request.targetOptions );
        }

        ///////////////////////////////////////////////////////////////////////////////////////////
        private function TargetsFound( event : InvokeQueryTargetEvent ) : void
        {
            InvokeManager.invokeManager.removeEventListener(InvokeQueryTargetEvent.SUCCESS, TargetsFound );
            //trace( 'TargetsFound' );
            var action : ActionQuery;
            var target : InvokeTarget;
            for each( action in event.actions )
            {
                for each( target in action.targets )
                {
                  this.targets.addItem( { data : target.target, label : target.label, icon : 'file://' + target.icon } );
                }
            }
        }

        ////////////////////////////////////////////////////////////////////
        private function TargetSelected( event :Event ) : void
        {
            if( this.targets.selectedIndex >= 0 )
            {
              this.request.target = this.targets.selection;
              InvokeManager.invokeManager.invoke( this.request );
            }
        }

        ////////////////////////////////////////////////////////////////////
        private function ActionSelected( event :ActionEvent ) : void
        {
            switch( event.action.data.id )
            {
                case 'cancel' : this.dispatchEvent( new Event( Event.CANCEL ) ); break;
            }
        }

        //////////////////////////////////////////////////////////////////////
        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList( unscaledWidth, unscaledHeight );

            this.targets.setPosition( 10, this.top + 10 );
            this.targets.setActualSize( unscaledWidth - 20, unscaledHeight - this.targets.y - 10 );
        }
    }
}

And the rendering engine:

package com.lib.playbook.renderers
{

    import qnx.fuse.ui.display.Image;
    import qnx.fuse.ui.listClasses.CellRenderer;

    public class IconListRenderer extends CellRenderer
    {

        private var icon    :Image = new Image();

        /////////////////////////////////////////////////////////////////////////
        public function IconListRenderer()
        {
            super();
        }

        ///////////////////////////////////////////////////////////////
        override protected function onAdded():void
        {
            super.onAdded();
            this.addChild( this.icon );
        }

        ///////////////////////////////////////////////////////////////
        override protected function onRemoved():void
        {
            super.onRemoved();
            this.removeChild( this.icon );
        }

        /////////////////////////////////////////////////////////////////////////////////////
        override protected function drawLabel(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.drawLabel( unscaledWidth, unscaledHeight );

            if( this.data )
            {

                if( this.data.hasOwnProperty( 'icon' ) && this.data.icon != null )
                {
                    this.icon.setImage( this.data.icon );
                    this.icon.setPosition( 10, 15 );//( unscaledHeight - this.icon.height ) / 2 );
                }
                else
                {
                    this.icon.setImage( null );
                }

            }

            this.label.x = 140;
            this.label.width = unscaledWidth - this.label.x - 20;
        }
    }
}

references com.lib.playbook our our inner classes, but you should get the approach to apply.

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for