Web Design Forum: Urgent Help on dynamic text problem - Web Design Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Urgent Help on dynamic text problem Rate Topic: -----

#1 User is offline   Daniel Goh 

  • Forum Newcomer
  • Pip
  • View blog
  • Group: Members
  • Posts: 4
  • Joined: 14-June 09
  • Experience:Nothing
  • Area of Expertise:I'm Learning

Posted 14 June 2009 - 11:08 AM

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
0

#2 User is offline   Roberto 

  • Rain Dog
  • View blog
  • Group: Flash Master
  • Posts: 531
  • Joined: 19-August 07
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

Posted 14 June 2009 - 12:22 PM

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
0

#3 User is offline   Daniel Goh 

  • Forum Newcomer
  • Pip
  • View blog
  • Group: Members
  • Posts: 4
  • Joined: 14-June 09
  • Experience:Nothing
  • Area of Expertise:I'm Learning

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:

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?



View PostRoberto, 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

0

#4 User is offline   Daniel Goh 

  • Forum Newcomer
  • Pip
  • View blog
  • Group: Members
  • Posts: 4
  • Joined: 14-June 09
  • Experience:Nothing
  • Area of Expertise:I'm Learning

Posted 14 June 2009 - 02:53 PM

And Rob.

I forgot to mention. The movie clip symbol that holds the dynamic text field is at other scenes.
0

#5 User is offline   Daniel Goh 

  • Forum Newcomer
  • Pip
  • View blog
  • Group: Members
  • Posts: 4
  • Joined: 14-June 09
  • Experience:Nothing
  • Area of Expertise:I'm Learning

Posted 14 June 2009 - 03:21 PM

This is my script in XML.

<?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.
0

#6 User is offline   Roberto 

  • Rain Dog
  • View blog
  • Group: Flash Master
  • Posts: 531
  • Joined: 19-August 07
  • Gender:Male
  • Location:Suffolk
  • Experience:Intermediate
  • Area of Expertise:Coder

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users