-
change coordinates for movie clip using numeric stepper
Hello!
I really have no idea, how this would work, what code would do this action.
So I have a numeric stepper with an instance name my_nstep, then I have an object mc_mill, which coordinates the numeric stepper should change(if numeric stepper is pressed up, then mc_mill goes up for 5 pixels, if numeric stepper is pressed down, then mc_mill goes down for 5 pixels)
And also I have like these molecules - mc_mol, which would have to get compressed down or expand also with the nummeric stepper..
I know my code is totally wrong and Im sorry for that, but im really a noobie in coding..
so..this is how I tried to wrote it :
if(NumericStepper++);
mc_mill.y=5++;
else {
if(NumericStepper--);
mc_mill.y=5--;
}
this is the .fla file : numstepper.fla
I hope You understand and can help me
Thank You!!!
-
.
Hi,
You need to remove the small bit of you code have as it won't work with the numeric stepper, try this
PHP Code:
my_nstep.minimum = 0;// *** minimum value;
my_nstep.maximum = 100;// *** maximum value;
my_nstep.stepSize = 5;// *** Step amount; you can use decimals like so, my_nstep.stepSize = 0.25
my_nstep.value = 50;// *** Initial value;
// *** set mc_mill to numeric initial value, not necessary, but needed so you can make changes to layout;
mc_mill._y = my_nstep.value;
// *** Create listener object
var my_nstepListener:Object = new Object();
my_nstepListener.change = function(e:Object)
{
// *** Make changes to _y value;
mc_mill._y = e.target.value;
// *** Traces;
trace(e.target.value);
};
// *** Assign lisenter to object;
my_nstep.addEventListener("change",my_nstepListener);
you may need to change the layout a bit or put the mill inside of a clip and associate the _y values accordingly
-
.
Hi,
If you wish to have a non input text field with the numeric stepper, then add
PHP Code:
my_nstep.inputField.editable = false;
-
Oh My God, thank You for such a great great reply! The code is fantastic and Your help is much appreciated!
One small thing is that it works in the opposite directions - when num stepper is pressed up, the mill goes down, and when num stepper is pressed down, the mill goes up. But im gonna try fixing it.
Thank You again!
Last edited by Miamii; 03-16-2014 at 10:08 AM.
-
Designer, Programmer, Musician
PHP Code:
//IMPORTANT: We set the the height of your canvas here, //so the reverse script works var StageHeight:Number = 400; //////////////////////////////////////////////
my_nstep.minimum = 0;// *** minimum value; my_nstep.maximum = 400;// *** maximum value; my_nstep.stepSize = 5;// *** Step amount; you can use decimals like so, my_nstep.stepSize = 0.25 my_nstep.value = 50;// *** Initial value;
// *** set mc_mill to numeric initial value, not necessary, but needed so you can make changes to layout; mc_mill._y = my_nstep.value; mc_mill._y = StageHeight - my_nstep.value;
// *** Create listener object var my_nstepListener:Object = new Object(); my_nstepListener.change = function(e:Object) { // *** Make changes to _y value; mc_mill._y = StageHeight - e.target.value; // *** Traces; trace(e.target.value); };
// *** Assign lisenter to object; my_nstep.addEventListener("change",my_nstepListener);
Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries
-
.
Hi,
If you haven't adapted it yet or figured it out, perhaps you did it by yourself?
Although Angels was ok you were confined to the StageHeight var which is not so good if you want to move things around and the pusher did not stay within the jug when pressed, so I converted the graphics to a movieclip and so on.
Its CS5, low as I can go
Converting my AS2 hobby to AS3 http://fruitbeard.net/as3/site
-
Once again HUGE thanks for the help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|