PDA

View Full Version : what is the most useless method in flash?



oldarney
June 16th, 2009, 08:02 AM
what is the most useless function in flash? one that can be used as a dummy code within a function. say for frameworking your code before making it.

the best i can come up with is trace, but im looking for something less intrusive.

function fireMegaBall (lv:Number) {

trace('megaBall '+ lv +' fired');
}

tic
June 16th, 2009, 08:19 AM
Comments?

// here comes some code

/* The code i'm going to post later will be
in these two lines*/

oldarney
June 16th, 2009, 08:25 AM
Comments?

// here comes some code

/* The code i'm going to post later will be
in these two lines*/


the thing is that in AS3

function gay(lv:Number) {

//too sexy
}

will not compile since a function has to have code in it...

.ral:cr
June 16th, 2009, 08:28 AM
i see trace as a function that you can't live without
i also don't see any useless functions. some of them i never use, but i can't categorize them who is more useless than who.

edit:

- comments are important also
- if you want a blank function simply write null;

oldarney
June 16th, 2009, 08:50 AM
i see trace as a function that you can't live without
i also don't see any useless functions. some of them i never use, but i can't categorize them who is more useless than who.

edit:

- comments are important also
- if you want a blank function simply write null;

bingo, that was exactly what i was looking for... null;
the most useless method in flash.

senocular
June 16th, 2009, 09:27 AM
the thing is that in AS3

function gay(lv:Number) {

//too sexy
}

will not compile since a function has to have code in it...

That's not true. That is not a quality of AS3. Maybe whatever compiler you're using is requiring that, but AS3 does not. In fact, neither Flash Pro nor Flex 3 requires a function have content. Does Flex 4?

oldarney
June 16th, 2009, 09:30 AM
That's not true. That is not a quality of AS3. Maybe whatever compiler you're using is requiring that, but AS3 does not. In fact, neither Flash Pro nor Flex 3 requires a function have content. Does Flex 4?

thats strange, maybe flash cs2 once did. i remember coming here a while ago and having that problem. maybe it was a loop.

.ral:cr
June 16th, 2009, 09:47 AM
:))
the more you tell something, the more i feel to say that this one too is very important. i use null every time. if you want to remove something from stage is a good practice to verify if is not null, and many more... i'd say that null is very vital.

rumblesushi
June 16th, 2009, 10:37 AM
trace is vital, I find it crucial to get things working properly, and tell me what's going on with a certain piece of code.

Krilnon
June 16th, 2009, 10:55 AM
null isn't a method, so it doesn't really qualify as "the most useless method."

Although it's also not a method, void is also useful for being useless:
void void void trace(void 5); // undefined

(Yes yes, I know it has some practicality as a return type…)

BoppreH
June 16th, 2009, 10:59 AM
I wouldn't call it a method, but the most useless thing (and annoying when you make it by mistake), is simply getting a value and doing nothing with it. Unless the other side has a "get" function that does something interesting, code like:


myClip = new MovieClip()
myClip.alpha
myClip.graphics.lineStyle(1)


is completely useless. Specially head-bangable if it was a parameter-less function and you forgot to call it.


myInstance = new MyClass()
myInstance.setOptions(option1, option2, true)
myInstance.doALotOfThings // note the lack of parenthesis
myInstance.showResults() // does nothing because the previous line did not call the function

milkmit
June 16th, 2009, 02:42 PM
gotoAndPlay or gotoAndStop is pretty useless to me these days.

xchrisx
June 16th, 2009, 07:08 PM
I think soundChannels and SoundTransforms are useless. Not that i don't use them, because we all have to. But when creating AS3 why didn't they just add stop, volume, and pan properties directly to the Sound object? It's pretty ridiculous that you have to declare var dumbChannel:SoundChannel = mySound.play(); just to be able to use Channel.stop(). And it's even lamer that in order to change the volume you have to create a SoundTransform object, set it's properties, and then apply it to the channel, which THEN finally applies it your sound.

wvxvw
June 16th, 2009, 07:23 PM
Answering to the first poster:
It is a common practice to put // TODO: What to do... or // FIXME: what to fix... comments if you don't implement the function body or it must be rewritten later. Some editors will even recognize those and will let you navigate from one such comment to another ;)
Useless trace()'s are annoying if you have lots of them...

@xchrisx:
Yeah, sad but true... Sound API in AS3 aren't great... that's well known and, hope that is going to change some time...