Hello, I'm fetching content from XML into flash dynamic text field.
***Here's, an example of what i did***
***This has applied to a button, once it was click, the text will change accordingly***
var english2 = new XML();
english2.ignoreWhite = true;
var entry = 0;
var total = 0;
var current = 0;
english2.load("english2.xml");
english2.onLoad = function(success) {
if (success) {
enbottom_txt = this.firstChild.childNodes[_root.entry].attributes.enbottom;
***This work well when the text field is on the main movie***
It won't work for text field that is within a movie symbol.
I have name the MovieClip symbol- ani_mc
And name the textfield within the MovieClip symbol- en3in1_txt
Is there any ways for me to get into the dynamic text within the movie symbol?
Any help is appreciated! Thank
Page 1 of 1
Urgent Help on dynamic text problem
#3
Posted 14 June 2009 - 01:56 PM
Hi Rob,
Thanks for replying. If the texts is key in the actionscript. Does that mean that i don't need an XML for that?
I have try out your method. The text still doesn't show.
Basically, I have 5 XML and 5 buttons. Each button are assigned to load different XML.
Here's are the more detail script for the button:
Which part should i insert the script to?
Thanks for replying. If the texts is key in the actionscript. Does that mean that i don't need an XML for that?
I have try out your method. The text still doesn't show.
Basically, I have 5 XML and 5 buttons. Each button are assigned to load different XML.
Here's are the more detail script for the button:
on (release) {
gotoAndPlay("intro", "intro2_english");
loadMovie("english header.swf",1);
var english2 = new XML();
english2.ignoreWhite = true;
var entry = 0;
var total = 0;
var current = 0;
english2.load("english2.xml");
english2.onLoad = function(success) {
if (success) {
enbottom_txt = this.firstChild.childNodes[_root.entry].attributes.enbottom;
enexpress_txt = this.firstChild.childNodes[_root.entry].attributes.enexpress;
enapp_txt = this.firstChild.childNodes[_root.entry].attributes.enapp;
}
};
}Which part should i insert the script to?
Roberto, on Jun 14 2009, 20:22, said:
Hello
You could try :
this.ani_mc.en3in1_txt.text = "test String to see if path to textfield works";
or
_root.ani_mc.en3in1_txt.text = "some text";
Rob
You could try :
this.ani_mc.en3in1_txt.text = "test String to see if path to textfield works";
or
_root.ani_mc.en3in1_txt.text = "some text";
Rob
#5
Posted 14 June 2009 - 03:21 PM
This is my script in XML.
I need a way to do it like how i did. The XML will change all the text regardless of which scene it is.
If i apply it into AS itself. Dynamic text will reset when i move scene to scene.
<?xml version="1.0" encoding="UTF-8"?> <contacts> <entry enbottom="Upload your photo to see yourself in a new color today. Visit www.freshlookcontacts.com for more information." enexpress="Express yourself naturally with FreshLook patented 3-in-1 color technology*" enapp="*Applicable for FreshLook One-Day and FreshLook ColorBlends only." /> </contacts>
I need a way to do it like how i did. The XML will change all the text regardless of which scene it is.
If i apply it into AS itself. Dynamic text will reset when i move scene to scene.
#6
Posted 14 June 2009 - 04:40 PM
Hello
If the movieclip is on a different frame on the timeline, store the text needed for each of your scenes in an array/variable and add the text to the textfield when you enter the scene eg.
On the frame you load the xml, store the text for scene two in a var named sceneTwoText :
var sceneTwoText:String = "";
In the onLoad function :
sceneTwoText = this.firstChild.childNodes[_root.entry].attributes.enbottom;
In the actions for the frame that contains scene two :
movieclipName.textfield.text = sceneTwoText;
If a movieclip does not exist on the frame you try to access it, flash will not know where it is + it will cause an error.
Rob
If the movieclip is on a different frame on the timeline, store the text needed for each of your scenes in an array/variable and add the text to the textfield when you enter the scene eg.
On the frame you load the xml, store the text for scene two in a var named sceneTwoText :
var sceneTwoText:String = "";
In the onLoad function :
sceneTwoText = this.firstChild.childNodes[_root.entry].attributes.enbottom;
In the actions for the frame that contains scene two :
movieclipName.textfield.text = sceneTwoText;
If a movieclip does not exist on the frame you try to access it, flash will not know where it is + it will cause an error.
Rob
Share this topic:
Page 1 of 1

Help






MultiQuote









