[Flash MX] Dynamic Text and HTML FlashVars

Associate
Joined
21 Sep 2007
Posts
453
I am having some trouble with dynamic text boxes and HTML FlashVars.

To be more precise, my problems arise when I embed a dynamic text box into a movie clip.

The movieclip has the instance name "textbox"

Withing the clip, the dynamic box has the instance name "myDynamicTxt" and also a variable name "mytext" (was using the variable name before, when the text box was on the main timeline, without problems)

On the single frame in the MC, I have this code:

Code:
var mytext = "Hello!";

myDynamicTxt.text = mytext;

Now, in the HTML, I have tried various combinations such as:

Code:
FlashVars="textbox.myDynamicTxt.text=qwerty"

Code:
FlashVars="textbox.mytext.text=qwerty"

Code:
FlashVars="mytext=qwerty"

Sadly, nothing seems to work. I can change the mytext variable and it shows in Flash, I just cannot see how to use the HTML FlashVars to change the variable.

All thoughts and idea are welcome!

Thanks in advance
 
Last edited:
when you attempt to load the FlashVars, do you comment out the lines:
Code:
var mytext = "Hello!";
myDynamicTxt.text = mytext;
because i wonder if the html is sending the vars into flash just after the movie loads and then when the movie runs then the above is applied over the FlashVars.

if that fails, try and send the var to the root and then find it from there..

html:
Code:
FlashVars="sMyVar=qwerty"
flash root:
Code:
textbox.myDynamicTxt.text = sMyVar;
or from instance mc containing the textField:
Code:
myDynamicTxt.text = _root.sMyVar;

PS did you see i sorted the randomNumber issue?
http://forums.overclockers.co.uk/showthread.php?t=17832193
 
Last edited:
Hi Hector.

Firstly - yes i saw your random number solution, but in the end i used a nice piece of AS that pulled images from a folder and would allow you to easily change fade and static display times.

As for this problem, the code on the MC frame is not commented out, as i need to utilise it, but you may have a valid point about the commands overwriting one another.

I will try making the changes you have suggested and post results (after swearing at flash for a while :D )
 
Ok, adding the _root. to myDynamicTxt.text = mytext; has fixed it somewhat.

I say that because although the text specified in the HTML FlashVars is now displayed, it will not accept me using any HTML formatting, even though the dynamic text box is set to render HTML and worked previously when the box was not in a MC.

I have an idea im going to try, but i doubt it will work, im not a coder, im a code hacker/splicer :)
 
when you set a tf to accept html you need to use:
Code:
myDynamicTxt.[B]htmlText[/B] = "<span>something</span>";

not sure with MX but try typing TextField into the action panel, select that word and then press F1. with luck it'll take you directly to 'ActionScript 2.0 Language Reference >> TextField' and you will find a list of properties that can be used and some examples.
 
Last edited:
Thank you for your help Hector, but I managed to hack away at it, and got it fully working.

I ended up using TextFormat to change the colour of the text, which makes the HTML code a bit nicer aswell.

5 hours of searching google and swearing at the computer paid off.... i think lol!
 
Back
Top Bottom