Inline link possible?

13 views
Skip to first unread message

fb6668

unread,
Nov 20, 2011, 5:46:43 AM11/20/11
to htmlwrapper
I'm trying to insert a simple inline link, using the following HTML:

<div>This is a <a href="http://www.google.com" target="_blank">simple
inline</a> link</div>

However, it overlays all the different elements of the div ("this is
a", the link text and "link") rather than displaying them inline.

Is this a bug and any ideas on a workaround?

Thanks

Tyler Larson

unread,
Nov 21, 2011, 9:57:16 AM11/21/11
to htmlw...@googlegroups.com

I'm not sure, it sounds like this might be a bug but there are examples with this not happening so it must be something you are doing I'm thinking.

> --
> You received this message because you are subscribed to the Google Groups "htmlwrapper" group.
> To post to this group, send email to htmlw...@googlegroups.com.
> To unsubscribe from this group, send email to htmlwrapper...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/htmlwrapper?hl=en.
>

fb6668

unread,
Nov 21, 2011, 11:41:42 AM11/21/11
to htmlwrapper
Thanks for the reply. Where are the examples?

All I've done is this:

Created a wrapper so I can use it as a component (I also added
functionality here to take a url parameter but I'm not using this for
this example) .... see code below.
Then I simply have a test application with the following:

<fx:Script>
<![CDATA[
[Bindable]
public var html:String = "<div>This is a link to <a href='http://
www.google.com'>google</a> site</div>";
]]>
</fx:Script>


<astrid:HTMLWrapper width="400" height="400" html="{html}" />


So I can't really see where I'm going wrong?

package astrid
{
import astrid.framework.controller.Controller;
import astrid.framework.view.html.Navigator;
import astrid.framework.view.html.Window;

import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;

import mx.core.UIComponent;
import mx.events.FlexEvent;

public class HTMLWrapper extends UIComponent
{
private var controller:Controller;
private var navigator:Navigator;
private var window:Window;

private var _url:String;
public function get url():String
{
return _url;
}
public function set url(value:String):void
{
_url = value;
if(value != null)
getHtml();
}

private var _html:String;
public function set html(value:String):void
{
_html = value;
if(window)
window.frames[0].getLayer(0).innerHTML = html;
}
public function get html():String
{
return _html;
}

public function HTMLWrapper()
{
super();
addEventListener(FlexEvent.CREATION_COMPLETE,
creationCompleteHandler);
}

private function creationCompleteHandler(event:FlexEvent):void
{
controller = new Controller( this );
navigator = new Navigator( controller );
window = new Window( navigator, this.width, this.height );
this.addChild( window );

if(html)
window.frames[0].getLayer(0).innerHTML = html;
}

private function getHtml():void
{
var loader:URLLoader = new URLLoader(new URLRequest(url));
loader.addEventListener(Event.COMPLETE, onLoadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onLoadError);
}

private function onLoadComplete(event:Event):void
{
html = event.currentTarget.data.toString();
}

private function onLoadError(event:IOErrorEvent):void
{
//TODO: handle

Reply all
Reply to author
Forward
0 new messages