just musing -- actionscript "deprecated" functions

Posted on 2006-04-13
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...


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
    LVL 19

    Accepted Solution

    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).

    LVL 1

    Author Comment

    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!

    LVL 1

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
    Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
    In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
    The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now