Groups | Blog | Home
all groups > flash actionscript > september 2004 >

flash actionscript : #include in switch statement issues


cabp ms
9/3/2004 10:23:12 PM
Hi All, i got a problem working with some as files, i have an application that
shows some html like content, it reads an specific node of an xml file, each
xml node has an "asFile" attribute that specifies where the needed as file is
located, i tried to include the as files dynamically, now i know it's
impossible to do it at run time, so i created a total.as file that it's code is
a switch statement only, in each case it iclude the specified as file, like
this:

switch(xmlNode[xPos].attributes.asFile)
{
case "001/a/00/01:
#include "001/a/00/00"
break;
case "001/b00/00":
#include "001/b00/00"
break;
}

each as file has some code to format a text field with html text in the main
swf file, the html text... among other things. The problem is exactly that the
text field in the main swf file doesn't show ANY text, and some variables are
changed to "undefined" and, some times, flash closes with the typical windows
erro message, the problem appears when case is "001/d/02/01" -it means
"001/d/02/01.as". I don't think the problem is because there are a lot of as
files, i comented all code lines except for this file and the problem still
appearing, I think i can fix these issues with shared lybraries or packages but
for now i did it in this way and i want to finish it asap.

PLEASE HELP!!!
_jrh_
9/3/2004 11:37:47 PM
Laiverd.COM
9/4/2004 12:17:53 PM
The include directive is an authoring time directive and NOT a runtime directive. So it is not possible to use this directive in a
conditional statement (or whatever other statement). Include statements have to appear in the first frame of your movie. The
as-files will then be included at export to swf.

John

--
---------------------------------------------------------------------------------------
RESOURCES
http://groups.google.com/advanced_group_search?hl=en&as_ugroup=*flash
---------------------------------------------------------------------------------------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
---------------------------------------------------------------------------------------

cabp ms
9/7/2004 10:27:45 PM
John, thanks for your reply, do you have any other idea about how can i do
this??? maybe with packages????
Maybe this is possible: ?How many times can i include an as file???
Example:
in "test_a.as" file

var texto:String;
texto = "somethin...";
#include "test_b.as"
---------------------
in "test_b.as" file

this.textField.text = "this is a simple text";
#include "test_c.as"


I made this with 2 files and work's do you know something about #include
"depth" is possible to use #include once but calling a different as file, like
example???

Thanks
AddThis Social Bookmark Button