# Electric Simulation--Half Done

**URL:** <https://forum.kirupa.com/t/electric-simulation-half-done/205962>\
**Category:** flash\
**Created:** [November 3, 2006, 4:36pm UTC](https://forum.kirupa.com/t/electric-simulation-half-done/205962 "2006-11-03T16:36:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![navigator81](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@navigator81](https://forum.kirupa.com/u/navigator81)\
**Post date:** [November 3, 2006, 4:36pm UTC](https://forum.kirupa.com/t/electric-simulation-half-done/205962/1 "2006-11-03T16:36:03Z")

</div>

Hi,  
below is the code i am using to associate a [COLOR=darkred]ULScrollbar Component[/COLOR] with a Text field so that on every single scroll point (divided in 4 portions) a value is displayed in text field [COLOR=blue]“TextBox”[/COLOR]  
Scroll position is stored in a variable [COLOR=blue]“ScrollP”[/COLOR]

[COLOR=darkred]Here is the Code :[/COLOR]

Scroller\_mc.[COLOR=#000000]setScrollProperties[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]1[/COLOR], [COLOR=#000000]0[/COLOR], [COLOR=#000000]4[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#f000f0]_[COLOR=gray]//[/COLOR]_[/COLOR]  
[COLOR=#993300]var[/COLOR] scrollListen = [COLOR=#000000]{[/COLOR][COLOR=#000000]}[/COLOR];  
scrollListen.[COLOR=#993300]scroll[/COLOR] = [COLOR=#993300]function[/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"eventObj.target = "[/COLOR]+eventObj.[COLOR=#993300]target[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#993300]var[/COLOR] scrollP = eventObj.[COLOR=#993300]target[/COLOR].[COLOR=#000000]scrollPosition[/COLOR];  
[COLOR=#993300]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]"ScrollP = "[/COLOR]+scrollP[COLOR=#000000])[/COLOR];  
TextBox.[COLOR=#993300]text[/COLOR] = .[COLOR=#000000]6[/COLOR] + COLOR=#000000[/COLOR] \* .[COLOR=#000000]2[/COLOR];  
[COLOR=#000000]}[/COLOR]  
Scroller\_mc.[COLOR=#000000]addEventListener[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]“scroll”[/COLOR], scrollListen[COLOR=#000000])[/COLOR];

[COLOR=gray]//code end[/COLOR]

Now i want to add another functionality :  
There are 4 Movie clips of Bulbs on the stage : [COLOR=blue]mc1, mc2, mc3, mc4[/COLOR]

what i want is :

\_visible property of the Clips is interacting with the slider…so that when **[COLOR=blue]ScrollP[/COLOR]** is 0,None of the Movie clips are visible,[COLOR=blue]when its 1,Mc1 displays on the screen[/COLOR],[COLOR=blue]when it is 2,mc2 and mc1 \*\*both \*\*are visible[/COLOR] and so on and so forth ,[COLOR=blue]when the ScrollP is **“4”** all Movieclips are visible,[/COLOR]when we go back ,the Movie clisp turns off one by one …till ScrollP is “0”

I can imagin a [COLOR=blue] **Switch Condition** [/COLOR] is required here but i guess i am missing something on it …

Can anyone help with this plz …

Thanks alot in advance 🙂
