Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Context Menu troubles (performance, getting stuck, doesn't scroll...)

Are you also having trouble with the context menus?

 

I used to work with the Tablet OS SDK until now, but for the BB10, it's better to go with the flow :smileyvery-happy:. Unfortunately, I'm very disappointed how it has been realized, even though I'm using the latest SDK 3.1.3

 

1) the scrolling and the animation performance is disappointing. Even before, I was disappointed in the List classes on PlayBook, until I created my own list components (and working with lots of bitmaps). Now I can see, it's still the same component which is comparatively slow :/. And what's worse, it looks like it's being used in the context menus as well.

 

2) it seems buggy and the context menu get's stuck. I'm here on a Dev Alpha C, opening the menu on the left for

the first time, and I get ... nothing. It takes about 2 seconds until the menu is showing up, but without animation. Afterwards, it works okay...except that the menu gets stuck. Maybe that's only an issue on DevC, but still, that's kinda sad (see screenshots. It's not like I'm holding my finger down, it really got stuck)

 

IMG_00000001.png

 

context menu opened normally

 

IMG_00000002.png

 

List in context menu got stuck. It also stays like that.

 

 

 

 

For testing, I put together several snippets I have found here in this forum

 

package {
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Sprite;

import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;

import qnx.fuse.ui.actionbar.ActionBar;
import qnx.fuse.ui.core.Action;
import qnx.fuse.ui.core.ActionBase;
import qnx.fuse.ui.core.ActionSet;
import qnx.fuse.ui.core.TabAction;
import qnx.fuse.ui.events.ActionEvent;
import qnx.fuse.ui.events.ContextMenuEvent;
import qnx.fuse.ui.events.DragEvent;
import qnx.fuse.ui.listClasses.List;
import qnx.ui.data.DataProvider;

[SWF(width="600", height="1024", backgroundColor="#ff00ff", frameRate="60")]
public class BaseProject extends Sprite {

    [Embed (source='/assets/test.png')]
    private var edit_icon:Class;
    [Embed (source='/assets/test.png')]
    private var map_icon:Class;
    [Embed (source='/assets/test.png')]
    private var trash_icon:Class;

    private var poi_list:List;

    private var actionBarOverflow:Sprite;
    private var content:Sprite = new Sprite();

    private var slideX:Number = 0;

    public function BaseProject() {
        super();
// support autoOrients
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;
        stage.addEventListener(Event.RESIZE, function(e:Event):void {
            actBar.y = stage.stageHeight - actBar.height;
        });

        content.addChild(new Bitmap(new BitmapData(stage.stageWidth, stage.stageHeight, false, 0xffffff)));
        // support autoOrients
        stage.align = StageAlign.TOP_LEFT;
        stage.scaleMode = StageScaleMode.NO_SCALE;

        var dp:DataProvider = new DataProvider();
        dp.addItem({"label":"item1"});
        dp.addItem({"label":"item2"});
        dp.addItem({"label":"item3"});
        dp.addItem({"label":"item4"});
        dp.addItem({"label":"item5"});
        dp.addItem({"label":"item6"});
        dp.addItem({"label":"item7"});
        dp.addItem({"label":"item8"});
        dp.addItem({"label":"item9"});
        dp.addItem({"label":"item10"});
        var list:List = new List();
        list.dataProvider = dp;

        actionBarOverflow = new Sprite();

        var actBar:ActionBar = new ActionBar();
        actBar.showTabsFirstOnBar(false);
        actBar.reserveActionSpace(true);
        actBar.backButton = null;

        actBar.tabOverflowParent = actionBarOverflow;
        actBar.width = stage.stageWidth;
        actBar.showTabsFirstOnBar(false);
        actBar.addAction(new TabAction("TEST", new edit_icon()));
        actBar.addAction(new TabAction("TEST2", new edit_icon()));
        actBar.addAction(new TabAction("TEST3", new edit_icon()));
        actBar.addAction(new TabAction("TEST4", new edit_icon()));
        actBar.addAction(new Action("Test1", new edit_icon()));
        actBar.addAction(new Action("Test2", new edit_icon()));
        actBar.addAction(new Action("Test3", new edit_icon()));
        actBar.addAction(new Action("Test4", new edit_icon()));
        actBar.addAction(new Action("Test5", new edit_icon()));
        actBar.addAction(new Action("Test6", new edit_icon()));
        actBar.addAction(new Action("Test7", new edit_icon()));
        actBar.addAction(new Action("Test8", new edit_icon()));
        actBar.addAction(new Action("Test9", new edit_icon()));
        actBar.addAction(new Action("Test0", new edit_icon()));

        addChild(actionBarOverflow);
        addChild(content);
        content.addChild(list);
        content.addChild(actBar);

        actBar.x = 0;
        actBar.y = stage.stageHeight - actBar.height;

        list.width = stage.stageWidth;
        list.x = 0;
        list.height = (stage.stageHeight - actBar.height);
        list.y = 0;

        var actionsForBar:Vector.<ActionBase> = new Vector.<ActionBase>;
        actionsForBar.push(new ActionBase("Action 1", new edit_icon()));
        actionsForBar.push(new ActionBase("Action 2", new edit_icon()));
        actionsForBar.push(new ActionBase("Action 3", new edit_icon()));
        actionsForBar.push(new ActionBase("Action 4", new edit_icon()));
        var actionset:ActionSet = new ActionSet(actionsForBar);
        var contextactions:Vector.<ActionSet> = new Vector.<ActionSet>();
        contextactions.push(actionset);

        list.contextActions = contextactions;

        actBar.addEventListener(DragEvent.DRAG_MOVE, onDragMove);
    }

    private function onDragMove(event:DragEvent):void {
        slideX += event.deltaX;
        content.x = Math.round(slideX + stage.stageWidth);
    }
}
}

 

 

 

Have you also made that experience? Or even better, do you have any tips/hints how to make it better :/?

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 225
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

Hi,

Did you manage to get the context menu to work?
I'm looking for a working example.

Can you help me with it? :smileyhappy:

Thank you

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

if I remember correctly, the context menu worked - just create a new project and copy the code to see for yourself

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 225
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

I tried it but the context menu shows only the default items (copy / paste...)

 

Would you be so nice to upload your source file? That would really help me! :smileyhappy:

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

I don't have the code anymore - also, it should work with the code I pasted on the top (because I always paste the full source code when I need help)

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

also, when you want to modify the context actions of a textfield, can't you just add your own action to the actionset of the textfield? (or overwrite it)

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 225
Registered: ‎03-14-2012
My Device: PlayBook 2.0
My Carrier: AT&T

Re: Context Menu troubles (performance, getting stuck, doesn't scroll...)

Thanks for your answer.

I don't know what I'm doing wrong, but it won't work.

Any ideas? :/

 

 

I'm using Flash CS6 and Air 3.1 btw