View Full Version : Where does the text in the variable go?
Cakeman
February 15th, 2005, 07:53 AM
This code reads (with the PHP) a database and when I click the link, it just show the first 107 characters and throws away the rest of the text?!
WHY?!?!
Please help me!
function act(paramString) {
caption.htmlText = "";
caption.htmlText += paramString;
}
function showValues() {
for (i=0; i < this.n; i++){
content.htmlText += "<a href='asfunction:act," + this["text"+i] +"'><font color='#000000'>" + this["headline"+i] + "<br>" + this["teaser"+i] + "</font></a><br><br>";
}
}
var c = new LoadVars();
c.onLoad = showValues;
c.load("my_PHP.php");
stop();
ghjr
February 15th, 2005, 08:16 AM
Do and trace and see if its limiting when it comes in from the php file.
Like:
function showValues() {
trace (this["text"+i]);
}
Cakeman
February 15th, 2005, 08:51 AM
The code list
Headline
Teaser
Headline
Teaser
...
If I instead list
Headline
Text
Headline
Text
....
The FULL text will show, but when I link the text like the code shows the text in the variable that the link is supposed to show, the text will only be 107 characters...
That means that somethings cuting the lenght in the string when it becomes a link?! or something!
Does that make sense?
virusescu
February 15th, 2005, 09:12 AM
be careful not to have any & signs inside your var this would mark the beggining a new variable name.
Cakeman
February 15th, 2005, 09:41 AM
be careful not to have any & signs inside your var this would mark the beggining a new variable name.
I don't understand that?!
virusescu
February 15th, 2005, 09:51 AM
the way that flash treats the variables is - url encoded... let me give you an example. If you load a txt file with var1=asdlklfkgj&var2=kldksldk you have access to 2 variables var1 and var 2 the & sign brakes the string and anounces a new variable :)..
Did I made myself clear :)? Sorry if not
ghjr
February 15th, 2005, 10:00 AM
But it seems to be printing out ok if he traces it. So it must be something to do with the way htmlText is reading it.
Cakeman
February 15th, 2005, 10:20 AM
Ok I get the "&" but it cant be that! The varible this["text"+i] have the FULL text until I make it to show with the link...
Is there some other way to solve this?!
'couse I really need to get this right!
virusescu
February 15th, 2005, 10:36 AM
ghjr is right.. it seems that I didn't got your problem in the first place.
I tried to duplicate your problem, but I managed to create a link in the same way you did with 1000 characters... I wasn't sure about the limitation of a link lenght...but now I'm sure.. it's not limited.
I still think it could be a special character in your text that's causing your problem.
Sorry I couldn't be of more help
Cakeman
February 15th, 2005, 10:44 AM
Could I see your duplicate 'cause I really stuck here!! Please!
I use едц cause I'm Swedish but I have tested without едц but still... same old same!
ghjr
February 15th, 2005, 11:24 AM
If you can post up your FLA, or a simplified version with the problem.
Cakeman
February 15th, 2005, 11:45 AM
The PHP I use... and
I have posted the FLA
<?
//---lista-news------------------------------------------------------------------------
include "stdfuncs.php";
openCon();
$sql = mysql_query("SELECT * FROM news ORDER BY aktId ");
$nrows = mysql_num_rows($sql);
$rString = "&n=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($sql);
$rString .="&aktId".$i."=".$row[0];
$rString .="&teaser".$i."=".$row[1];
$rString .="&rubrik".$i."=".$row[2];
$rString .="&text".$i."=".$row[3];
$rString .="&skrivet".$i."=".$row[4];
$rString .="&aktDatum".$i."=".$row[5];
}
$rString=utf8_encode($rString);
echo $rString."&";
//----------------------------------------------------------------------------------------
?>
Cakeman
February 16th, 2005, 02:23 AM
Is there anyone that can solve this?!
Please
virusescu
February 16th, 2005, 05:22 AM
try this... and tell me how it works
function act(paramNo) {
caption.htmlText = c["text"+paramNo];
}
function showValues() {
for (i=0; i<this.n; i++) {
content.htmlText += "<a href='asfunction:act,"+i+"'><font color='#000000'>"+this["rubrik"+i]+"</font></a><br><br>";
}
}
var c = new LoadVars();
c.onLoad = showValues;
c.load("my_PHP.php");
stop();
Cakeman
February 16th, 2005, 05:32 AM
THANK YOU!!!!!!!!!!!
You saved my year!
virusescu
February 16th, 2005, 07:38 AM
soooo, it turned out it was either a limitation of the "asfunction" parameter... or there were indeed some strange characters that were interpreted weird in the html textfield.
Anyway... I'm glad I was able to help you in the end ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.