| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
do not-doing
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
|
I have created a scroller that loads the text from the text file dynamically. (flash generates the variable names)
when I try to call the text into the scroll box I have to access another movie to get the name of the variable. e.g. windowtext = _parent._parent._parent.nav.w; |
|
|
|
|
|
#2 |
|
do not-doing
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
|
w is the result of a calculation that gives me a random name.
for arguments sake let's say that w=scott1. Now, scott1 is a variable in my text file and contains the info that I want displayed in my scroll box. But....and here it comes. when the variable is called into the scroll movie, windowtext sees it as a string not a variable. Thus it dispalys scott1 in the window. Now at lunch I did some reading. I came accross an article that is about complex paths. It included instructions on how to use [] to convert strings into variables. I have tried to use this info but when i trace(typeof(windowtext)) it comes back undefined. |
|
|
|
|
|
|
|
|
#3 |
|
do not-doing
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
|
m
|
|
|
|
|
|
#4 |
|
Risu Oyabun!
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
|
Ooooooooooooh, okay. Gotcha, I understand your question now. Having trouble posting or something?
Ummm, okay, you are on the right track with using the brackets for evaluation. Take this example... I have an MC on my stage called targetMC1. Code:
whichMC = "targetMC1"; _root[whichMC].play(); Code:
whichMC = "subMC"; _root["targetMC" + 1][whichMC].play(); _root.targetMC1.subMC.play(); The use of the brackets for evaluation is ever-so-much better than the actual use of the eval() function. Just experiment and you'll get the hang of it. |
|
|
|
|
|
#5 |
|
do not-doing
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
|
Sorry about posting twice I didn't realize I had I thought I deleted that post.
I have been playing around with the [] but haven't been able to get them to work properly. This is what I have tried: I need windowtext = scott1 in another movie scott1 is created here (in relation to windowtext) _parent._parent._parent.nav.w; At first I tried: windowtext = _parent._parent._parent.nav.w; that gave me scott1 displaying in the scroll box. After I read about [] I was hoping to get away with. windowtext = _parent._parent._parent.nav[w]; so I can acces the info held in the variable in the .txt file and diaplay that in the scroll box. When I added the [] to windowtext = _parent._parent._parent.nav[w]; and traced windowtext it came back un defined. Am I using the [] wrong? if so how can i make: windowtext = scott1; (scott1 located (_parent._parent._parent.nav.w )by accessing the scott1 from another movie? |
|
|
|
|
|
#6 |
|
Risu Oyabun!
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
|
Yoru first attempt at using the brackets should have worked. Is your [FONT=courier new]scott1[\FONT] variable located three levels back inside a MC called [FONT=courier new]nav[\FONT]?
windowtext = _parent._parent._parent.nav[w]; Check your pathing... could you list out what MCs you have from the root leading all the way to where you are calling this statement from? Something like: [code] _root listbox optionbox option1 nav option2 nav ... [\code] Just so I can visualize what you are doing here.... Do you need to dynamically reference the variables by using _parent or can you do a static reference to it like: _root.listbox.optionbox.nav[w]; Alternatively, you could post up your FLA and we can vivisect it. Last edited by 20 Ton Squirrel; 11-20-2001 at 09:37 PM.. |
|
|
|
|
|
#7 |
|
do not-doing
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
|
Before I rip into the pathing situation:
I would like to keep the path to w relitive so I can call the scroller from other clips. I'll have to find a away to get w on the the _root of the load movie so the path can be rewritten _parent._parent._parent[w]; Also If i eliminate the [] the current script will write scott1 in the scroll box. So I'm sure it leads to the right path. I have noticed two things in all of the examples when using []. One _root is always the path. Is this a design or is it because it is easer? Two, there is always an action after eg _root["mc"+1].play (); Can I use the [] to re define a variable? eg wer=_root["mc"+1] |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| adding HTML functionality to Billy T's dynamic scroller | Goose | ActionScript 1.0 (and below) | 0 | 01-14-2005 03:18 PM |
| Dynamic text under dynamic mask w/ MS+ scroller....... | G-Rard B | Other Flash General Questions | 0 | 12-23-2004 12:13 AM |
| disable red penguins dynamic scroller | jevans | ActionScript 1.0 (and below) | 3 | 06-10-2003 08:54 PM |
| scroller not working - dynamic text load | texbala | ActionScript 1.0 (and below) | 3 | 01-09-2003 04:11 AM |