Flash UI Help•
I'm trying to build a simple little interactive widget where people can use a slider to select different options and then a movie clip plays. I have the slider from the components library set up with the right number of tick marks, my question is ... is there a way to make it so each time the slider stops at a different tick mark a different movie clip plays? Any help would be greatly appreciated! Thanks!
•
yes, of course you can do that ! first, make sure that your Slider Component is given an instance name, so you can script it however you want. in action script you will need to import the SliderEvent class from flash events. then you attach a listenr to the slider, and write your function based on the 'ticks'. you already know how to create the number of 'ticks' that you want, but for those who don't: from the Component Inspector, you choose a "maximum" value,"minimum" value, and also a 'tick interval' value. The maximum and minimum number are the numeric values you give for the begiining of the slider and the end of the slider. you usually leave the minum value at its default value of 0. then, say, you can set the maximum value to 100, or to 10, or whatever number makes sense to you. the tick interval will be how many intervals there are on the slider based on your maximum value and your mimum number( assuming minimum value is 0). so for instance if your maximum value is 100, and you put a tick interval of 10, you will have 10 intervals, with numeric values at 0,10,20,30,40 etc. if you have a min value of 0, a max value of 20, and a tick interval of 2, then you still get 10 intervals, but their numeric values are 0,2,4,6,8,10,12,14,16,18,,and 20. (10 tick intervals give you 11 slider/tick positions) then write your function using IF statements, based on which tick interval is called by the slider. if (mySlider.value == 10){gotoAndStop(6) is a typical line of code for that. here is a bare bones example i once made to illustrate this point. it takes a SLider Component, given an instance name "mySlider", with a maximum value of 20, a minimum value of 0 , and tick intervals every 2 ( so there are 10 intervals). i placed some numbers above the tick marks to illustrate the tick interval values of the corresponding tick mark. then i placed frame labels on frames ( labels 0,2,4,6,8,10,12,14,16,18,and 20) which will correspond to the tick marks on the Slider. so my code, if you read it, will show that depending on the tick mark that you move the slider to ( the "event.target" ) it will navigate the timeline to the corresponding frame label ( since the frame label is the same as the actuall value of the tick inteval ( i.e. the "event.target.inteval") the example: ww.demetrimedia.com/Sven/SliderDemo.swf the code: import fl.events.SliderEvent; you can see that your function can be written to do anything at the slider/tick positions it can load/ unload SWFs, navigate any timeline, change videos, or pictures in a galleries, etc. hope that helps and makes sense.
