Copy link to clipboard
Copied
Hy,
I'm having an issu for a line, i need to convert it to as3 but idk how to do that 😕
there is the line to convert :
if (MovieClip(root).flagSound)
{
this.random_RO.gotoAndStop(random(this.random_RO._totalframes - 1) + 2);
}
And it says :
"Call to a method that does not seem set, random ."
This stuff is all very well documented on the internet. ECMAScript Math.random() doesn't take any arguments, it just returns a float between 0 and 1. So you'd do this:
this.random_RO.gotoAndStop(Math.random() * (this.random_RO.totalFrames - 1) + 2);
Note that _totalframes was wrong too. In AS3 it's totalFrames.
Copy link to clipboard
Copied
Because random() in AS3 is Math.random().
Actually it's Math.random() in AS2 too. random() has been deprecated since at least 2005.
Copy link to clipboard
Copied
but can you convert it pls ? It's not working for me 😕
Copy link to clipboard
Copied
try changing the line to...
random_RO.gotoAndStop(int(Math.random(random_RO._totalframes - 1)) + 2);
Copy link to clipboard
Copied
Thanks for the reply but now it's saying :
Incorrect number of arguments. Maximum expected : 0 .
Copy link to clipboard
Copied
This stuff is all very well documented on the internet. ECMAScript Math.random() doesn't take any arguments, it just returns a float between 0 and 1. So you'd do this:
this.random_RO.gotoAndStop(Math.random() * (this.random_RO.totalFrames - 1) + 2);
Note that _totalframes was wrong too. In AS3 it's totalFrames.
Copy link to clipboard
Copied
Thanks for the reply,
I will try this when i'm at home
also nice doc I will read it
Copy link to clipboard
Copied
Working ty very much !