all groups > flash actionscript > april 2004 >
You're in the

flash actionscript

group:

Levels problem - my dynamic text has disappeared


Levels problem - my dynamic text has disappeared JohnFH
4/30/2004 8:07:34 PM
flash actionscript:
Okay...this is FlashMX...I have a swf called "data-workshops.swf" and in that
swf is a movie clip with instance name of 'text'. In that movie clip is a
dynamic text field, also with an instance name of 'text'...and a
Flash-component scrollbar that is assigned to 'text.' And on frame 1 is this
script:

loadVarsText = new loadVars();
loadVarsText.load("workshops.txt");
loadVarsText.onLoad = function (success){
if (success){
trace ("done loading");
text.html = true;
text.htmlText=this.var1;
}else{
trace ("not loaded");
}
}

So..."workshops.txt" loads in to the dynamic text field just fine when I test
THAT swf. No worries. I can see the text from the external txt document. But...

I have my Menu on a whole 'nother level. So, when someone pushes a button in
the "menu.swf", which is on level 200, here is what is supposed to happen: the
movie clip "data-workshops.swf" loads into an empty mc with an instance name of
holdClip. When I test the menu.swf, the text is now not there.

But wait - there's more!

The scrollbar THINKS there is still text there - 'cos it has adjusted itself
to the amount of text that is in the workshops.txt document. And I can scroll
the scroll bar...it's just as if I am scrolling invisible text.

Also...I added some static text to the "data-workshops.swf"...in the exact
same place as the dynamic text field. And it shows up fine! So, from this I
know that the "data-workshops.swf" has been loaded into the empty movie clip
(holdClip). It's just that the text from the "workshops.txt" file has not made
the transition - even though the scroll bar is somehow still reading it.

Do I win a prize or something for the longest question?

If this is easy, I will off myself. :-)
Re: Levels problem - my dynamic text has disappeared MyFlashMXIN
4/30/2004 10:22:53 PM
Re: Levels problem - my dynamic text has disappeared DoubleX
4/30/2004 10:24:29 PM
I was trying but i couldnt follow your question, hehe, probably because it was
too late in the day, but anywho, try avoiding using reserved words for instance
names, sometimes it throws flash off, try mytext isntead or something,
otherwise when referencing to them, flash may get the two confused.

I can probably help if you try that and then see if you get the same errors,
then possibly explain the problem a tad better.

Either way, good luck.


Re: Levels problem - my dynamic text has disappeared JohnFH
4/30/2004 11:32:00 PM
DoubleX - thanks for the attempt. No, it is not an instance name issue. I know
this because my original version of this site (which used the same instance
names) worked fine. It is only when I broke the site apart and put it on
different levels that the problem arose.

I wish I could describe it better.

Let's try it this way:

My main movie ("mainmovie.swf") has a button in it.

When the user clicks the button, a new movie clip ("new.swf") is loaded into a
holding area of the main movie.

In "new.swf" is a dynamic text field and a graphic.

The dynamic text field holds text from an external document (a .txt file).

When I ctrl+enter test the "new.swf" file, the text and graphic both appear
like they are supposed to.

When I ctrl+enter test the "mainmovie.swf", the graphic appears just fine -
but the text does not appear at all.

??
Re: Levels problem - my dynamic text has disappeared Pluda
4/30/2004 11:54:25 PM
ok, I've tasted that too! :-)

suposing that your text is in "myTxts/sample1.txt"

in you new.swf you chould use the path like this:

LoadVariables("computer/myTxts/sample1.txt", 1);

Now, hen you publish your movie, the output will say that he cant find your
text, but when you publish your main.swf everithing will work.

Hope I've helped you

Pluda
Re: Levels problem - my dynamic text has disappeared JohnFH
5/1/2004 12:03:24 AM
Hmmm...thank you - I will try this.

Re: Levels problem - my dynamic text has disappeared Pluda
5/1/2004 12:10:35 AM
1 is level 1 :-)

Re: Levels problem - my dynamic text has disappeared JohnFH
5/1/2004 12:27:31 AM
I thought so. But neither my mainmovie.swf or my new.swf is on level 1. Does that make a difference? Or are we putting the variable (the text) on its own level?

Re: Levels problem - my dynamic text has disappeared JohnFH
5/1/2004 1:12:03 AM
Re: Levels problem - my dynamic text has disappeared DoubleX
5/2/2004 10:06:34 PM
Hmm, i see. Well, what version of flash did it work in, and what verision are
you building it in now?

Ok, and the 2nd thing, how are you refrencing the text file, and the field
names? What is the full path you use while it is in the new.swf (the one that
works)? for Example, to you use myfield.text=loadedText; or
_root.myfield.text, or what is the path?

the last thing, you can just post the fla and i can check it out, not sure if
its content sensetive or what not, but either way i wouldnt mind.

gl with it.


Re: Levels problem - my dynamic text has disappeared JohnFH
5/2/2004 11:24:56 PM
DoubleX...I wrote the site in FlashMX and it still is in FlashMX. No change in
authoring software from "working" to "broken." Only change between the two
versions is the working one was all in one swf and the broken one is on
multiple swfs layering on top of one another.

The code I use can be read in my original (very confusing) post at the top of
this thread. I dumbed down the explination of it all later on.

The files are a bit proprietary. But I would like to figure this thing the
hell out! Can I contact you privately?
Re: Levels problem - my dynamic text has disappeared DoubleX
5/3/2004 5:25:09 PM
Re: Levels problem - my dynamic text has disappeared DoubleX
5/3/2004 5:54:29 PM
Ok, well, the only problem i saw was that in the first line, the loadVars.. the
letter L should be capitalized because otherwise it thinks its a different
object... but aside from that i tested the code and it worked. workshops.txt
was a lot simpler then yours probably. One test you could do to make sure its
not what is cousing the problem, is place your workshops.txt instead of mine,
and test my holder clip again. Edit the swf1. fla textfield to display it
properly though cuz right now i think its a single line field.

here is what i have. 2 Swf files. 1 called "holder.swf" and one "swf1.swf".
The holder swf has a button inside of it that loads "swf1.swf" into a movie
clip holdClip which is empty just like yours. The button script is

on(press){
loadMovie("swf1.swf",holdClip);
}

the swf1.swf file has your script with the capitalization changed:
loadVarsText = new LoadVars();
loadVarsText.load("workshops.txt");
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
text.html = true;
text.htmlText = this.var1;
} else {
trace("not loaded");
}
};

and a textfield with an instance name of "text", text inside is black, arial.,

finally the workshop.txt file has the following inside of it:
&var1=my text&

It all works, when you press the button in the holder, it loads the swf1.swf
right in and displays "my text" in the texfield.

here is a zip file of it all. I saved as MX so you should be able to open the
files with no problems. Let me know if any come up though since i put it
together real quick with MX2004. If that typo of LoadVars was just that and
doesnt fix anything, send me the necessary files and i will be glad to take a
look at them more. Anywho, good luck with it :).


Nino
AddThis Social Bookmark Button