Search code examples
flashactionscript-3flash-cs4flash-cs5flash-cs3

What is the use of void in AS3


What is the use of void in Action Script 3.0?

Can any one give brief explanation with example?


Solution

  • It's a function type. It means that it doesn't return any data By default Flash always expect to return a value. If you write a function like this for example: ActionScript Code:

    function myFunction(){
    
    }
    

    Flash assumes that returning a value is still possible and so watch for it which uses ressources. When you specify :void you are actually telling Flash to not expect any return value so Flash does not waste resources watching for it.