Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 03-15-2005, 01:48 AM   #1
Yorgo12345
Member
 
Join Date: Mar 2005
Posts: 59
Default sending multiple 'loadvariables' to 'dynamic text'

hi everyone, this is my first post here.

I have a narrated movie that I want subtitled. I'm trying to set it up using dynamic text and an external text file called 'subs.txt'

I want the contents of subs.txt to have a block of text for each variable that will be sent to the 'dynamic text box'

so for example, subs.txt might look like this:

24 = First block of subtitles
60 = second block of subs
113 = third block etc...

with these variables in the file (in this case 24, 60, 113) a looping movieclip containing the dynamic text box will get the currentframe of the parentclip (on which the narrated movie resides) and check the subs.txt file for a corresponding variable name. if it finds one, it changes the 'Var' value of the dynamic text to that number.

does that make sense? ...I'll say it another way

so on frame 36, the script would check subs.txt for a variable named 36, on frame 37 it would check for 37 and so on and so on...

once it finds that variable, it would change the 'Var' in the dynamic text to that variable, thus diplaying the subtitles!

I've figured out how to use loadvariables, but I can't figure out how to get multiple variables per text file. and I have NO idea how to change the value of 'Var' in a dynamic text


did I explain this well enough? does anyone have any suggestions how I can go about setting this up?

Thanks in advance for any help");
Yorgo12345 is offline   Reply With Quote
Old 03-15-2005, 02:14 AM   #2
oka_
bleh.
 
oka_'s Avatar
 
Join Date: Jun 2004
Location: melbourne.aust
Posts: 303
Default

Welcome Yorgo

First of all, a variable name cannot be a number, so you'll need a different way of getting the frame numbers.

Secondly, you don't need to change the Var of a text box to change its value. You can just say:
PHP Code:
myTextBox.text "some text"
My suggestion would be to create a number of objects to hold your data and store them in an array. Each object should contain two variables, a frame number and a string for the subtitles. Each frame you check to see if the current frame matches the next object's frame number in the array. If it does, set your text box value to the corresponding subtitle string.

As far as loading multiple variables from a text file, I can't really remember off the top of my head. But I know that you can write more than one into a file like so:

?var1=10&var2="hello" etc... and read it in. (using loadVariables I think)

In that case you could do something like this with your text file:

PHP Code:
?frame1=20&sub1="this is line 1"&frame2=50&sub2="this is line 2" 
and so forth.

Read up on the forums and the help about the loadVariables() function.

hope that helps
-oka
oka_ is offline   Reply With Quote
Old 03-15-2005, 02:19 PM   #3
Yorgo12345
Member
 
Join Date: Mar 2005
Posts: 59
Default

Hey Oka, Thanks a lot, that '&' in the text file was HUGE!
bummer, about the number variable restrictions,

in Maxscript there is a "as string" command, is there some kind of equivalent in actionscript?
Yorgo12345 is offline   Reply With Quote
Old 03-15-2005, 05:22 PM   #4
Barn
digital curmudgeon
 
Barn's Avatar
 
Join Date: Feb 2005
Location: http://www.were-here.com
Posts: 1,082
Default

Quote:
in Maxscript there is a "as string" command, is there some kind of equivalent in actionscript?
Probably something similar, but you'd need to explain what that does.
Barn is offline   Reply With Quote
Old 03-15-2005, 05:35 PM   #5
oka_
bleh.
 
oka_'s Avatar
 
Join Date: Jun 2004
Location: melbourne.aust
Posts: 303
Default

Do you mean converting the number to a strring?

You can do that - but you still need to have a non-numerical name for the variable.

eg, i think this would work:
PHP Code:
var myString   String(22);               //sets myString to "22"
var myNumber parseInt(myString);   //sets myNumber to int value 22 
parseInt converts the string parameter to its int equivalent (number equivalent, not ascii code equivalent).

-oka
oka_ is offline   Reply With Quote
Old 03-20-2005, 07:12 PM   #6
Yorgo12345
Member
 
Join Date: Mar 2005
Posts: 59
Default

hey guys thanks for the feedback.

I've had only a little time to tinker around with this, but I've discovered that an external document can contain numerical variable names that work with dynamic text blocks.

in my text file subs.txt I have the following:

001 = this is the first line
&002 = this is the second line
&003 = this is the third line

etc.....

I have Loadvariables pointing to subs.txt

I have a dynamc text obj in my scene that spans the entire length of the movie, and every couple of frames I have an action that changes the Var value in the dynamic text block to a number in the subs.txt file

that works fine....

what I don't know how to do are the following:

1) to detect the current frame, and set the Var variable to that frame (actually, I just figured out how to do this while I was typing the question...lol...)

and

2) to inspect the text file for a variable that equals the currentframe, and if it does, only then update the Var variable

...does that make sense?
Yorgo12345 is offline   Reply With Quote
Old 03-22-2005, 11:26 AM   #7
Yorgo12345
Member
 
Join Date: Mar 2005
Posts: 59
Default

actually, I made a mistake... I never solved the variable issue with dynamic blocks

....how do I change the "Var" value in a dynamic text block?
Yorgo12345 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 01:11 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.