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
Highlighted
Developer
Posts: 409
Registered: ‎12-10-2010
My Device: PlayBook
My Carrier: N/A
Accepted Solution

DialogEvent Bug?

[ Edited ]

i'm attempting to use the DialogEvent class, which, as i assume, should return the text (label) of the clicked button from a dialog.  however, nothing is returned.

 

 

import flash.display.Sprite;
import qnx.ui.buttons.LabelButton;
import qnx.dialog.AlertDialog;
import qnx.dialog.DialogSize;
import qnx.events.DialogEvent;

[SWF(width="1024", height="600", framerate="60")]
public class DialogTest extends Sprite
{
public function Test()
	{
	var button:LabelButton = new LabelButton();
	button.label = "Show Alert";
	button.x = button.y = 200;
	button.addEventListener(MouseEvent.CLICK, mouseEventHandler);
	
	addChild(button);
	}

private function mouseEventHandler(evt:MouseEvent):void
	{
	var alert:AlertDialog = new AlertDialog();
	alert.title = "Alert Dialog Title";
	alert.message = "This is text for the alert dialog.";
	alert.addButton("Great!");
	alert.addButton("No Problem!");
	alert.dialogSize= DialogSize.SIZE_SMALL;
	alert.addEventListener(DialogEvent.DIALOG_BUTTON_CLICKED, alertButtonHandler); 
	alert.show();
	}

private function alertButtonHandler(evt:DialogEvent):void
	{
	trace(evt.responseBtnText);
	}
}

 

 

neither of the DialogEvent's properties (responseBtn, responseBtnContext, responseBtnText) are traced as the alertButtonHandler function isn't even called when one of the buttons in the alert dialog is clicked.

 

i realize that the documentation uses event.target.selectedIndex (though the event listener only works if it's Event.SELECT) for the dialog buttons, but what is the purpose of the DialogEvent class if it's not usable in this situation?

 

thoughts?

 

 

 


PlayBook Applications:
Drop Swatch
Developer
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: DialogEvent Bug?

hey,

 

yeah we preivously chocked this up as a bug but juat as you mentioned a user found that Event.SELECT can get the job done. Hopefully they can get this fixed in the next release. Here's the link to the previous page:

 

http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/Strange-Dialog-Behaviour/td-p/668...

J. Rab (Blog) (Twitter)
--
1. If you liked my post or found it useful please click on the thumbs up and provide a Like!
2. If my post solved your problem please click on the Accept as Solution button. Much appreciated!

Approved Apps: OnTrack | ssShots | Hangman