just musing -- actionscript "deprecated" functions

Posted on 2006-04-13
Medium Priority
Last Modified: 2008-03-06
This isn't really a very serious question; I'm just curious for other opinions.

I see that Flash is finally dropping something in 8 ("add") which was deprecated back in v5...

(see http://www.powersdk.com/ted/2005/08/flash-8-deprecated-gets-teeth.php)

So here's the thing: when it comes to random numbers, I find "random(n)" MUCH simpler to use than "Math.floor(Math.random() *n)". I know that "random(n)" isn't really random, but I also don't really care; it's close enough.

Am I just being lazy, or does anyone else feel the same way? Will they drop the hammer on us and actually eliminate "random(n)" anytime soon? Someone whip up a quick little Magic 8 Ball thing to tell us the answer...
Question by:amateur6
  • 2
LVL 19

Accepted Solution

Montoya earned 500 total points
ID: 16448037
Well, when creating an application that is going to select a "random" value, you actually want it to select a random value. Otherwise, what is the point? The use of random (n) by itself would, as you know, generate some randomness in the numbers, but certain numbers would always come up more often than others. Therefore, they came up with the Math.random with the floor and ceiling. Now, the funny thing that I've never understood... Why didnt they just fix random(n) to actually work? Why create a new command (sort of) and make it so complicated to generate a random number? That's never made sense to me. It seems so much more logical and simple to use random(0,15) to get a random number between 1 and 15.

All that said, you could write your own .as and create a similar function. Then, reuse the function as you would a snippet. So, I would create a function called Randomize() that accepts two variables (min, max).


Author Comment

ID: 16450831
Good point!!

I was just reading over at O'Reilly that "For many designers, the ActionScript 2.0 OOP coding style may initially seem a little long-winded because more lines of code seem to be concerned with building up the code structure than actually solving the problem at hand, especially for modest classes. This extra structure is, however, a real advantage in the long term."

I just wish they wouldn't throw the baby out with the bath water. If I wanted a real programing language, I'd be a code monkey. As it is, I'm a designer who wants to play around with coding stuff; don't start taking AWAY what little understanding I have!


Author Comment

ID: 16477498
Points to you, Montoya -- guess no one else wants to weigh in. Thanks tho!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses
Course of the Month13 days, 9 hours left to enroll

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question