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
New Developer
Tjitte
Posts: 100
Registered: ‎10-31-2010
My Device: Dev Alpha C and PlayBook
Accepted Solution

BaseDialog and addChild

Hello,

 

Can you add a object to a BaseDialog with addChild?

I tried it but the child object is not showing.

 

Tjitte


My PlayBook app:
DrawBook
Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: BaseDialog and addChild

hey Tjitte,

 

The BaseDialog (and all dialogs since they extend the basedialog) is a service on the AIR runtime. Therefore not an actual object you can add to. You can only set a few variables and settings but other nothing can be added using the addChild() method. That being said, however, you can add objects and such using the messageHTML property of the AlertDialog class. Doing so you can add images and formatted text just like an HTML page. Here is an example from the QNX AsDocs:

 

 

var dialog:AlertDialog = new AlertDialog();

dialog.messageHtml = "<img src='http://www.somewebsite.com/somegraphic.jpg' width='500' height='350'/>";

 

This will add an image from an external source into your alert. hope that helps. good luck!

 

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
Please use plain text.
New Developer
Tjitte
Posts: 100
Registered: ‎10-31-2010
My Device: Dev Alpha C and PlayBook

Re: BaseDialog and addChild

Using HTML is very clever.
Thank you for your help.

Tjitte

My PlayBook app:
DrawBook
Please use plain text.
New Developer
Tjitte
Posts: 100
Registered: ‎10-31-2010
My Device: Dev Alpha C and PlayBook

Re: BaseDialog and addChild

[ Edited ]

I tried the following code:

 

dialog.messageHtml = "<img src='file://path/to/file.png' width='500' height='350'/>";

 

but it won't show the image.

Is it posible to show a local file with this method?


My PlayBook app:
DrawBook
Please use plain text.
New Developer
jjackson
Posts: 18
Registered: ‎11-14-2010
My Device: Not Specified

Re: BaseDialog and addChild

Try changing "file:" to "app:".  Don't know if it will help, but I remember seeing this in one of my apps.

Please use plain text.
New Developer
Tjitte
Posts: 100
Registered: ‎10-31-2010
My Device: Dev Alpha C and PlayBook

Re: BaseDialog and addChild

Thank you for your reaction.

Changing "file" to "app" didn't work.


My PlayBook app:
DrawBook
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BaseDialog and addChild

Does it work when the image url is to some external web site?

Please use plain text.
Contributor
baibhav
Posts: 11
Registered: ‎12-10-2010
My Device: Not Specified

Re: BaseDialog and addChild

I was thinking about extending one of the dialog classes to have multiple text inputs. So does this mean that i cannot acheive this via extension? If not then any suggestion on another good way of doing this?

 

Thanks,

Baibhav

Please use plain text.
Developer
JRab
Posts: 2,462
Registered: ‎11-04-2010
My Device: Bold 9700

Re: BaseDialog and addChild

@jtegen: I cant get any images to load up. dont know if its my network settings or if this is a bug in the message html. it formats the text fine but does not import images. ill keep working on it.

 

@Tjitte: I havent been successful yet in importing any sort of image. ill keep at it. ill update you if i find anything. but from the ASDocs only external images are (supposed to be) supported.

 

@baibhav: users have tried to extend the basedialog class but have failed. we assumed because it is not an actual physical object more of a service type class in the playbook. that or becasuet here is something else going on in the class we are not aware of.

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
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: BaseDialog and addChild

It was discussed in one of the webinars that the Dialog structure is a service on the playbook.  They mentioned that it was to ensure a common look and behavior across all applications. (dont shoot the messenger)

Please use plain text.