[Flashcoders] How do I flow text from an XML/XHTML file into two columns?

2009-05-26 Thread Jonathan Wing
Using Gaia, I am trying to load content within flash from an XHTML file,
and have the text flow from a p into two columns. This is what I have
so far (AS3):

 

In the .fla file, I have two columns set as dynamic text, with the
instance names column1 and column2, respectively.

 

In the corresponding .as file, here is my code, including only the
relevant portions:

 

package pages
{
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.external.*;
import flash.xml.*;

public class AboutPage extends AbstractPage
{   

   public var column1:TextField;
   public var column2:TextField;
   
   public function AboutPage()
   {
   super();
   alpha = 0;
   }
   override public function transitionIn():void 
   {
   super.transitionIn();
   
   var value:XML = XMLList(copy.innerHTML)[0];
   var body:XML = value.div.(@id == body)[0];
   var i:int = 1;
   
   column1.htmlText = body.p;
   addChild(column1);
   if (body.length()  13) {
   column2.htmlText = column1.htmlText;

   for(i=0; icolumn1.bottomScrollV; i++) {
  column2.htmlText += br /;
   }  
   column2.scrollV = column1.bottomScrollV +
1;
   addChild(column2);
   }
   
   TweenLite.to(this, 0.1, {alpha:1,
onComplete:transitionInComplete});
   }

 

So far, the text is indeed loading fine into column1, but then that's
it. The remainder of the content disappears, and does not load into
column2. I took some of Steven's suggestions and looked around Google,
but I still cannot get it to work. Does anyone else have any advice?

 

 

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


Re: [Flashcoders] How do I flow text from an XML/XHTML file into two columns?

2009-05-26 Thread Steven Sacks

Could you show some sample of the XHTML you are reading in?

Specifically, what does body.p trace out?


On May 26, 2009, at 4:00 PM, Jonathan Wing wrote:

Using Gaia, I am trying to load content within flash from an XHTML  
file,
and have the text flow from a p into two columns. This is what I  
have

so far (AS3):



In the .fla file, I have two columns set as dynamic text, with the
instance names column1 and column2, respectively.



In the corresponding .as file, here is my code, including only the
relevant portions:



package pages
{
   import flash.display.*;
   import flash.events.*;
   import flash.text.*;
   import flash.external.*;
   import flash.xml.*;

   public class AboutPage extends AbstractPage
   {

  public var column1:TextField;
  public var column2:TextField;

  public function AboutPage()
  {
  super();
  alpha = 0;
  }
  override public function transitionIn():void
  {
  super.transitionIn();

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

  column1.htmlText = body.p;
  addChild(column1);
  if (body.length()  13) {
  column2.htmlText = column1.htmlText;

  for(i=0; icolumn1.bottomScrollV; i++) {
 column2.htmlText += br /;
  }
  column2.scrollV =  
column1.bottomScrollV +

1;
  addChild(column2);
  }

  TweenLite.to(this, 0.1, {alpha:1,
onComplete:transitionInComplete});
  }



So far, the text is indeed loading fine into column1, but then that's
it. The remainder of the content disappears, and does not load into
column2. I took some of Steven's suggestions and looked around Google,
but I still cannot get it to work. Does anyone else have any advice?





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