Thanks Steven! That clears a few things up, and like you suggest, I will
experiment with it until I get it just right. The only reason I've been
so anxious is that I'm working on a deadline; so, for the time being,
may I simply ask you this? What is the best (and most SEO-friendly) way
of presenting links within the copy content? Should I be doing this
within the XHTML using <a> tags to other swf files, or is there a better
method? I guess that is the only thing I'm getting hung up on, as my
pages will occasionally have links within the body paragraphs.

Okay, so I figured out one thing that helps, which is to set my text
fields to "htmlText" (it was only "text" before). That helps a lot, and
it appears that the links are showing up and they function--sorta. They
actually want to open a new page, even if a swf, and even if the target
is set to "_self".

Really, all I want to do (on my deadline) is have links from one swf to
another in the website, but have it all be SEO-friendly. Should be
pretty simple, right? I bet I'm making it more complicated for myself
than it probably needs to be. ;)

My I present my own guess, and you could tell me if I'm wrong? I'm
guessing it has something to do with the following, which I found in the
Gaia demo site (I'm pasting only what I assume is the relevant code):

public var textContent:TextField;

var myStyleSheet = new StyleSheet as StyleSheet;
var myURL:String;
var mySection:XMLList;

myURL = Gaia.api.getCurrentBranch();                    
myStyleSheet =
IStyleSheet(Gaia.api.getPage("index").assets.xmlCss).style;
textContent.styleSheet = myStyleSheet

for each ( var u:XML in mySection) {
                                if (myURL == u...@url) {
                                        textContent.htmlText = u.copy;
                                }

Could I use this in tandem with my Gaia-produced XHTML pages? I do not
see where the actual <copy> node is included in the instance from the
demo site's XML, but only the url part. How is the rest of the text
being included?

Sorry to be impatient! I just did not expect this specific aspect of
development to feel like starting from scratch!


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 Steven
Sacks
Sent: Thursday, May 21, 2009 1:43 PM
To: Flash Coders List
Subject: Re: [Flashcoders] Parsing HTML tags within flash from an XHTML
file?

http://www.gaiaflashframework.com/index.php/topic,1847.msg7817.html#msg7
817

Just so everyone is familiar with the context here, the above is the  
thread on the forum about this.

The question is about how to use E4X to parse XHTML.  I provide a code  
example of how easy it is to do this, but Jonathan's question is more  
of a general one about how to use E4X to parse nodes.

Flash doesn't support <div> in its htmlText, so that's why you use E4X  
to grab the node content like

var value:XML = XMLList(copy.innerHTML)[0];
var body:XML = value.div.(@id == "body")[0];

I believe the challenge for Jonathan is what the above lines of code  
mean and how they work.

value is the XHTML.

value.div returns an XMLList of all div nodes on the first level  
within the XHTML.

value.div.(@id == "body") means give me an XMLList of the div nodes  
that have an attribute id="body".

valid.div.(@id == "body")[0] means give me the first XML node in that  
XMLList.

This is how E4X works.  A lesson on E4X is out of scope of my forum.   
However, there are lots of resources out there for E4X in AS3.  I  
highly recommend Colin Moock's Essential Actionscript 3.0 book, which  
is how I learned it.  That and the internet.

And Jason, you do not need to complicate things with RegEx.  E4X does  
enough.  XHTML is technically XML and can be parsed the same using E4X.

Also, while Flash doesn't SEEM to support newer HTML tags like  
<strong> and <em> for <b> and <i>, it actually DOES if you write css  
to do it.

strong {
        font-family: FFScala-Bold;
        display: inline;
}
em {
        font-family: FFScala-Italic;
        display: inline;
}

In this case, I am using a bold and italic font to show them, and by  
defining the node types in css (and setting them to display: inline),  
it works like a champ!

Here's a detailed code sample:
http://www.gaiaflashframework.com/wiki/index.php?title=Runtime_Font_Load
ing#StyleSheet_Example

Now, I can keep my valid XHTML and use it directly in Flash.  It's  
really straightforward.  The challenge is learning how to parse the  
nodes using E4X, which, once you get your head around it (and it took  
me a lot of experimenting to learn how awesome and powerful E4X is and  
how to leverage it), you can do stuff like this easily.
_______________________________________________
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