Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Action Script 3 previous Value ?

New Here ,
Nov 22, 2018 Nov 22, 2018

kann ich irgendwie herausfinden was meine vorherige Value war und sie im Script anschließend benutzen?

Ich möchte dann die vorherige Value mit meiner jetzigen vergleichen.

Z.b.

if (Slider6.value <= Slider6.previousValue)

mc50013262.x += 1;

TOPICS
ActionScript
230
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2018 Nov 22, 2018

Hi.

Store your current value in a variable and then use it for comparison. Like this:

var previousValue:Number;

if (!isNaN(previousValue) && Slider6.value <= previousValue) // you need to check first if the previousValue variable has some value in it

    mc50013262.x += 1;

previousValue = Slider6.value; // assign the current value to the previousValue variable

I hope this helps.

Regards,

JC

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2018 Nov 22, 2018

if previousValue=0, if(previousValue) will be false.  use !isNaN(previousValue)

user

var previousValue:Number;  
if (!isNaN(previousValue) && Slider6.value <= previousValue) {
// you need to check first if the previousValue variable has some value in it   
mc50013262.x += 1; 
}
previousValue = Slider6.value; // assign the current value to the previousValue variable

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 22, 2018 Nov 22, 2018
LATEST

Thanks for the correction, kglad!

I do appreciate.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines