AS3 alternatives to *_exclude.xml files, loading class definitions dynamically
I've been banging my head against a wall for this for almost a couple days now and hoping that someone can point me in the right direction.
Working in a very large Flash application, previously in AS2/CS3 I would have a setup like the following:
root.swf
-- modules
---- code_a.swf
---- code_b.swf
-- views
---- view_a.swf
---- view_b.swf
Using _exclude.xml files, I could exclude the classes defined in code_a and code_b from the ouptut .swf of view_a and view_b. root.swf would be responsible for loading the code modules before view_a or view_b, ensuring that class definitions that view_a and view_b depended on existed.
The Problem
We've recently migrated to using Actionscript 3/CS5. *_exclude.xml files no longer exist. To get the same functionality as above, I've tried the following:
My setup now looks something like:
root.swf
-- modules
---- class_a.as
---- class_b.as
-- views
---- view_a.swf
---- view_b.swf
Use mxmlc to compile root.swf, view_a.swf and view_b.swf, passing it -externs option to specify classes that will be loaded externally (the two classes in modules). This ensures that the class is excluded from the compiled swf.
Use compc to compile class_a.as and class_b.as into classes.swf, using -directory=true to access library.swf for external loading.
However, when I try running one of the two view files which depend on classes.swf, I get runtime errors telling me that a class definition is not present.
Current Workaround
I've devised a workaround which I'm currently not happy with as it's backwards to the modular approach that I was previously using:
Rather than loading the code modules, I statically link all class definitions required by child movies intoroot.swf. When building root.swf, I use the -link-report option of mxmlc to provide a list of included classes. When building child swfs, I can the use -load-externs to ensure that class definitions that already exist will not be included in the compile output.
Is there a way that anyone is aware of to replicate the AS2/_exclude.xml solution that I had using AS3/CS5?
I'd double check if you are loading the child SWF with correct LoaderContext and/or calling ApplicationDomain.getDefinition() correctly - otherwise you cannot access classes defined in loaded SWF files.
Similar Messages
-
How to xml file load in actionscript 3.0
Hi surfers,
How to xml file load in actionscript 3.0, How to get xml data.
Thanks in Advance.
Pls give me ASAP, i'm struggle here.Search Google using "AS3 XML tutorial".
-
AS3.0 iterating through XML file
I am new to AS3.0 and the new E4X way of working with XML.
I'm trying to loop through a portion of an externally loaded XML
file and display the results. Here is a portion of my XML file:
<amenity id="1">
<title>The Gate House</title>
<feature>Majestic two-level Preserve Neighborhood
Amenity Center</feature>
<feature>Beautiful Gardens and Meandering
Pathways</feature>
<feature>Meeting Activity Room, Theatre Room, Gourmet
Kitchen, Hearth Room, Grand Fireplace</feature>
<feature>Decks and Patios</feature>
<feature>Available to residents for parties, reunions,
weddings, and meetings</feature>
</amenity>
The are other amenities as well. When a user clicks a button,
I want to enumerate all of the features from this particular
amenity. Here is my code to do this (the code associated with the
listener for the button):
function btnClick(eventObject) {
var mc:MovieClip=eventObject.target
var num:String = mc.name.replace("btn","")
var xmlAmenity:XMLList = myXML.amenity.(@id==num)
for each (var prop:XML in xmlAmenity) {
trace (prop.feature);
Basically the button that calls this is btn1, so the num
variable ends up being 1. myXML is a global variable into which the
external XML file has already been loaded. It then uses the num
variable to assign the amenity with an id if 1 to the xmlAmenity
variable as an XMLList. Everything works just grand except for the
fact that the trace produces the following:
<feature>Majestic two-level Preserve Neighborhood
Amenity Center</feature>
<feature>Beautiful Gardens and Meandering
Pathways</feature>
<feature>Meeting Activity Room, Theatre Room, Gourmet
Kitchen, Hearth Room, Grand Fireplace</feature>
<feature>Decks and Patios</feature>
<feature>Available to residents for parties, reunions,
weddings, and meetings</feature>
I don't want the tags, just what's inside them. Is there some
property I need to use (something like prop.feature.contents) or am
I going about this the wrong way entirely? I suppose I could
restructure my XML file to put the contents of the feature tag in
an attribute called description and then trace the attribute with
prop.feature.@description, but I'd kind of like to know how to
access the text inside the open and close of the tag. If I access
one directly (something like myXML.amenity.(@id==num).feature[0])
then it works just fine, I just can't seem to figure it out in a
loop. I suppose I could increment a variable and do something like
trace(myXML.amenity.(@id==num).feature[x]), but there must be a
better way.Goodness sakes, that was a long post for a quick answer I
just figured out:
My loop should read like this:
for each (var prop:String in xmlAmenity.feature) {
trace (prop);
The key was enumerating through each xmlAmenity.feature, not
xmlAmenity. Of course, if there's a better way, I'm all
ears... -
Hi All,
We are facing issue in loading an XML file in database. It is an XML file from S-MART (PGS).
If we try to load the xml file directly using an OWB mapping (as way we are doing for MARS), the mapping takes forever.
We have tried several strategies but got only partial success till now.
Structure of XML is like this
emml
list
hierarchyNode (list type Service priority , coverage tier list etc)
list
hierarchyNode (corporate Asia pacific etc)
list
hierarchyNode (Gold ,Silver Platinum etc)
list
hierarchyNode (list of CIS_CODE)
As parsing directly to cis level was not working, we stored the intermediate results in a temp table. We extracted the XML object at metal level (gold , silver) and stored it in a temp table 's XMLTYPE field . Using a second mapping we extracted the data from temp table and loaded it to final table.
Using this approach we were able to load data for all the metals except for one. Performance was also good. It took total 3-4 min to load. But the mapping failed for “ Home Products” category with the error:
ORA-31186 - Document contains too many nodes.
Cause: Unable to load the document because it has exceeded the maximum allocated number of DOM nodes.
Action: Reduces the size of the document.
This is because of a lot of CIS codes listed under the Home Products category. I do not see any straight forward way of to reduce or split the xmlobject further before the final processing.
Any one having ideas how to load such an XMLYou can check
the thread error while loading XML files into scott user
I hope it will help. -
Loading XML file with missing elements dynamically through ODI
Hi Guys ,
I have the below xml file with two nodes Employee and Address. On a daily basis , sometimes the address element might not come in from the source xml file , but my interface has columns mapped to address elements, and hence it can fail due to the source element not being found in the file or data might not get loaded due to the 'and' condition in the sql query generated between the employee and address elements. Is there a way where i can load the data dynamically where i can search in the file only for the elements (Employee) present and load data only for those elements dynamically?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Thanks ,
Revanth TambisettyI was able to resolve it by using left outer joins and referring the table structure from the XSD
-
I have a large XML file that I am converting to an
ArrayCollection to use as a dataprovider for a datagrid. It takes
sometime to fully load. Is there any way to load partial list while
the rest of the list is loading?? or does anyone know a way speed
up this process??
ThanksI'd try to modify the autoComplete component.
You could break this processing up into smaller chunks. For
it to work, you need some outside counter or indexer that keeps
track of where you are. Have the conversion function process say
nodes 0-500, then end. Then using callLater, call that function
again, to process ne next batch of nodes.
This process will allow the UI to update between iteration
batches. If you need more responsiveness, you could try monitoring
mouse move, and stopping the conversion, until the mouse is
inactive again. That is just brainstorming. I have not tried it
(the mouse move part. I know the iterator method works to allow the
UI to update.)
Tracy -
Debugging mode stopped automatically when using xml file load
Dear Sir,
I am trying to develop a new add-on using xml files for creating new forms. In fact I was using the sample code delivered with the SDK ( WorkingWithXml - under VB.NET). The Problem is that when I am in the debuging mode and after the form load. the application goes out of the debugging mode and stop action.
In fact what i was trying to do first is to create a new menu and then when i click on this menu a new form appear but once the menu is loaded the application stop the debugging mode automatically.
Can somebody clarify to me what I am doing wrong and why the debugging mode is stopped automatically, noting that i am still in the add-on developpement phase.
As i mentioned above i used the WorkingWithXml sample code (VB.NET) and i have adjusted in a way to load menu and then on the menu click i load my form.
Please advice
Best RegardsHi Mary,
Put your code between in a Try Catch block. In the Catch part use the following:
oApplication.MessageBox("CompError: " & oCompany.GetLastErrorCode.ToString & ", " & oCompany.GetLastErrorDescription & vbCrLf & "Message: " & ex.Message)
This should give you a clearer idea of what the error is all about.
The most likely reason is that there is something wrong with your XML file.
Regards,
Vítor Vieira -
Illustrator - Maximum allowed size of variable library xml file loaded from variables palette?
Hi-
One question I can’t seem to find the answer to anywhere – any idea on what the maximum size xml file one can use when making data driven graphics in Illustrator?
I can successfully batch when I load a single variable library with about 100 datasets at one time but anything much larger than that in the same xml format gives me a “the incoming variable library is invalid” error. Elsewhere on this discussion forum I have seen answers say there is no limit to the size of the XML file. (http://forums.adobe.com/thread/647934). But my experience with Illustrator CS5 says otherwise.
I have thousands I need to create. Any help would be most appreciated.
1. If there is a maximum size either in file size, number of datasets, or number of variables/values, please share what the limit is.
2. I still need to create thousands of the final document I am creating - if the limit is close to 100 and I need to create many thousands - any suggestions on either scripting or other methods to get this done?
Thanks,
Michaelyey!! now we know 1,000 is not the limit. Tested wiht 2 variables, 1122 data sets.
<v:sampleDataSet dataSetName="1121">
<ZIPPER>
<p>6” ZIPPER</p>
</ZIPPER>
<FLY>
<p>1121</p>
</FLY>
</v:sampleDataSet>
<v:sampleDataSet dataSetName="1122">
<ZIPPER>
<p>6” ZIPPER</p>
</ZIPPER>
<FLY>
<p>1122</p>
</FLY>
</v:sampleDataSet>
</v:sampleDataSets>
</variableSet>
</variableSets>
</svg> -
I have a small .fla file that uses xml files to bring in the
data. It works great. However, if i use a tag such as a <b>
bold </> tag, the file shows up as "null" when i preview the
swf.
Does anyone have any ideas? Is it something to do with the
tags in XML, or how flash reads them?
Any suggestions would be welcomed
ThanksFor instance, i want the "upcoming shows" to be in bold.
Thank you again
<?xml version="1.0" encoding= "UTF-8"
?><products><product>
Upcoming Shows
Dec 1 2007 8:00P
House Show Utah
Dec 12 2007 8:00P
House Show Utah
Dec 28 2007 7:00P
House Show Utah
Jan 6 2008 9:00A
SMCChurch - Draper Draper
Jan 11 2008 8:00P
Park City Bread and Bagel Park City, Utah
Jan 13 2008 10:15A
SMCChurch - Daybreak Daybreak
Jan 20 2008 10:00A
Hidden Valley Presbyterian Draper, Utah
Jan 24 2008 8:00P
University of Utah Salt Lake City, Utah
Feb 1 2008 8:00P
The Refuge San Ramone, California
Feb 16 2008 8:00P
Skifest Brighten
Feb 17 2008 8:00P
Skifest Brighten
Feb 18 2008 8:00P
Skifest Brighten
Nov 26 2008 8:00P
Mt. Olympus Presbyterian Salt Lake City, Utah
</product></products> -
SOAP oracle xml sql utility class definition not found error
I have created a java class that connects to database using JDBC runs an sql statement and produces xml using Oracle XML SQL Utility class. The java class works perfectly when I deploy it as a soap web service and try to run through SOAP server it gives a SOAP error oracle/xml/sql/query/OracleXML/Query [java.lang.NoClassDefFoundError].
Can anyone help please.
Thanks
AlinaSounds like you have not included the xsu12.jar file in the server-side CLASSPATH.
This depends also on the xmlparserv2.jar and on the Oracle JDBC driver. Later versions
of XSU may also depend on the xdb.jar file, too. -
Create XML file with worksheet's dynamically assigned through XSLT
Hi all
I have a requirement to create a xml file with worksheets dynamically created based on a field value in the internal table .
I have all my values in internal table, and am calling the transformation from bsp application.
Say the internal table has field dataxyz, for every change in value in this field dataxyz i need to create separate worksheet and populate that sheet with some corresponding values .
please guide me how to create worksheet dynamically.
thanks in advance.
Bharathy
Edited by: elam.bharathy on May 16, 2011 6:51 AMCan you use a schema when we compose XML doc from Database tables?
Actually, I'm using SQL Server (sorry, wrong forum). But, I thought a Java tool would have a solution for me. -
Loading an xml file from an xml file
I'm trying to load an xml file from an xml file, but I'm
having problems. My first xml file is really simple - it only
contains one attribute with the name of another xml file in it
(eventually I will have multiple xml files in here and run a loop
on them...this is why I want to load an xml file from an xml file).
Currently, with the code below, I can get the main xml file
to load ("main.xml"), but I cannot get the secondary xml files to
load FROM the main.xml.
I want to then take childNode values from the secondary xml
file and use them within my .swf in text boxes and whatnot.
Any guidance? I think I'm going wrong on the line where I'm
saying "i.newxml.load(i.attributes.location);"
- How can I get this to work?johnypeter:
I tried changing the code inside the loop to use just
"newxml" instead of "i.newxml", and I declared with "var newxml =
new XML();" - was this what you were thinking?
kglad:
The reason I tried to use the loadXML() function in the loop
was so that for each node in my "main.xml" it would load the new
xml file listed - this is a no-no? Do you have any ideas as to what
I could do?
For the for-loop, what should I change in it? I'm not great
with loops so I tried to modify some code from another loop I found
in another forum thread - not the right way to do it here?
Also, what should I trace? The value of the _root.address, or
i.attributes.location? I have created dynamic text boxes on my
stage to see if the correct value from the xml file loads (ie. the
name of the xml file within the xml file) and it does, but now I
don't know how to put that information into ANOTHER loadXML()
function and get the node information from it - does that make
sense???
Below are the examples of the xml files I am using. In the
first one, main.xml, I will have a list of multiple xml files, each
with the same nodes and elements as in the details.xml file
(different values, of course).
This is just to give you an example of what I'm trying to
accomplish - pulling ALL the addresses and phone numbers from
multiple xml files. I cannot manually collect this information, as
it is dynamic, and will be updated in each individual details.xml.
I was hoping to collect the information by simply adding to and
updating ONE xml file - main.xml.
Do you think this can be done? Am I going about it the wrong
way? I'm quite limited in AS knowledge, which is why I'm piecing
together code from other posts! -
Load Multiple Tables (schemas) from same XML file
Hi,
This is first time i am working XML files.
I have one XML file with two tables (schema). I need to load those two tables into two different Target tables.
This is the startegy to choose tables.
<Entry type="full"> --Table 1
<Entry type="short">--Table 2
I am try to find the tables like this using condition split (Type == "Full" ) but tables are not splitting as expected, is am i going with wrong approach??
Can anyone suggest me to process multiples tables from same XML file??Hi Naveen,
After the issue in my environment, the package works well that the data in the XML file load to two destination tables based on one column values. The screenshot is for your reference:
To troubleshoot this issue, could you please check the values in the type column? Verify the values have exactly the same characters, case sensitivity. It seems that you haven’t write correct values in the Conditional Split Transformation. They should be like
below:
If there are any other questions, please feel free to ask.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support -
Loading data from xml file - please help
Hi, I am new to attempting to get data from an xml file load
in flash. I followed a tutorial in a new fla and it seemed to work
fine, I then tried to adapt it to my own needs which worked fine.
But then when trying to implement this into my news section it
doesn't seem to work.
I am trying to make a news section, that displays the date
and news article. This is in within a movie clip, I even tried
putting it in the timeline of the scene but still nothing.
- I have 2 dynamic text boxes, date_txt and news_txt
- The xml file is named news.xml,
- both the fla and the xml are in the same folder
This is the actionscript I am using:
function loadXML(loaded) {
if (loaded) {
_root.thedate =
this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.thenews =
this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
date_txt.text = _root.thedate;
news_txt.text = _root.thenews;
} else {
trace("file not loaded!");
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("news.xml");
This is what I have in the xml document:
<?xml version="1.0"?>
<news>
<article>
<date>date</date>
<news>newentry.</news>
</article>
<article>
<date>Doug Engelbart</date>
<news>Invented the mouse at the Stanford Research
Institute</news>
</article>
</news>
Does anyone perhaps have any ideas of what the problem could
be?
Help much appreciated.Hi
_root refers to the Main Timeline, if your date_txt and
news_txt are in a movieclip ie: news_mc
then your path should read _root.news_mc.date_txt.text and
_root.news_mc.news_txt.text
You will also need to embed the characters you wish to use
inside your dymanic text for it to show.
Hope it helps -
Loading XML files into multiple tables
I've got XML like so...
<?xml version="1.0" encoding="UTF-8"?>
<MainTitle Version="1.0" Date="2009-01-11">
<MainName>
<ID1>A</ID1>
<ID2>ABC</ID2>
<ID3>ABC123</ID3>
<Desc>Some text</Desc>
<feature>f1</feature>
<feature>f2</feature>
<Category>
<name>n1</name>
<attribute>more stuff</attribute>
</Category>
<Category>
<name>n2</name>
<attribute>even more stuff</attribute>
</Category>
<Category>
<name>n3</name>
<attribute>different stuff</attribute>
</Category>
<Category>
<name>n4</name>
<attribute>More of the same<attribute>
<attribute>But different still</attribute>
<attribute>Even more different junk<attribute>
</Category>
</MainName>
</MainTitle>
Where each MainName instance in the file can have 0 or more ( unbounded ) Category and Feature tags and each Category instance can have multiple attribute tags. The file contains many thousands of MainName instances and has embedded a good mix of possible tags.
I believe I can load this into 9i xmltype table or a 9i table with an xmltype column, then query the data to get it out...
SQL> create table mytab (
2 xmlraw XMLType
3 );
Table created.
SQL>
SQL> insert into mytab values ( sys.xmltype.createxml(
2 '<?xml version="1.0" encoding="UTF-8"?>
3 <MainTitle Version="1.0" Date="2009-01-11">
4 <MainName>
5 <ID1>A</ID1>
6 <ID2>ABC</ID2>
7 <ID3>ABC123</ID3>
8 <Desc>Some text</Desc>
9 <feature>f1</feature>
10 <feature>f2</feature>
11 <Category>
12 <name>n1</name>
13 <attribute>more stuff</attribute>
14 </Category>
15 <Category>
16 <name>n2</name>
17 <attribute>even more stuff</attribute>
18 </Category>
19 <Category>
20 <name>n3</name>
21 <attribute>different stuff</attribute>
22 </Category>
23 <Category>
24 <name>n4</name>
25 <attribute>More of the same</attribute>
26 <attribute>But different still</attribute>
27 <attribute>Even more different junk</attribute>
28 </Category>
29 </MainName>
30 </MainTitle>')
31 );
1 row created.
1 select
2 extract(a.xmlraw,'/MainTitle/MainName/ID1/text()'),
3 extract(a.xmlraw,'/MainTitle/MainName/ID2/text()'),
4 extract(a.xmlraw,'/MainTitle/MainName/ID3/text()'),
5 extract(a.xmlraw,'/MainTitle/MainName/Desc/text()'),
6 extract(a.xmlraw,'/MainTitle/MainName/feature/text()'),
7 extract(a.xmlraw,'/MainTitle/MainName/Category/text()'),
8 extract(a.xmlraw,'/MainTitle/MainName/Category/name/text()'),
9 extract(a.xmlraw,'/MainTitle/MainName/Category/attribute/text()')
10* from mytab a
SQL> /
A
ABC
ABC123
Some text
f1f2
n1n2n3n4
more stuffeven more stuffdifferent stuffMore of the sameBut different stillEven
more different junk
This all works just fine, however, it's not quite what I need. For starters, the multiple tag data is concatenated and when I try to specifically query it out using a where clause I get ORA 22950. So, not sure how to deal with that.
Is it possible to use sqlldr to get the 200MB XML file loaded into a table like that above?
Now, given multiple "feature" and "category" data per "MainName", I need to use the SQL to dump the XML data into a set of tables built to model the structure of the XML...
roughly..
Main_Table (
ID1 Varchar2(10)
ID2 varchar2(10)
ID3 varchar2(10)
desc varchar2(100)
Features_Table (
ID1 varchar2(10)
feature varchar2(100)
Category_Table (
ID1 varchar2(10)
name varchar2(100)
attribute varchar2(100)
What are the groups recommendations here? Should I continue down this route or is there a better way?When I suggested the option to parse the XML in PL/SQL I was referring to pulling the data into PL/SQL and then performing all parsing activity against the PL/SQL copy and you don't need to make SQL calls.
Here is a quick sample for parsing out all the Category/name elements from the XML once it is loaded into PL/SQL
DECLARE
l_index PLS_INTEGER;
l_category XMLTYPE;
l_db_row XMLTYPE := XMLTYPE('<?xml version="1.0" encoding="UTF-8"?>
<MainTitle Version="1.0" Date="2009-01-11">
<MainName>
<ID1>A</ID1>
<ID2>ABC</ID2>
<ID3>ABC123</ID3>
<Desc>Some text</Desc>
<feature>f1</feature>
<feature>f2</feature>
<Category>
<name>n1</name>
<attribute>more stuff</attribute>
</Category>
<Category>
<name>n2</name>
<attribute>even more stuff</attribute>
</Category>
<Category>
<name>n3</name>
<attribute>different stuff</attribute>
</Category>
<Category>
<name>n4</name>
<attribute>More of the same</attribute>
<attribute>But different still</attribute>
<attribute>Even more different junk</attribute>
</Category>
</MainName>
</MainTitle>');
BEGIN
l_index := 1;
WHILE l_db_row.Existsnode('/MainTitle/MainName/Category[' ||
To_Char(l_index) || ']') > 0
LOOP
l_category := l_db_row.Extract('/MainTitle/MainName/Category[' ||
To_Char(l_index) || ']');
dbms_output.put_line(l_category.extract('Category/name/text()').getStringVal());
l_index := l_index + 1;
END LOOP;
END;You could repeat the WHILE loop to parse out the attribute column as well since it repeats. This is what Dave's post was showing and what I was referring to.
Hint: If you are trying to use .extract to go after an optional node, you need to verify the node exists via existsNode first. If you don't you can get an "ORA-30625: method dispatch on NULL SELF argument is disallowed" error when trying to extract a non-existent node.
Maybe you are looking for
-
The page that you are trying to open contains a movie that is referenced to an incorrect version of
I programmed a set of quizzes in Director 8.0 for one of my courses about ten years ago and have been updating them since. And, yes, I did purchased 11.5, but can't use it because I can't use printing w POM or a number of other extras anymore. My sem
-
I upgraded to 6.0 - I unistalled firefox and reinstalled twice. still get the same error message. Thanks Jim
-
HELP! iPod playlists are always getting f...d up! HELP!
This is a strange problem, infinite thanks to the person who can help me! Once I updated my iTunes 5 to iTunes 6, on a different computer I have; shortly after that, the problem started: I can arrange the main-folder AND/OR playlists on my iPod nano
-
Time Machine: Can I use a smaller external hard drive with larger internal?
Can I use a 250G external hard drive with and 500G unfilled internal drive with time machine? Or will time machine require I a 500G? I don't plan on filling the internal drive for a long time and don't want to buy a new external drive right now.
-
Insufficient data for an Image in smartform as a PDF
Hi Guys, I am sending a smartform by email as a PDF attachment. Everything is working fine, but the logo is not getting displayed. Whenever I am opening the PDF I am getting the pop up as "Insufficient data for an image". Thanks, Nikhil