Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-27-2005, 02:51 PM   #1
fullcircle
Registered User
 
Join Date: May 2005
Posts: 4
Question Problem loading text into a MC

I'm trying to load a text file into a my flash movie with the use of a button. I can get it to work if the text field and the button are on the SAME timeline or movie clip. My problem is when the button and the text box are in DIFFERENT movie clips.

Here's the code I'm using:
on (release) {
LoadVarsText = new LoadVars();
LoadVarsText.load("story1.txt");
//assign a function which fires when the data is loaded:
LoadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
stories.text = this.story;
} else {
trace("not loaded");
}
};
}


The Problem is the 'stories' text box is located in a movie clip called 'text_mc' and the button is on the main/root timeline. I thought the following would work but it doesn't...the output says "done loading" but nothing shows up.

on (release) {
loadVarsText = new loadVars();
loadVarsText.load("story1.txt");
//assign a function which fires when the data is loaded:
loadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
this.text_mc.stories.text = this.story;
} else {
trace("not loaded");
}
};
}

Need some help.....Thanks!!!!
fullcircle is offline   Reply With Quote
Old 05-27-2005, 02:58 PM   #2
natronp
Senior Member
 
Join Date: Nov 2003
Location: michigan
Posts: 382
Default hmm

hmm try this:

Code:
text_mc.stories.text = this.story;
or this:

Code:
this.text_mc.stories.text = LoadVarsText.story;
natronp is offline   Reply With Quote
Old 05-27-2005, 03:18 PM   #3
jrk_productions
JR
 
Join Date: Nov 2004
Location: Norway
Posts: 481
Default

Does anyone know, is it possible when importing html to include the pictures (not having to link every image..)?
jrk_productions is offline   Reply With Quote
Old 05-27-2005, 03:32 PM   #4
fullcircle
Registered User
 
Join Date: May 2005
Posts: 4
Question Let's go one step further

ok...thanks, that worked. Let's go one step further though. I now have my button in a movie clip called 'navigiation'. My text box is called 'menutext' and is buried in a few movie clips - menu > menutextarea > menutext. Here's my action script :

on (release) {
LoadVarsText = new LoadVars();
LoadVarsText.load("test.txt");
//assign a function which fires when the data is loaded:
LoadVarsText.onLoad = function(success) {
if (success) {
trace("done loading");
//Now that we know the data is loaded,
//set the text content of the Text Field
//with the instance name "scroller" equal to the
//contents of the variable
this_parent.menu.menutextarea.menutext.text = this.menu;
} else {
trace("not loaded");
}
};
}
fullcircle is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:52 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.