Solved

Refreshing a movie clip

Posted on 2004-10-05
11
200 Views
Last Modified: 2010-04-03
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.
0
Comment
Question by:b4tch
11 Comments
 
LVL 10

Expert Comment

by:muso120999
Comment Utility
Can you show an example of what you mean?  Ideally an FLA if possible.
0
 

Author Comment

by:b4tch
Comment Utility
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
0
 
LVL 10

Expert Comment

by:muso120999
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:Drakkon
Comment Utility
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.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 10

Expert Comment

by:muso120999
Comment Utility
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
0
 
LVL 10

Expert Comment

by:muso120999
Comment Utility
D'oh - ignore my last post, as it's strangely irrelevent.  Brain isn't working
0
 

Author Comment

by:b4tch
Comment Utility
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);
}
0
 
LVL 10

Expert Comment

by:muso120999
Comment Utility
Looks like a decent solution to me - I hadn't noticed your gotoAndStop, so I didn't get to the crux of your problem
0
 

Accepted Solution

by:
modulo earned 0 total points
Comment Utility
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
The goal of the tutorial is to teach the user how to how to record live broadcast.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now