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
Contributor
PBDeveloper
Posts: 12
Registered: ‎05-06-2011
My Device: Playbook
Accepted Solution

Image tag in htmlText property of TextField or Label - NOT WORKING

Hi

 

I want to display my html content on either qnx Label or flash TextField.

Both component have 'htmlText' property. I read from the below URL that it is possible to have img tag inside htmlText of both this, provided their 'multiline' and 'wordwrap' propert should be set to TRUE.

 

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/text/TextField.html#htmlText

 

I'm getting links and other styling tags worked. But the image is not loading.

 

I'm using Flash Builder 4 with latest SDK 1.0.1 and simulator.

 

Below is my as code:

 

package
{
    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.text.StyleSheet;
    import flash.text.TextField;
    import qnx.dialog.AlertDialog;
    import qnx.ui.text.Label;
    
    
    [SWF(width="1024", height="600", backgroundColor="#CCCCCC", frameRate="30")]
    public class HTMLDisplayDemo extends Sprite
    {
        
        private var myText:TextField;
        private var myLabel:Label;
        private var myCSS:smileyfrustrated:tyleSheet;
        
        public function HTMLDisplayDemo()
        {
            super();
            
            // support autoOrients
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            
            myCSS = new StyleSheet();
            
            myCSS.setStyle("a:link", { color: '#0000FF', textDecoration: 'underline'});
            
            myLabel = new Label();
            
            myLabel.textField.styleSheet = myCSS;
            myLabel.htmlText = "Link to <a href='http://www.google.com/'>Google</a>And <img src='http://demo.feathersoft.net/facebookrpc/models/images/apple1.jpg' alt='apple' width='20' height='20'  /> image..";
            
            myLabel.setSize(300, 52);
            myLabel.setPosition(20,20);
            myLabel.multiline    =    true;
            myLabel.wordWrap    =    true;
            
            addChild(myLabel);
            
            
            
            myText = new TextField();
            
            myText.styleSheet = myCSS;
            myText.htmlText = "<br><br>Link to <a href='http://demo.feathersoft.net/facebookrpc/models/images/apple1.jpg'>Feathersoft</a>Then <img src='http://demo.feathersoft.net/facebookrpc/models/images/apple1.jpg' alt='apple' width='20' height='20'  /> And image.";
            myText.width    =    myText.textWidth+100;
            myText.height    =    myText.textHeight+100;
            myText.multiline    =    true;
            myText.wordWrap        =    true;
            addChild(myText);
        
            stage.nativeWindow.visible    =    true;
            
        }
        
        
    }
}

 

 

Is ther anything i'm missing or incorrect? PLS HELP ME?

I can't complete my project without this.

Thanks

Please use plain text.
Developer
pyth
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane

Re: Image tag in htmlText property of TextField or Label - NOT WORKING

[ Edited ]

you can't do that because anything higher than html 1 can't be used :/ (and currently it's html 5). it's a known problem. all you can do is the following things:

 

- you parse your content and create text and image separately (using the qnx image class), which has the problem that you won't be able to display other tags which are also not defined (like <sub> etc)

- you use QNXstageWebView, which has other problems as it takes up the stage

- you don't use flash, but html and webworks

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Please use plain text.
Contributor
PBDeveloper
Posts: 12
Registered: ‎05-06-2011
My Device: Playbook

Re: Image tag in htmlText property of TextField or Label - NOT WORKING

Thanks for your help...i'm trying to move with the second option now...
Please use plain text.
Contributor
PBDeveloper
Posts: 12
Registered: ‎05-06-2011
My Device: Playbook

Re: Image tag in htmlText property of TextField or Label - NOT WORKING

Finally i made my qnxwebstageview zOrder to -1 and stage as transparent. And able to put other controls over web view then..Ask me if any one need more details
Please use plain text.