Ask a Question related to Macromedia Flash Sitedesign, Design and Development.
-
Dahgu webforumsuser@macromedia.com #1
Strange Text/XML Behavior
I have a strange problem that I spent quite some time trying to debug last night. I'll try and explain this as well as I can.
I have a simple base movie that contains a dynamic text box. There is only one frame in the base movie, which contains several functions. The script of frame 0 says:
init();
getAuthors();
showAuthors();
stop();
The init() function creates a global array to store a list of book authors. That array is populated from the getAuthors() function via a PHP XML feed. During the loading of the array, I output each array element to the text box as they are added. The showAuthors() function is setup to to display the length of the array in the dynamic text box, and then loop through the array and display all elements to the same text box.
Here's the problem. I've debugged this sucker with break points at the init(), getAuthors(), and showAuthors() function. The functions run in the order inteded. However, the text box lists the following output:
Array size from ShowAuthors() = 0
Terry Brooks
Robin Hobb
Anne McCaffrey
Array size from getAuthors() = 3
How is it that the text from the showAuthors() function is showing up before the output text from getAuthors() function? How can that be when the getAuthors() function is running first? That, and it seems that the text doesn't show until every possible function is completed in frame 1. Am I missing something?
Dahgu webforumsuser@macromedia.com Guest
-
Strange behavior
The problem seems to be in c code calling ruby calling c code. ======== start test.rb puts "about to require curses" require "curses" puts... -
Strange behavior of $.
Apparently $. is not always set correct (see second ruby 1liner). Is this a bug? 12:12:42 : cat -n n 1 2 3 BAR="hello" 4 12:12:47 : ruby... -
ruby 1.8 strange behavior
Hi, I've started making my own C extension to ruby, and found that strange behavior: class MyTest def =(key,val) "my_own_return_value" end end... -
Strange cookie behavior
Maybe the remote server is in a different time zone. Ray at work -- Will trade ASP help for SQL Server help "AHN" <anerse@excite.com>... -
Why strange IF...ELSE behavior
Hi all, I'm getting a strange result with the following IF statement: $bar = ($foo == 'last') ? true : false; In my script $foo normaly has... -
Dahgu webforumsuser@macromedia.com #2
Re:Strange Text/XML Behavior
Can anyone help with this strange XML.load problem?
I decided to pear down the code a bit, include it here, and show the trace. What makes no sense to me is that all of the functions seem to run through, and THEN the dang XML.load fires at the very end. As you'll see in the trace, the getAuthors() function runs but no XML is loaded until AFTER every other function is complete. It makes no sense. :) Please help if you can.
//Intialize the movie.
init();
//Load the authors XML doc into the authors array.
getAuthors();
//Trace out all the elements in the authors array.
showAuthors();
//Stop the movie.
stop();
function init() {
//Change XML prototypes
XML.prototype.ignoreWhite = true;
XML.prototype.contentType = "text/xml";
//Set global variables
_global.serverPath = "http://zeus/bookshelf/";
_global.authorsArray = new Array();
}
function getAuthors() {
trace("Begin getAuthors() function");
myXML = new XML();
myXML.onLoad = function (success) {
if (success) {
for (i=0 ; i < this.firstChild.childNodes.length ; i++) {
id = this.firstChild.childNodes.attributes["id"];
name = this.firstChild.childNodes.attributes["name"];
authorsArray = new Array(id, name);
trace(authorsArray[0] + " " + authorsArray[1]);
}
} else {
trace("Loading Error!");
}
}
myXML.load (serverPath + "getAllAuthors.php");
trace("End of getAuthors() function");
}
function ShowAuthors() {
trace("Begin ShowAuthors() function");
trace("Authors array length is " + authorsArray.length);
for (i=0 ; i < authorsArray.length ; i++) {
trace(authorsArray[0] + authorsArray[1]);
}
trace("End ShowAuthors() function");
}
******* TRACE for the code above *******
Begin getAuthors() function
End of getAuthors() function
Begin ShowAuthors() function
Authors array length is 0
End ShowAuthors() function
14 -none-
6 Angus Wells
13 Anne McCaffrey
4 Deborah Chester
1 J.V. Jones
8 Margaret Weis and Tracy Hickman
9 Michael Crichton
5 Micky Zucker Reichert
12 Piers Anthony
11 Robert N. Charrette
2 Robin Hobb
7 Stephen King
3 Terry Goodkind
10 Ursula K. LeGuin
Dahgu webforumsuser@macromedia.com Guest



Reply With Quote

