Jason,
The funny thing is, Steven said that my question was a bit off-topic for
the Gaia forum, and recommended I try this place. ;)

I know it's possible as I've seen it done, for example, on Steven's page
here:

http://stevensacks.net/clients/hello/press.html#/agency/press (if you
look at the code, it's pretty straightforward HTML tags, without CDATA
around them)

And also:
http://flashden.net/item/elite-html-content-page-with-scroller/full_scre
en_preview/27908 (but that is using AS2, and I'm coding the site in
AS3).

If I may explain, basically all I'm trying to do is create SEO-friendly
XHTML pages on which the written content for each page is stored and
that is where I will pull the content from. On occasion, I will need to
provide links to other pages. If anyone knows of a better way of doing
this, I'm all ears!

Thanks,
Jonathan Wing
Graphic Designer
Cram Crew, Inc.
mobile: (713) 298-2738
office: (713) 464-CRAM (2726) 
email: jw...@cramcrew.com
www.cramcrew.com

"One Student At A Time"


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill,
Jason
Sent: Thursday, May 21, 2009 12:29 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

Well, part of your question is a Gaia framework question which is
off-topic for this forum.  I don't know much about that framework other
than it's purpose and creator.  

As for your question about the tags parsing:

>> It will not parse the HTML tags; it will treat them like a regular
string of text, even though my text box has "render text as HTML"
selected.

Two issues:  1) Flash only has a limited set of tags it supports in HTML
for text.  Tags like <div> and <h1> I don't believe are one of them.
You could read the XHTML in as a string (not XML right away) and use a
Regular Expression to remove those tags from the text and insert
something else if you like, however: 2) The entire  XHTML should be
treated as XML, so that means tags like <p> will be treated as an XML
node, not a new HTML text paragraph.  So you may have to use some
Regular Expressions to at least add a <![CDATA[ before and ]]> to wrap
around the text you want to read in the HTML so it escapes the
characters.  THEN convert the string to XML once it's "clean".

In short, what you're asking to do is pretty challenging.  Flash isn't
really set up to "read and render" HTML pages.  It's mean to take the
place of them. :) 


Jason Merrill 

Bank of  America   Global Learning 
Shared Services Solutions Development 

Monthly meetings on the Adobe Flash platform for rich media experiences
- join the Bank of America Flash Platform Community 




-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jonathan
Wing
Sent: Thursday, May 21, 2009 1:14 PM
To: Flash Coders List
Subject: RE: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

Well, I think I know how to import XML.

var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, getXML);
loader.load(new URLRequest("http://xmlfeedURL";));

function getXML(event:Event):void {
        var xmlData:XML = new XML(event.target.data);
        trace(xmlData);
}

At least, that is the code I picked up while doing research, though I'm
not entirely sure how to use any of that to apply to what I'm doing in
the Gaia Framework. This is what I have now, minus the irrelevant code:

package pages
{
        import flash.xml.*;
        import flash.text.TextField;
        
        XML.ignoreWhitespace = false;
        XML.prettyPrinting = false;
        
        public class HomePage extends AbstractPage
        {       
                public var dynamic_text:TextField;              
                        
                override public function transitionIn():void 
                {
                        super.transitionIn();
                        TweenLite.to(this, 0.3, {alpha:1,
onComplete:transitionInComplete});
                         
                        dynamic_text.text = this.copy.intro;
                }

        [there's a lot more code, but I'm only focusing on the relevant
parts from the XHTML page]

        }
}

So what it does is pull info from this content in my XHTML page:

<div id="copy">
<p id="intro">Lorem ipsum</p>
</div>

And places that "Lorem ipsum" in my corresponding MC with an instance
name of "dynamic_text". But then, if I want to do something like:

<div id="copy">
<p id="intro"><h1>Lorem ipsum</h1>
<a href="page.swf">Click here</a> to learn more.
</p></div>

It will not parse the HTML tags; it will treat them like a regular
string of text, even though my text box has "render text as HTML"
selected.

Now, Steven's suggestions in his article seem helpful, but since I am
pretty new to this sort of code, I am still unsure as to where things
should go, and how to make it work for <h1> and <a> tags. I'm not
planning to use many other tags, as I am trying to keep things simple.

Thanks,
Jonathan Wing
Graphic Designer
Cram Crew, Inc.
mobile: (713) 298-2738
office: (713) 464-CRAM (2726) 
email: jw...@cramcrew.com
www.cramcrew.com

"One Student At A Time"


-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill,
Jason
Sent: Thursday, May 21, 2009 10:13 AM
To: Flash Coders List
Subject: RE: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

If it's truly XHTML, you can in theory parse it as XML - but if it's
not, meaning they mixed case and didn't close tags, then you're out of
luck.

First things first, do you know how to load in XML?


Jason Merrill 

Bank of  America   Global Learning 
Shared Services Solutions Development 

Monthly meetings on the Adobe Flash platform for rich media experiences
- join the Bank of America Flash Platform Community 





-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Jonathan
Wing
Sent: Thursday, May 21, 2009 11:08 AM
To: Flash Coders List
Subject: RE: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

Well, I have actually searched over and over and I have read and re-read
Steven's article as well, but I can't seem to get it just right. I think
the problem is, Steven's article is written to an audience of more
experienced AS coders (at least it seems so), and I'm pretty new to AS,
so I don't get the context. The article does not state exactly *where*
to put such code in my files, just that I need to do it. So I took some
guesses and tried multiple ways, yet still to no avail. Yet I didn't
want to bother him, as I've already asked him so many noob questions!

Mostly what I'm concerned about are parsing the <h1> and <a> tags. Do
you have any suggestions as to how and where I can implement Steven's
points in his article?

Thanks,
Jonathan Wing
Graphic Designer
Cram Crew, Inc.
mobile: (713) 298-2738
office: (713) 464-CRAM (2726) 
email: jw...@cramcrew.com
www.cramcrew.com

"One Student At A Time"

-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Glen
Pike
Sent: Thursday, May 21, 2009 3:21 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

Hi,

   This article written by Steven looks just like what you are looking 
for...
 
   http://www.stevensacks.net/2008/07/02/parsing-xhtml-with-e4x-in-as3/
   
    To keep your formatting, you can use css - the TextField in Flash 
supports a subset of css that allows you to apply bold, colours and link

formatting...

    Not sure if you are searching for EX4 or E4X!

    HTH

    Glen

Jonathan Wing wrote:
> Hi,
>
> I'm new to this group, so forgive me if I'm going about asking this
the
> wrong way. Is there a practical way to search old questions?
>
>  
>
> Anyway, I'm using the Gaia Framework and I'm trying to parse basic
tags
> such as <h1> and <a> in flash via an XHTML file. Steven over at the
Gaia
> forum suggests I make use of EX4, but I've spent two days searching
> google and reading up on it and I'm honestly confused where to start.
>
>  
>
> To show you what I mean, view the source on this page Steven created:
> http://stevensacks.net/clients/hello/press.html#/agency/press 
>
>  
>
> Note how those columns are set using HTML tags, and pulled into flash
> from that XHTML file. How do I maintain the formatting such as bold
and
> also the links, just the way he has done (strictly in terms of
> functionality)? Thank you!
>
>  
>
> Thanks,
>
> Jonathan Wing
> Graphic Designer
> Cram Crew, Inc.
> mobile: (713) 298-2738
> office: (713) 464-CRAM (2726) 
> email: jw...@cramcrew.com <mailto:jw...@cramcrew.com> 
> www.cramcrew.com <http://www.cramcrew.com/> 
>
>
> "One Student At A Time"
>
>  
>
>
>
> ------------------------------------------------------------
> The information transmitted is intended only for the person or entity
to which it is addressed and may contain proprietary,
business-confidential and/or privileged material. If you are not the
intended recipient of this message you are hereby notified that any use,
review, retransmission, dissemination, distribution, reproduction or any
action taken in reliance upon this message is prohibited. If you
received this in error, please contact the sender and delete the
material from any computer. Any views expressed in this message are
those of the individual sender and may not necessarily reflect the views
of the company.
> ------------------------------------------------------------
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
>
>   

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain proprietary, business-confidential
and/or privileged material. If you are not the intended recipient of
this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any action
taken in reliance upon this message is prohibited. If you received this
in error, please contact the sender and delete the material from any
computer. Any views expressed in this message are those of the
individual sender and may not necessarily reflect the views of the
company.
------------------------------------------------------------



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain proprietary, business-confidential
and/or privileged material. If you are not the intended recipient of
this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any action
taken in reliance upon this message is prohibited. If you received this
in error, please contact the sender and delete the material from any
computer. Any views expressed in this message are those of the
individual sender and may not necessarily reflect the views of the
company.
------------------------------------------------------------



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


------------------------------------------------------------
The information transmitted is intended only for the person or entity to which 
it is addressed and may contain proprietary, business-confidential and/or 
privileged material. If you are not the intended recipient of this message you 
are hereby notified that any use, review, retransmission, dissemination, 
distribution, reproduction or any action taken in reliance upon this message is 
prohibited. If you received this in error, please contact the sender and delete 
the material from any computer. Any views expressed in this message are those 
of the individual sender and may not necessarily reflect the views of the 
company.
------------------------------------------------------------



_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to