|
-
contentpane: supress title?
I chopped up a long HTML file for showing in a contentpane. But now I see "Untitled Document" above the text on every page I bring in. Dreamweaver must have titled each .html file that way. I tried just leaving the title blank in the html, but no luck.
So...
Is there a way to tell the contentpane NOT to show the title of an HTML file?
-
up to my .as in code
Drop the whole head Jim...you don't need any of it...it won't halt the contentpane. Try it. Start from the <body> or <html> tag.
-
Thanks, Chris.
Yikes--that's 25 files to edit.
-
Use the actionscript string functions to search for <body> and only take the part from there. That way you don't have to alter any files.
-
 Originally Posted by w.brants
Use the actionscript string functions to search for <body> and only take the part from there. That way you don't have to alter any files.
A clever solution. But how to implement it, I haven't much of a clue. I am guessing you mean that I bring the html file into an array and then use AS to truncate it. I see how you use pages.push in the KC8 Demo to get the files into the array. So would the string function be applied to the array (pages)?
At the moment, I am just bringing in the files via the GUI, (preperatory to learning how to get them in via an array and setContent). I notice I have to bring the files in via the GUI every time I change the movie. For example, if I change the font in the Contentpane, then run in browser, no text appears and I have to go through using the file selector to actually point to the html files again. Why is KM dumping that info?
-
 Originally Posted by jimventola
I am guessing you mean that I bring the html file into an array and then use AS to truncate it.
There are several options.
If all titles are exact the same for all pages, you might try this.
Code:
contentpane1.onTransit = function(){
this.l1.h.t.htmlText = this.l1.h.t.htmlText.substr(20);
this._update(true);
}
It's a dirty workaround and you have to find the right value for substr by trial and error.
The nicest way if the large file isn't very big is probably to add some markers in the text for page breaks like '#' or '|' or another character you don't use. You can load that file using the actionscript loadVars class and split it on the character you chose to break it apart into multiple pages that can be set for multipage content.
-
Thanks very much. I will play with this. I don't understand the dots after the h.t. in the code. Is this assuming a filename of "1.html"?
In any case, the html file is about 30 paragraphs long, so it would only take a few minutes to fix it by hand. But now I am intrigued by your last paragraph's suggestion. Learning how to do what you suggest would be quite useful.
I really appreciate the help.
Last edited by jimventola; 08-16-2006 at 02:14 PM.
-
 Originally Posted by jimventola
But now I am intrigued by your last paragraph's suggestion. Learning how to do what you suggest would be quite useful.
Assuming your text is in myText.html and you use ## as a marker for a page break you can use something like this. If the content is a lot of KBs, you might want to add a sort of progressbar while it is loading.
Code:
my_lv = new LoadVars();
my_lv.onData = function(v){
if (v != undefined){
v = v.split('##');
pages = new Array();
for (var i=1; i<v.length; i++) pages.push([1,v[i],0,0.3]);
contentpane1.setContent(pages);
}
}
my_lv.load('myText.html');
In this example I started with i=1. That skips the first page. I did this so you can place ## also just before page 1. Doing this you solve the title problem also because that will be in the page 0 that is skipped.
-
up to my .as in code
Ok Jim...you grab the rope and I'll go find my feather...we are gonna tickle him till he tells all
-
 Originally Posted by Chris_Seahorn
Ok Jim...you grab the rope and I'll go find my feather...we are gonna tickle him till he tells all 
Please don't tickle. I'll tell what I know 
Well, after you ask of course 
To be honest, there are some undocumented component features but the beauty of undocumented features is that they can be changed without a problem as long as the documented features stay the same. Once they are documented you can't change them that easy. I guess most software has undocumented features / functions for that reason.
-
Sheer poetry
Amazing to me that so little code does so much.
I can almost follow it, too. Is "split" a built-in AS function or is it in the component?
This method will streamline things. Thanks.
-
 Originally Posted by jimventola
Is "split" a built-in AS function or is it in the component?
Split is a built-in function that works for every string.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|