-
1. Re: Import XML data
kglad Jan 21, 2010 9:53 AM (in response to d0brin)we can give you a lot of information but noone can tell you your xml's structure. that's for you to determine. or, you could get help making that decision if you specify what data will be in the xml file.
-
2. Re: Import XML data
d0brin Jan 21, 2010 10:04 AM (in response to kglad)well just make it as an example with few categories and the as to import the data from each category to diferent text fields and i will figure it out
-
3. Re: Import XML data
kglad Jan 21, 2010 10:23 AM (in response to d0brin)your a.s.:
var tl:MovieClip=this;
var xml:XML=new XML();
xml.ignoreWhite = true;
xml.onLoad = parseXML;
xml.load("text.xml");function parseXML(){
for(var i:Number=0;i<this.firstChild.childNodes.length;i++){
tl["tf"+(i+1)].text=this.firstChild.childNodes[i].firstChild.nodeValue; // where tf1 and tf2 are your textfields
}
}your xml:
<xml>
<textfieldtext>text for tf1</textfieldtext>
<textfieldtext>text for tf2</textfieldtext>
</xml> -
4. Re: Import XML data
d0brin Jan 21, 2010 10:54 AM (in response to kglad)and how you define which category form the xml file response to a certain text field?
-
5. Re: Import XML data
kglad Jan 21, 2010 10:56 AM (in response to d0brin)the first node corresponds to the first textfield etc as indicated by the text in the xml.
-
6. Re: Import XML data
d0brin Jan 21, 2010 11:01 AM (in response to kglad)and if i need to add to this AS and XML code a new category for the text field named container...how it would be?
-
7. Re: Import XML data
kglad Jan 21, 2010 11:16 AM (in response to d0brin)you don't need to change any a.s. as long as you have enough textfields defined:
<xml>
<textfieldtext>text for tf1</textfieldtext>
<textfieldtext>text for tf2</textfieldtext><textfieldtext>text for tf3</textfieldtext>
<textfieldtext>text for tf4</textfieldtext><textfieldtext>text for tf5</textfieldtext>
<textfieldtext>text for tf6</textfieldtext>
</xml> -
8. Re: Import XML data
d0brin Jan 21, 2010 11:46 AM (in response to kglad)but where i need to place the AS code when my text fields are in movie clips, should this code be on the main scene cuz it doesn't work :X And how to make the text selectable?
-
9. Re: Import XML data
kglad Jan 21, 2010 11:50 AM (in response to d0brin)what are the path/names for your textfields?
-
10. Re: Import XML data
d0brin Jan 21, 2010 12:01 PM (in response to kglad)well they are spread all over the website how i can define every single one of them?
-
11. Re: Import XML data
kglad Jan 21, 2010 12:32 PM (in response to d0brin)every textfield that you want to reference using actionscript will need a path/name that's known to you. flash will assign each unnamed object an instance name but that can be pretty tough to organize because they all have names like instance22 and instance59.
-
12. Re: Import XML data
d0brin Jan 21, 2010 1:12 PM (in response to kglad)where to define the path?
-
13. Re: Import XML data
kglad Jan 21, 2010 1:18 PM (in response to d0brin)the path is determined by assigning instance names to the movieclips that contain your textfields. so, if a textfield is on a timeline, you assign the textfield an instance name in the properties panel. then you assign an instance name to the parent movieclip that contains that timeline etc until you reach the main timeline.
-
14. Re: Import XML data
d0brin Jan 21, 2010 1:27 PM (in response to kglad)aha and the name is the same tf1? for reaching tf1?
-
15. Re: Import XML data
kglad Jan 21, 2010 1:38 PM (in response to d0brin)if you have a textfield with instance name tf1 on the timeline that contains that code, tf1 is all that's needed to reference that textfield from that timeline.
if you have a movieclip with instance name p on the timeline that contains that code and p has a movieclip with instance name c on its timeline and c has a textfield named tf1 on its timeline, p.c.tf1 would be needed to reference that textfield from the timeline that has the code.
-
16. Re: Import XML data
d0brin Jan 22, 2010 4:59 AM (in response to kglad)so i place this p.c.tf1 as an instnace name of the text field that is conitaned in the c mc and the c mc is in the p mc or i have to put it as AS code?
And one more thing how to make with what AS code and XMl syntax, to make from 2 foldiers thumbs and photos a thumb to be loaded on designated mc and a photo to be loaded on an other mc and a text to be shown from the XML file? It slike a gallerie with thumbs and photos and text how to make that?
-
17. Re: Import XML data
kglad Jan 22, 2010 7:48 AM (in response to d0brin)no.
on the main timeline, click on that parent and in the properites panel assign the name p. on p's timeline, click on that child movieclip and in the properites panel assign the name c. on c's timeline, click on that textfield and in the properties panel assign the name tf.
finally, you need to start learning flash and return here for questions about problems you're having. if you want this done for you, you should send me an email via kglad.com to hire me.
-
18. Re: Import XML data
d0brin Jan 22, 2010 2:03 PM (in response to kglad)aha ok and btw i dont get that
on the main timeline, click on that parent and in the properites panel assign the name p. on p's timeline, click on that child movieclip and in the properites panel assign the name c. on c's timeline, click on that textfield and in the properties panel assign the name tf.
what do you mean like from the properties panel i give the instance name? or you mean something else? l
-
19. Re: Import XML data
kglad Jan 22, 2010 2:56 PM (in response to d0brin)do you know what the "properties panel" is? (click window/properties.)
-
20. Re: Import XML data
d0brin Jan 23, 2010 1:01 AM (in response to kglad)i know the panel ... but what i don't understand is where i type this p.c.tf1 thing... on a frame label or mc instance name or var?
-
21. Re: Import XML data
kglad Jan 23, 2010 8:16 AM (in response to d0brin)on the main timeline, click on that parent and in the properites panel assign the name p. on p's timeline, click on that child movieclip and in the properites panel assign the name c. on c's timeline, click on that textfield and in the properties panel assign the name tf1.
you can then use p.c.tf1 to reference that textfield using code on the main timeline.
-
22. Re: Import XML data
d0brin Jan 23, 2010 8:58 AM (in response to kglad)yes but what is that code that is what i am trying to find out
-
23. Re: Import XML data
kglad Jan 23, 2010 12:37 PM (in response to d0brin)if you want to assign text to p.c.tf1, you can type the following in the actions panel:
p.c.tf1.text="this is tf1 text";
if you have textfields tf1,...,tf10 in p.c., you can use:
p.c["tf"+i].text = ...
// instead of tl["tf"+i].text that i suggested in an above message.
-
-



