LoadMovie to load xml button file... undefined
Hi, I am a designer and not familier with programming, my
fiend purchased some flash buttons with xml file, when i run its
swf its work perfect for me. there are 6 six buttons in it and i
can easily change their name from xml file.
ok here is the problem
i want to assemble those button in another file and just
those buttons to run from a different main file.
i made a movie clip container and gave it an instance name
holder_mc
on main file on frame action i wrote this
loadMovie("button.swf","holder_mc");
ok there are loading in my file but problem is that now i see
only one button now and written Undefined on the buttons.
i am not sure why they are not working , i followed many
online tutorials on loadMovie and did exactly same...
one thing is interesting see here.. without xml files are
loading perfect but with xml file i always get error even though
xml file is already in my folder.
I look forward to learn something from your experts.
thank you very much
i am using flash 8 professional. AS 2.0
ok this time i made nav bar my main .. this time i am not
loading nav bar in another movie since i was really undefined error
but this time i have another xml file which is only a simple xml
file but when i click on nav bar to load another swf file which is
txt file, it loads but i don't see anything on it, no text , no
content nothing there... even though when i view it separtly it
works fine..
any help would be appreciated.
thanks
Similar Messages
-
Loading XML Configuration File into Java
I have a stored procedure wrapper to a Java method (within a jar file) that has been loaded into the database. I need to load an XML configuration file in this method and parse it but get the following error.
<Line 2, Column 192>: XML-24538: (Error) Can not find definition for element 'LODConfigs'
When I run the method standalone through netbeans it parses fine and is able to load the file. I've confirmed that it is able to read the file but I am lost as to what could be the problem. Any suggestions would be welcome.
The header of the file is
<?xml version="1.0" encoding="UTF-8" ?>
<LODConfigs xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oracle.com/spatial/network/lodLODConfigs.xsd"
xmlns="http://xmlns.oracle.com/spatial/network">
<LODConfig globalNetworkName="$DEFAULT$" networkName="$DEFAULT$">
<networkIO>
</networkIO>
</LODConfig>
</LODConfigs>Just a guess really, (and this is an old question now - so you may have moved on).. is your XML parser attempting to use the schema location to pull the XML schema from the internet?
If so, that might run fine in netbeans, but hit java permission limits in Oracle. Have you tried running it in netbeans with the network cable unplugged.
If that fails with the same error as the Oracle JVM, that might give a clue as to the problem and you can troubleshoot the permissions from there. -
Memory issue loading XML schema files
Hi,
I have an application that a startup reads available XML schema files from a folder and creates Validator objects that are put into a HashMap.
I'm running into problems creating validation schema objects when the file size of the schema is just over 30kB in size.
The following error message is given when testing with the "large" schemas:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMStateSet.<init>(CMStateSet.java:100)
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.firstPos(CMNode.java:96)
at com.sun.org.apache.xerces.internal.impl.xs.models.XSCMBinOp.calcFirstPos(XSCMBinOp.java:136)
at com.sun.org.apache.xerces.internal.impl.dtd.models.CMNode.firstPos(CMNode.java:97)
at com.sun.org.apache.xerces.internal.impl.xs.XSComplexTypeDecl.getContentModel(XSComplexTypeDecl.java:185)
at com.sun.org.apache.xerces.internal.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:457)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:530)
at com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(SchemaFactoryImpl.java:206)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489)
The smaller 1-10kB schemas can be stored without any problem regardless of the number I test (+1000).
The problem occurs as soon as it handles these larger schemas in the source directory. Even only one 30kB schema is enough to consume the all memory.
Below is the code uesd for creating the validation objects
for(int i=0;i<files.length;i++){
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(files);
schema = factory.newSchema(schemaFile); // Here is where the process fails
Validator validator = schema.newValidator();
hm.put(documentType, validator); //hm is the HashMap used as placeholder for Validator objects
Regards,
Håkan
Edited by: dezer on Jun 2, 2010 5:04 AM
Edited by: dezer on Jun 2, 2010 5:08 AMWelcome to the Sun forums.
dezer wrote:
..Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
The smaller 1-10kB schemas can be stored without any problem regardless of the number I test (+1000).
The problem occurs as soon as it handles these larger schemas in the source directory. Even only one 30kB schema is enough to consume the all memory.Are you certain that only one schema is involved? How does the code tell how many schemas there are?
Below is the code uesd for creating the validation objects
for(int i=0;i<files.length;i++){
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Source schemaFile = new StreamSource(files);
schema = factory.newSchema(schemaFile); // Here is where the process fails
Validator validator = schema.newValidator();
hm.put(documentType, validator); //hm is the HashMap used as placeholder for Validator objects
It would seem that if files.length is 10000, that would end up in around 30 times as much memory usage as for the 1000x10Kb schemas. -
Loading XML(XSD) file into database by validating the format in file
Hi,
I have a file whose format is predefined as listed below
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VVV">
<xs:complexType>
<xs:sequence>
<xs:element name="VVVHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="UniqueIdentifier" type="xs:SEQ0001"/>
<xs:element name="VVVFileType" type="xs:123"/>
<xs:element name="FileCreatedDatetime" type="xs:23-MAY-2006"/>
<xs:element name="ScanDatetime" type="xs:23-MAY-2006"/>
<xs:element name="BatchID" type="xs:456"/>
<xs:element name="BatchSequence" type="xs:1001"/>
<xs:element name="DataEntryDatetime" type="xs:23-MAY-2006"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="VVVDetail">
<xs:complexType>
<xs:sequence>
<xs:element name="RRRLocalOffice" type="xs:Mumbai"/>
<xs:element name="Duplicate" type="xs:No"/>
<xs:element name="ReRegMarker" type="xs:boolean"/>
<xs:element name="RegistrationMark" type="xs:Vishnu"/>
<xs:element name="RegMarkCheckDigit" type="xs:12S"/>
<xs:element name="TaxClassCode" type="xs:67"/>
<xs:element name="ExternalMakeCode" type="xs:Maruti"/>
<xs:element name="ExternalModelCode" type="xs:800LX"/>
<xs:element name="RRRMakeCode" type="xs:Mar"/>
<xs:element name="RRRModelCode" type="xs:800LV"/>
<xs:element name="RRRVehicleBodyCode" type="xs:98"/>
<xs:element name="RRRColourCode" type="xs:red"/>
<xs:element name="RegistrationDate" type="xs:23-MAY-2006"/>
<xs:element name="ChassisNumber" type="xs:num123"/>
<xs:element name="HC" type="xs:1.22"/>
<xs:element name="UnWeight" type="xs:90"/>
<xs:element name="NoSeats" type="xs:four"/>
<xs:element name="NOx" type="xs:2.22"/>
<xs:element name="RevenueWeight" type="xs:34"/>
<xs:element name="CO2" type="xs:55"/>
<xs:element name="Particulates" type="xs:long"/>
<xs:element name="CO" type="xs:3.33"/>
<xs:element name="HCNOx" type="xs:4.44"/>
<xs:element name="TrailerWeight" type="xs:66"/>
<xs:element name="StationaryLevel" type="xs:77"/>
<xs:element name="EngineSpeed" type="xs:88"/>
<xs:element name="DriveBynature" type="xs:99"/>
<xs:element name="SMMTFleetCode" type="xs:yel"/>
<xs:element name="Purchasercode" type="xs:4004"/>
<xs:element name="IndustryofUse" type="xs:office"/>
<xs:element name="OriginalDealerCode" type="xs:tr56"/>
<xs:element name="SellingDealerCode" type="xs:se23"/>
<xs:element name="bill110" type="xs:srira"/>
<xs:element name="bill111" type="xs:mula"/>
<xs:element name="SalesType" type="xs:krish"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I would like to update this into a a table by validating the format of the XSD file.
I will be having several similar files.
Steps I will be doing on this are
1 > Pick up file from a directory one at a time
2 > Validate the format of XSD file
3 > If valid load into a table
How can I achieve above steps using PL/SQL
Pls mail me ur suggestions on very urgent basis
Thanks in advance
VishnuReally this should be in the XML forum, but anyway....
Just a small question... It looks as though you are using an XML schema (XSD) to store your table information along with it's data, am I correct? Seems very bizarre thing to do.
If you are using Oracle 10g you can drop your file into the Oracle WebDAV area (XDB) and from there you can access the XML as an XMLTYPE using something like...
SELECT rv.res.extract('/Resource/Contents/*')
FROM resource_view rv
WHERE lower(rv.any_path) = lower(lc_filename)Once you have it in the XMLTYPE variable from that query, and because your schema doesn't really define the datatypes etc. it's gonna be up to you to parse the XML using something like the DBMS_XMLDOM package and process that into create table statements or something.
Certainly looks like you've got yourself a nice task to do there. Glad I'm not doing it.
;) -
Problem ragarding load xml(embedded) file
oGlobalMain is the object of global class where every object is created and function is defined
SBO_Application is declared as Public WithEvents SBO_Application As SAPbouiCOM.Application
#Region "Load as XML"
Public Sub LoadAsXml(ByVal FileName As String, Optional ByVal FileType As ResourceType = ResourceType.Content)
Dim oXmlDoc As Xml.XmlDocument
Dim oXmlStream As System.IO.Stream
oXmlDoc = New Xml.XmlDocument
Try
If FileType = ResourceType.Content Then
oXmlDoc.Load(FileName)
Else
oXmlStream = System.Reflection.Assembly.LoadFrom(System.Windows.Forms.Application.ExecutablePath).GetManifestResourceStream(GetType(modStartUp).Namespace & "." & FileName)
oXmlDoc.Load(oXmlStream)
End If
oGlobalMain.SBO_Application.LoadBatchActions(oXmlDoc.InnerXml)
Catch ex As Exception
oGlobalMain.SBO_Application.MessageBox(ex.Message)
End Try
End Sub
#End Region
please send me some suggestion, I would be grateful to you.
Thanks in advance
regards
NandiniHi..
use this code
Form load()
use
Me.CreateForm()
Sub CreateForm()
Try
SAPXML("AAAAAAA.xml")
OM_Form = app.Forms.Item("FormID--Yours")
Catch ex As Exception
OM_Form = app.Forms.Item("FormID--Yours")
OM_Form.Select()
Exit Sub
End Try
End Sub
Sub SAPXML(ByVal path As String)
Try
Dim xmldoc As New MSXML2.DOMDocument
Dim Streaming As System.IO.Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Your Folder." + path)
Dim StreamRead As New System.IO.StreamReader(Streaming, True)
xmldoc.loadXML(StreamRead.ReadToEnd)
StreamRead.Close()
app.LoadBatchActions(xmldoc.xml)
Catch ex As Exception
app.MessageBox(ex.Message)
End Try
End Sub
Regards,
Siva -
Hello, everyone. As a SSIS newbie, I have a simple question about load XML data files with SSIS. Currently I have multiple XML files in a specified folder (C:\XMLData) using one XSD file. Since SSIS does not support expression language for XML Source component (unlike flat file connnection), do you know how to loop through all XML data files to load them into a table in a database? I guess I may need to do some programming in VBScript. Any help is greatly thankful
Thank you very much.Since SSIS does not support expression language for XML Source component (unlike flat file connnection),
Are you sure about that? If you flip back to the control-flow and view the properties of the dataflow in question then you should be able to put an expression on the [XML Source].[XMLData] property.
Background reading:
Dataflow expressions
(http://consultingblogs.emc.com/jamiethomson/archive/2007/10/09/SSIS_3A00_-Dataflow-expressions.aspx )
http://sqlblog.com/blogs/jamie_thomson/ | http://jamiethomson.spaces.live.com/ | @jamiet -
Need help with loading XML file
Hello,
I have been browsing the web/forums for an example on how to do this for a few days now. I managed to get this working in Flash Pro quite easily but I think I am missing something when I want to do the same thing in Flex.
Basically I want to load an XML file and then set the text values of 5 labels equal to the data in the XML file.
So I a button created in MXML and have set the click event as follows:
click="dsSetup(event)"
I have also declared the following:
public var myRequest:URLRequest = new URLRequest("assets/myFile.xml"); //folder located under src in project
public var myLoader:URLLoader = new URLLoader();
public var myXML:XML;
My function that loads is as follows:
public function dsSetup(event:MouseEvent):void
trace ("dsSetup");
myXML = new XML (myLoader.data);
h3.text = myXML.source.itemA;
h4.text = myXML.source.itemB;
h5.text = myXML.source.itemC;
h7.text = myXML.source.itemD;
h8.text = myXML.source.itemE;
currentState = 'MainMenu';
myLoader.addEventListener(Event.COMPLETE, dsSetup); // I think this line is now redundant as I have set it in the MXML
myLoader.load(myRequest);
This is the way I did it in Flash and it worked ok but I must be missing something in when it comes to Flex.
Can someone explain or point me to a good tutorial that shows how to load XML in Flex?
The ones I found seem to have about 50 lines of code just to load a file and add in way to much complexity for a beginner.
Many ThanksI would suggest to save the loaded data in a Bindable variable and then to bind the text-properties to that:
[Bindable]
var myXML:XML;
public function dsSetup(event:MouseEvent):void
myXML = new XML (myLoader.data);
currentState = 'MainMenu';
<s:Label text="{myXML.source.itemA}"/> -
How to load XML File to BW Delta Queue via Webpage
Hello altogether,
I am trying to load an CSV file via Webpage (the Webpage have to change the csv file in a xml/soap file) into BW Delta Queue.
Steps that I have made:
- Create an InfoSource
- Create an BW Data Source with Soap Connection
- Create an initial Delta without Data Transfer
- Create a Web Service with TC - SE37 - Utilities -> More Utilities -> Create Web Service
If I test the Web Service with TC - Soamanager (BW 7.0), the data entered here, are transferred to the BW Delta Queue.
If I test the function module ( TC - SE37), the data also transferred to the Delta Queue.
Now I think, that I have an error in the html file or the html file is not conform to the wsdl document?? Or should I have to create a virtual interface, but I don't find a possibility to creat it...???
Can you please help me????
The coding of the WSDL Document and the Website is attached (I can also send you the coding and error message via mail, if you want). Sorry I don't know how to display here the coding. I try it with symbol "click to display the text code", but afterwards I get an error message from the website... So let me please know your mail address and I send it via mail....
I hope, that somebody can help me!!!!!
Edited by: Alina99 on Sep 8, 2009 11:44 AM
Error Message from BW:
...sap-env:envelope..... soap-env:body><soap-env:fault><faultcode>soap-env:Client</faultcode></faultstring xml:lang="eng">Virtual Interface Method>_-BI0_-QI6AZ_XML_APPL2_RFC::urn:sap-com:document:sap:soap:functions:mc-style<not supported</faultstring>.......
Edited by: Alina99 on Sep 8, 2009 11:56 AMHello,
I have done all the necessary config in BW. However, as I mentioned earlier, we are still not up with XI so I am trying to load XML to BW delta queue. The question still remains, how do I make make the XML file (on my desktop say) point to the BW so the InfoPackage picks up and places in the delta queue? Even if I had XI, there has to be a way whereby BW looks for the XML file. That is what I want to know and stuck at.
Any detailed step by step help will be appreciated as always.
Cheers -
Error while loading xml files using JDBC
Hi,
I am trying to load xml files into an xmltype table using JDBC calls and am getting this error for some files
LPX-00200: could not convert from encoding UTF-8 to UCS2
The xml files and our database are both UTF-8 encoded. The version of oracle that we have here is 9.2.0.6
Any suggestions in this matter will be greatly appreciated.
Thanks,
UmaI also experienced this problem and unfortunately this solution didn't work for me given that the tag you suggested was already on the XML file.
-
Error while loading XML files into scott user
Hi All,
I'm new to xml files. I need to load xml files into database through OWB.
I have xml file in my local machine & am trying to load into table PO of Scott. Scott is registered as repository user.
Followed same steps as specified in userguide.
But, when executing the procedure ( in two ways one as just table name, and other as user.table name) it is showing the below error:
Procedure is:(1)--with username.tablename
begin
wb_xml_load(
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>&&SAMPLES_DIR.sample1.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target dateFormat="yyyy.MM.dd">scott.PO</target>'||
'</targets>'||
'</OWBXMLRuntime>'
end;
ERROR at line 1:
ORA-20006: Error occurred while truncating target database object SCOTT.PO.
Base exception: ORA-01031: insufficient privileges
ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
ORA-06512: at "SCOTT.SAMPLE1", line 3
ORA-06512: at line 1
Procedure is:(2) with out username
begin
wb_xml_load(
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>&&SAMPLES_DIR.sample1.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target dateFormat="yyyy.MM.dd">PO</target>'||
'</targets>'||
'</OWBXMLRuntime>'
end;
ERROR at line 1:
ORA-20006: Error occurred while truncating target database object PO.
Base exception: ORA-00942: table or view does not exist
ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
ORA-06512: at line 2
xml file:
<ROWSET>
<ROW>
<ID>100</ID>
<ORDER_DATE>2000.12.20</ORDER_DATE>
<SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
<SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
<SHIPTO_CITY>Redwood City</SHIPTO_CITY>
<SHIPTO_STATE>CA</SHIPTO_STATE>
<SHIPTO_ZIP>94065</SHIPTO_ZIP>
</ROW>
</ROWSET>
Note: Everything works fine if I create PO table in OWBSYS user and execute the procedurein OWBSYS user. OWBSYS.PO table will be loaded.
What privileges are missing, what shouldI do if I want to execute the procedure from scott user and load the table of scott.
Thanks in advance for the help.
Regards,
JoshnaHi Joshna,
Please follow below steps to load xml file to oracle database.
1.First connect to owb (Design Center) through your repository owner user (ex : REP_OWNER).
2. Import WB_XML_LOAD procedure . and exit to repository owner.
3. connect to owb design center through your repository user (ex : REP_USER)
Create New mapping and drag one Constant Operator and create one attribute, paste / edit following code
'<OWBXMLRuntime>'||
'<XMLSource>'||
'<file>E:\SOURCE\emp.xml</file>'||
'</XMLSource>'||
'<targets>'||
'<target truncateFirst = "FALSE" dateFormat="yyyy.MM.dd">rep_user.emp</target>'||
'</targets>'||
'</OWBXMLRuntime>'
4. Drag pre mapping operator and select WB_XML_LOAD procedure
5. Connect Constant Operator attribute to pre mapping operator.
6. Drag two dummy tables and connect source to target. (ex : drag t1 (table) tab two times and connect.
7. Validate and deploy the mapping.
8. grant necessary grant command to rep_owner user to rep_user user.
(Note : target truncateFirst = "FALSE" by default truncate the table. So you have to give grant privileges
To rep_user , select ,insert, delete privileges.
9. Execute the mapping , and check EMP table. (Note : before loading EMP table delete all records ).
10 . If you want more description please go through the below link
http://download.oracle.com/docs/html/A95931_01/apf.htm
Regards
Venkat -
Load XML file from different location?
Hi All,
I've been going through an exercise by Karl Matthews to load XML data into an AIR App:
http://www.adobe.com/devnet/air/flex/articles/xml_viewer_on_air.html
but I would like to change where the XML file used in the project is retrieved from.
Currently the XML file is loaded from here:
<!-- Set up the HTTP service from where we get the source XML data -->
<mx:HTTPService id="srcData" url="
assets/UserGuide.xml" result="loadModelData(event)"
/>
but I would like to load the XML file from one of these locations instead:
File.userDirectory:
File.documentsDirectory:
Can someone please show me how I should change the above code to accomplish this, as my efforts to date have not been successful :-(
I am using Flex Builder 3 and Air 1.5.
Thanks heaps!
TimHi Bhasker,
Thank you for replying.
I am not very good at all this coding, but I am assuming I should now be doing entering the following:
=======================
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication
xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"width="
800" height="660"xmlns:comp="
*" xmlns:fmtComp="fmtComps.*"creationComplete="srcData.send()"
paddingLeft="
0" paddingRight="0" paddingTop="0" paddingBottom="0">
<mx:Script>
<![CDATA[
import mx.utils.ObjectProxy;
import mx.rpc.events.ResultEvent;
Bindable]
private var userManualObj:ObjectProxy;
private function loadModelData(event:ResultEvent):void
userManualObj=event.result.UserManual;
private function readXMLContent(xmlFile:File,objContentView:Object):Array{
var reportDir:File = File.userDirectory.resolvePath("assets");
var xmlFile:File;
var fileStream:FileStream = new FileStream(); xmlFile = reportDir.resolvePath(
"UserGuide.xml");
if(xmlFile.exists && xmlFile.size > 0)// Checking if the impressions.xml file already exists and the file is not empty
var stream:FileStream = new FileStream();
var xml:XML = new XML();stream.open(xmlFile, FileMode.READ);
xml = XML(stream.readUTFBytes(stream.bytesAvailable));
stream.close();
]]>
</mx:Script>
<!-- Set up the HTTP service from where we get the source XML data<mx:HTTPService id="srcData"
url="assets/UserGuide.xml"
result="loadModelData(event)"/> -->
<mx:VBox width="100%" horizontalAlign="left" height="100%" paddingBottom="
0" paddingLeft="0" paddingRight="0" paddingTop="0">
<mx:TabNavigator width="100%" height="100%"paddingBottom="
0" paddingLeft="0" paddingRight="0" paddingTop="0">
<mx:Repeater id="modelsRep" dataProvider="{userManualObj.Product.Model}">
<mx:VBox label="{modelsRep.currentItem.Name}" width="100%" height="100%">
<comp:ModelDesc model="{modelsRep.currentItem}"/>
</mx:VBox>
</mx:Repeater>
<mx:VBox label="Troubleshooting" width="100%" height="100%"paddingBottom="
0" paddingLeft="0" paddingRight="0" paddingTop="0">
<comp:Troubleshooting issues="{userManualObj.Product.Troubleshooting.Issue}" />
</mx:VBox>
</mx:TabNavigator>
</mx:VBox></mx:WindowedApplication>
=======================
and create and "assets" folder in my user directory placing the XML file in there?
However when I do all that, I get this error when I try to compile:
Encountered errors or warnings while building project main.mxml.
main.mxml: Function does not return a value.
Any thoughts?
Many thanks,
Tim -
Load XML file from addon domain without cross-domain Policy file
Hello.
Assuming that there are two addon domains on the same server: /public_html/domain1.com and /public_html/domain2.com
I try to load XML file from domain2.com into domain1.com without using cross-domain policy file (since it doesn’t work on xml files in my case).
So the idea is to use php file in order to load XML and read it back to flash.
I’ve found an interesting scripts that seems to do the job but unfortunately I can't get it to work. In my opinion there is somewhere problem with AS3 part. Please take a look.
Here are the AS3/PHP scripts:
AS3 (.swf in www.domain1.com):
// location of the xml that you would like to load, full http address
var xmlLoc:String = "http://www.domain2.com/MyFile.xml";
// location of the php xml grabber file, in relation to the .swf
var phpLoc:String = "loadXML.php";
var xml:XML;
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(phpLoc+"?location="+escape(xmlLoc) );
loader.addEventListener(Event.COMPLETE, onXMLLoaded);
loader.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
loader.load(request);
function onIOErrorHandler(e:IOErrorEvent):void {
trace("There was an error with the xml file "+e);
function onXMLLoaded(e:Event):void {
trace("the rss feed has been loaded");
xml = new XML(loader.data);
// set to string, since it is passed back from php as an object
xml = XML(xml.toString());
xml_txt.text = xml;
PHP (loadXML.php in www.domain1.com):
<?php
header("Content-type: text/xml");
$location = "";
if(isset($_GET["location"])) {
$location = $_GET["location"];
$location = urldecode($location);
$xml_string = getData($location);
// pass the url encoded vars back to Flash
echo $xml_string;
//cURLs a URL and returns it
function getData($query) {
// create curl resource
$ch = curl_init();
// cURL url
curl_setopt($ch, CURLOPT_URL, $query);
//Set some necessary params for using CURL
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//Execute the curl function, and decode the returned JSON data
$result = curl_exec($ch);
return $result;
// close curl resource to free up system resources
curl_close($ch);
?>I think you might be right about permissions/settings on the server for php. Unfortunately I'm not allowed to adjust them.
So I wrote my own script - this time I used file path instead of http address of the XML file. It works fine in my case.
Here it is:
XML file on domain2.com:
<?xml version="1.0" encoding="UTF-8"?>
<gallery>
<image imagePath="galleries/gallery_1/images/1.jpg" thumbPath="galleries/gallery_1/thumbs/1.jpg" file_name= "1"> </image>
<image imagePath="galleries/gallery_1/images/2.jpg" thumbPath="galleries/gallery_1/thumbs/2.jpg" file_name= "2"> </image>
<image imagePath="galleries/gallery_1/images/3.jpg" thumbPath="galleries/gallery_1/thumbs/3.jpg" file_name= "3"> </image>
</gallery>
swf on domain1.com:
var imagesXML:XML;
var variables:URLVariables = new URLVariables();
var varURL:URLRequest = new URLRequest("MyPHPfile.php");
varURL.method = URLRequestMethod.POST;
varURL.data = variables;
var MyLoader:URLLoader = new URLLoader;
MyLoader.dataFormat =URLLoaderDataFormat.VARIABLES;
MyLoader.addEventListener(Event.COMPLETE, XMLDone);
MyLoader.load(varURL);
function XMLDone(event:Event):void {
var imported_XML:Object = event.target.data.imported_XML;
imagesXML = new XML(imported_XML);
MyTextfield_1.text = imagesXML;
MyTextfield_2.text = imagesXML.image[0].attribute("thumbPath"); // sample reference to attribute "thumbPath" of the first element
php file on domain1.com:
<?php
$xml_file = simplexml_load_file('../../domain2.com/galleries/gallery_1/MyXMLfile.xml'); // directory to XML file on the same server
$imported_XML = $xml_file->asXML();
print "imported_XML=" . $imported_XML;
?>
Regards
PS: for those who read the above discussion: the first and the second script work but you must test which one is better in your situation. The first script will also work between two domains on different servers. No cross domain policy file needed. -
Can I load xml file from SWC without using @embed
I'm developing a mobile application in which I need to load xml files from File.applicationDirectory. This works great if the xml files are part of the main application swf. But I would like to move these xml files into a SWC so they could be shared across multiple applications.
Using FlashBuilder 4.5, when a SWC is built, I can specify files to embed in the library that are not assets (Assets Tab of Flex Library Build Path). For various design reasons, I do NOT want to embed the xml files via @embed.
When the swc is built and I open it up using a zip utility, I see the xml files in there just fine. So they are being bundled with the SWC. But how can I load these files in my main application that does not involve using @embed? When the main application is built, the swc setting for link type is "merged into code".
I wouldn't expect the application to automatically pull out the xml files from the swc and place them in the File.applicationDirectory on the mobile device. I've tried loading from there just in case but file.exists is false (as expected).
I've searched the web (and continue to do so) and all the answers seem to be to use @embed. Is there another way?
RandyIt's actually a lot easier than you think.
Just reference the file like any'ol URL using a path relative to the SWC's src directory.
So if you include the file "assets/xml/some.xml", just use that same string like you would any remote resource.
For example:
var loader:URLLoader = new URLLoader( new URLRequest("assets/xml/some.xml"));
I believe it would also work like this "/assets/xml/some.xml", but I prefer relative paths so the link doesnt break if moved out of the SWC... -
How to load XML files ? HELP!
Hi folks.
We have an old Oracle database 7.3..
So we need to load XML files into its tables.
As we understand Oracle Loader doesn't help us.
Is the way to load that files?
Thanks in advance
AlexI know you realize 7.3 is old but this is sort of like trying trying to view a DVD when you only have a VCR. Simple answer would be buy a DVD player, i.e. upgrade to a more recent version of Oracle where you will get many features to handle XML.
How do you want the XML loaded, all as a single object? That could be a CLOB column if 7.3 had them, I am not sure. You would probably have to write PL/SQL and something with UTL_FILE (if 7.3 had that) to load it.
If you want to put it multiple columns based on its tags, you would be better off parsing it using PERL (or something) into a CSV and loading that in SQL*Loader.
I assume as this is using XML it is a reasonably recent design, combining that with an ancient version of the database is just going to lead to endless headaches. -
Hi All,
How to load xml file from backend.
i have 5 xml files in databse. i need to get the xml files from database sequentially .means i need to get in a for loop.
how can i do this.
any one can help?
thanks
Raghuis your front end in Flex?
Sammi
Maybe you are looking for
-
I need to upload file with more than 15,000 records, which can exceed more than 1 GB. Regards, Sakthi
-
When and when not to use Appletalk?
Our network manager and the Tech Dept. boss (I am the Mac Support guy in a cross-platform school district) are concerned- no, panicking, that Appletalk is too "chatty" and interfering with the network. We have Cisco VOIP installed, and I've seen no p
-
Email workflow in CRM5.0
HI Problem 1 - I have a problem whereby my responsible group in our Agent Inbox does not get filled automatically. Ive been through SAP note 1143079 but still my problem persists The Workitem text of the Dialog step in SWI1 does not contain the Organ
-
Don't like IOS 7' can i downgrade?
I do not think iOS7 is suitable for iPad 3. The processor is not coping at all. It only just coped with the retina display before, but is really suffering now. The screen keeps freezing, button activations take seconds to respond or have to be presse
-
Artists has different name then what I put in
Ok so in my iTunes I have all my Weird Al tracks with the artist as Weird Al Yankovic In my iPhone it reads it as these two Weird Al Yankovic "Weird Al" Yankovic There is another artist with just quotes around Weird Al I have tried changing the sorti