Link to home
Start Free TrialLog in
Avatar of b4tch
b4tch

asked on

Refreshing a movie clip

Hi,

I've got a movie clip with several embeded movie clips.  In the top level clip, i want to reference one of these embeded clips(possibly 2 levels down), edit a textinput component's text property, and change the frame being shown.  This is all happening properly except the page isn't being refreshed to show the text in the input box.  I know it's being set correctly through tracing out the text property of it - it's just not refreshing the display.

Any help is greatly appreciated.
Avatar of muso120999
muso120999

Can you show an example of what you mean?  Ideally an FLA if possible.
Avatar of b4tch

ASKER

I've uploaded an example at http://www.boredatuni.com/refresh.html
from which you can also download the fla.  I *think* i may be referencing the text box incorrectly, although I don't know how.

Thanks for your time
I'm afraid it's because you dont have the text component:

mc1.mc2.tb_txt

on frame 1 of your movieclip.  You can't reference it otherwise.

The best you can do is to hide it (or the mc it's in) until it's in the state that you want it to show.
The reason the fla you posted isn't working is because your setting the value BEFORE the movive clip has been loaded. For example put a trace("1"); in your mc2 on frame 2 and a trace("2"); on the first frame of the root movie after the gotoAndPlay(2); . In your output you'll notice that it puts a 2 before it puts a 1.

To fix theres a wide range of solutions. Possibly on mc2 when it reaches frame2 call a function that places the word "test" in the box, or on load the text gets loaded in. The input box isn't instantiated until the movie gets to that frame and thus since it goes to the next command before even getting to frame 2 it can set an object with that variable but it can't exactly process that data into the textinput because it doesn't exactly "exist" yet.
I forgot, I also changed the code to:

myStyle = new TextArea.StyleSheet();
myStyle.load("styles.css");
myStyle.onLoad = function(success) {
      if (success) {
            trace("loaded");
            TextHolder.styleSheet = myStyle;
      }
};
thisText = new LoadVars();
thisText.load("example.txt");
thisText.onLoad = function(success) {
      if (success) {
            TextHolder.text = thisText.myText;
      }
};


but my statement above still stands
D'oh - ignore my last post, as it's strangely irrelevent.  Brain isn't working
Avatar of b4tch

ASKER

thank you both for your input.  Now i've learnt that it's not working because the text box doesn't actually "exist" when i'm trying to populate it, i think i will use the setInterval method to put the text in the box (just a first attempt, i may decide on another way later)...

mc1.mc2.gotoAndStop(2);
a = setInterval(addText,200);
function addText() {
      mc1.mc2.tb_txt.text = "TEST";
      clearInterval(a);
}
Looks like a decent solution to me - I hadn't noticed your gotoAndStop, so I didn't get to the crux of your problem
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial