Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > Extensions and Plugins > Components

Reply
 
Thread Tools Rate Thread Display Modes
Old 11-20-2001, 07:15 PM   #1
Nicidemus
do not-doing
 
Nicidemus's Avatar
 
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
Default Help with dynamic scroller

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;
Nicidemus is offline   Reply With Quote
Old 11-20-2001, 07:15 PM   #2
Nicidemus
do not-doing
 
Nicidemus's Avatar
 
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
Default

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.
Nicidemus is offline   Reply With Quote
Old 11-20-2001, 07:17 PM   #3
Nicidemus
do not-doing
 
Nicidemus's Avatar
 
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
Default

m
Nicidemus is offline   Reply With Quote
Old 11-20-2001, 07:39 PM   #4
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

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();
Make sense? The brackets tell Flash to evaluate whatever is in those brackets on the level that was last designated... ummm, that didn't make much sense to me, so I'll show another example...

Code:
whichMC = "subMC";
_root["targetMC" + 1][whichMC].play();
See how that works? This would literally evaluate out to:
_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.
20 Ton Squirrel is offline   Reply With Quote
Old 11-20-2001, 08:02 PM   #5
Nicidemus
do not-doing
 
Nicidemus's Avatar
 
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
Default

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?
Nicidemus is offline   Reply With Quote
Old 11-20-2001, 08:18 PM   #6
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

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 08:37 PM.
20 Ton Squirrel is offline   Reply With Quote
Old 11-20-2001, 08:43 PM   #7
Nicidemus
do not-doing
 
Nicidemus's Avatar
 
Join Date: Nov 2001
Location: Toronto, Canada
Posts: 79
Default

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]
Nicidemus 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
adding HTML functionality to Billy T's dynamic scroller Goose ActionScript 1.0 (and below) 0 01-14-2005 02:18 PM
Dynamic text under dynamic mask w/ MS+ scroller....... G-Rard B Other Flash General Questions 0 12-22-2004 11:13 PM
disable red penguins dynamic scroller jevans ActionScript 1.0 (and below) 3 06-10-2003 07:54 PM
scroller not working - dynamic text load texbala ActionScript 1.0 (and below) 3 01-09-2003 03:11 AM


All times are GMT. The time now is 08:27 AM.

///
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.