Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 02-11-2003, 11:27 AM   #1
russsty
Registered User
 
Join Date: Feb 2003
Location: London
Posts: 35
Lightbulb Loading Text to flash:loadVariablesNum

I have one dynamic text box that has a variable name 'info'.
I have 6 buttons that I want to load in a different text file into this 'info' box each time the user releases the button.

Hence placing a new text file into 'info'.

I have set up one text file using '&info=' but how can I dynamically load in my others when the user clicks on another button??

Hope you can help,

Rusty
russsty is offline   Reply With Quote
Old 02-11-2003, 11:58 AM   #2
Lolotte
Registered User
 
Lolotte's Avatar
 
Join Date: Jun 2002
Location: Montreal, Canada
Posts: 56
Default

Give a different name to your different texts, like text1, text2, text3,...

Then, simply change the value of the variable "info" for the the text you want to display.

Something like:
ActionScript Code:
myButton2.onRelease = function(){ info = text2; } myButton3.onRelease = function(){ info = text3; }
if your dynamic textfield is in a movieclip, make sure you type _root.info for variable in the properties.


Lolotte
Lolotte is offline   Reply With Quote
Old 02-11-2003, 01:04 PM   #3
russsty
Registered User
 
Join Date: Feb 2003
Location: London
Posts: 35
Default

thanks, So, are text1, text2 etc. variables that hold the text strings and sit on frame 1 of the site? Or are these text files that are loaded in when the button is released?
russsty is offline   Reply With Quote
Old 02-11-2003, 01:13 PM   #4
Lolotte
Registered User
 
Lolotte's Avatar
 
Join Date: Jun 2002
Location: Montreal, Canada
Posts: 56
Default

Yes, they are variables holding your strings. They are loaded on the first frame (if they are coming from a text file), so they are already there when the user click on the button.

Have fun!

Lolotte
Lolotte is offline   Reply With Quote
Old 02-11-2003, 02:28 PM   #5
russsty
Registered User
 
Join Date: Feb 2003
Location: London
Posts: 35
Default

Thanks,
to set the variables on frame 1, do i just load them all in like;

root.loadVariables("text1.txt"); etc.

then place the code you mentioned on the button like;

myButton2.onRelease = function(){
info = text1;
}

But where do I initial;ize or set uip the variable?

Am I right in thinking this way the files are all loaded at the beginning and I just need to call them!

thanks for your patience!
russsty is offline   Reply With Quote
Old 02-11-2003, 02:43 PM   #6
Lolotte
Registered User
 
Lolotte's Avatar
 
Join Date: Jun 2002
Location: Montreal, Canada
Posts: 56
Default

kind of...

You can put all your texts in a single .txt file, with text1="your first text"&text2="your second text"&text3="your third text"...

this way, when it loads (with loadvariables) in flash, they already are associated with variables, placed on the main timeline.

The code provided in my preceeding message must not be on the button itself, but on the maintimeline. Ideally, you also put the code describing the onRelease also on frame 1, but since flash will have to load the text file, it will be a good idea to put it later on, to give flash the time to load it. Using loadVars, you can use an onLoad event.

If you prefer to put the code on the button, you would use on (release)... instead on myButton.onRelease = function()...

Hope it is clear

Lolotte
Lolotte is offline   Reply With Quote
Old 02-12-2003, 09:06 AM   #7
russsty
Registered User
 
Join Date: Feb 2003
Location: London
Posts: 35
Default

Lolotte,

Wicked, all in order,

many thanks!!

Rusty
russsty 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
loading an object from an array NateVeronica ActionScript 2.0 1 03-30-2004 10:53 PM


All times are GMT. The time now is 05:04 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.