vendredi 14 avril 2017

How do I get images to update dynamically with a slider in actionscript 3?

Here is my dilemma. We use image stacks a lot here with alpha channels. I want to call up images in series using a slider. I am getting a concatenated string a pull up an image from my folder. But I can get the images to load dynamically when I slide the slider bar. I am using the frame number to change the file name to pull up the next frame. I can get the image to show up if I put the loader outside of the function, but when I put the loader in the function I get error after error saying the file cannot be located. I would really appreciate any help. I have a fear of coding and I am hoping a forum like this will help me break through in areas like this where I always fall on my face. Here is the code as it currently stands.

var imgLoader = new Loader();
var str1 = String (".jpg");
var sliderValue:uint = mySlider.sliderKnob.x / 3;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
function onEnterFrame(event:Event):void {
    sliderValue = mySlider.sliderKnob.x / 3;
    status_txt.text = "Slider position is: "+sliderValue;
    fileText.text = "Sketch_0"+sliderValue+".jpg";
    imgLoader.load( new URLRequest ( "Sketch_0"+sliderValue+".jpg"));
addChild(imgLoader);
setChildIndex(imgLoader, 0); 
}

Thanks in advance. It's embarrassing to put code on the web and reveal my ignorance.

H

Aucun commentaire:

Enregistrer un commentaire