Função Genérica
July 10th, 2008
| Tags:
Buenas, hoje eu e meu companheiro de trabalho e amigo Paulo Araujo, tivemos uma esncrenca pra resolver, mas resolvemo bem, uma função que recebesse qualquer tipo de valor, pois então desenvolvemos a classe abaixo.
Não vou ensinar mais passo a passo como colocar a classe para rodar no flash né, nos posts anteriores tem como, caso haja alguma dúvida.
View CodeACTIONSCRIPT | |
package { import flash.display.MovieClip; import flash.events.Event; import flash.display.Sprite; import flash.display.DisplayObject; /** * ... * @Marcelo Duende, Paulo Araujo Generic Function */ public class genericFunction extends MovieClip { private var array:Array = [1, "lala"]; private var number:Number = 1; private var string:String = "Duende"; public function genericFunction() { Receive(array);//chamando a ação } private function Receive(geral:*) { var tipo = typeof geral; switch (tipo){ case "object": if (geral is Array) { trace("Array"); for(var i:int = 0; i<geral.length;i++){ trace (typeof geral[i]); } } else if (geral is DisplayObject) { trace("DisplayObject"); if (geral is Sprite) trace("Sprite"); else if (geral is MovieClip) trace("MovieClip"); } else trace("Outro tipo de Objeto"); break; case "number": trace(tipo); break; case "string": trace(tipo); break; } } } } | |
Abraço a todos


Hi Marcelo,
You have been recommended to us and I would love to find a bit more about the work you are looking for and to discuss some of the roles that could be suited to you at the moment.
Could you let me know a little bit more about the roles you are looking to get into so we have a better idea of how to help you –
Are you looking permanent/contract?
What salary/rate are you looking for?
What technologies, ideal role is suited to you?
What is your availability/notice period?
What location do you want to work within?
Kind Regards,
Fiona