|
-
loadVariables - problem with timing?
Hey,
Can anyone explain what happens when variables are loaded from an external file? Are they definately ready for the next frame's actionscripts?
In the first frame, I have the frame actions:
loadVariables("Info.php", "");
function replaceStr(input, test, repl) {
textArray = input.split(test);
text = textArray[0];
for (var i = 1; i<textArray.length; i++) {
text += repl+textArray[i];
} return text;
}
Then, in the second frame, I have frame actions:
text1 = replaceStr(text1, "#", "\r");
text2 = replaceStr(text2, "#", "\r");
stop();
In the data file, I have # where I want the line breaks to be. The Flash movie substitutes \r for # without any problems on my own computer, but not when it's on the server!
The contents of Info.php are as follows:
&text1=<b>Welcome</b>##Welcome to the Cambridge Jiu Jitsu Club.##Please navigate around the site by using the tabs above.##Please contact us if you have any feedback or questions.&text2=Rich -##Use the arrow keys to scroll down in the pop-up window.
Can anyone help?
Cheers,
Chris
PS - A list of special characters not allowed in Flash strings or external data files would be very helpful! Does anyone know of such a list?
-
You are probably trying to access the variables before they have finished loading...the best approach is to use the LoadVars object, which has an onLoad handler that will trigger when all the data has finished loading...
http://www.macromedia.com/livedocs/f...html#wp3994770
K.
-
I'm using Flash 5!
That says Flash 6 
Is there anything else I can do?
Chris
-
I've sorted this now too - thatnks for trying....
My solution was to have three frames, with a movieclip called "content" containg a movieclip called "input":
MC(content) frame 1:
loadVariables("whatever.php", input)
MC(input) frame 1: Define function
MC(input) frame 2: Perform function on loaded variables
MC(input) frame 3: GoToAndPlay(2);
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
|