프로그래밍 소스코드를 보기좋게 변환해주는 js플러그인을 소개합니다.







액션스크립트(ActionScript 3.0)에 경우는 js파일을 include되는 부분이 빠져있네요.
<script type=”text/javascript” src=”scripts/shBrushAS3.js”></script>
한줄을 추가해주셔야 에러없이 정상 작동합니다.
프로그래밍 소스코드를 보기좋게 변환해주는 js플러그인을 소개합니다.
If you want an easy way to get an Apple style preloader for AS3, as seen below, it’s as simple as this class, which uses the Flash Drawing API, so it’s extremely light.
Download CircleSlicePreloader.as
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
package net.stevensacks.preloaders { import flash.events.TimerEvent; import flash.events.Event; import flash.display.Sprite; import flash.display.Shape; import flash.utils.Timer; public class CircleSlicePreloader extends Sprite { private var timer:Timer; private var slices:int; private var radius:int; public function CircleSlicePreloader(slices:int = 12, radius:int = 6) { super(); this.slices = slices; this.radius = radius; draw(); addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); } private function onAddedToStage(event:Event):void { removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage); addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage); timer = new Timer(65); timer.addEventListener(TimerEvent.TIMER, onTimer, false, 0, true); timer.start(); } private function onRemovedFromStage(event:Event):void { removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage); addEventListener(Event.ADDED_TO_STAGE, onAddedToStage); timer.reset(); timer.removeEventListener(TimerEvent.TIMER, onTimer); timer = null; } private function onTimer(event:TimerEvent):void { rotation = (rotation + (360 / slices)) % 360; } private function draw():void { var i:int = slices; var degrees:int = 360 / slices; while (i--) { var slice:Shape = getSlice(); slice.alpha = Math.max(0.2, 1 - (0.1 * i)); var radianAngle:Number = (degrees * i) * Math.PI / 180; slice.rotation = -degrees * i; slice.x = Math.sin(radianAngle) * radius; slice.y = Math.cos(radianAngle) * radius; addChild(slice); } } private function getSlice():Shape { var slice:Shape = new Shape(); slice.graphics.beginFill(0x666666); slice.graphics.drawRoundRect(-1, 0, 2, 6, 12, 12); slice.graphics.endFill(); return slice; } } } |
Posted in Actionscript, Flash, Tips/Tricks
출처 : http://superativos.wordpress.com/2009/05/11/as3-30-classes-bem-uteis/
Estava procurando uma classe para manipular som, então encontrei essa lista… muito boa por sinal. Boa pedida p quem Trabalha com AS3.
SoundManager
http://evolve.reintroducing.com/2008/07/15/news/as3-soundmanager/
Esta classe, padrão singleton, serve para fazer exactamente o que o titulo diz, um manager de som, o que torna o adicionar de som aos nosso projectos bem simples. Esta class depende do TweenLite para o fade de som.
Active Window Blur – http://blog.onebyonedesign.com/?p=81
Coloca um painel de blur sobre um video, imagem ou movieclip.
TweenMax – http://blog.greensock.com/tweenmaxas3/
Construído sobre a base do tweenLite e tweenFilterLite, esta classe aperfeiçoa os métodos de ambas as origens mostrando no final um motor de animação com mais algumas funções como pause/resume, sequências mais fáceis, animação e cor HEX e muito mais…
YouTube Class – http://labs.flexcubed.com/?p=13
Uma class que usa a API do google para devolver playlists e “featured” vídeos.
Pulse Particle System – http://rogue-development.com/pulseParticles.html
Um sistema que pode não parecer ter muita utilidade. Trabalha exclusivamente com partículas e AS3, para criar os mais variados efeitos como podem ver na pagina de exemplos.
Animated BitMap – http://blog.hexagonstar.com/animatedbitmapclass/
Uma das classes mais úteis, visto que o flex / flash não têm suporte a gif’s animados, esta class utiliza varias imagens fixas com apenas uma desviação de padrão para animar uma imagem, podem-se conseguir resultados fantásticos.
Queue Loader – http://code.google.com/p/queueloader-as3/wiki/QueueLoader
Um projecto que permite monitorizar o carregar de objectos e assets bem como monitorizar o seu processo de carregamento. Este projecto é Open Source e aceitam contribuidores, mais informações na sua pagina em cima.
Prioritization – http://www.danielhai.com/blog/?p=60
Uma class que funciona com Loader, URLLoader e Sound Objects, que permite indicar a prioridade de determinados métodos e objectos para que estes sejam executados na ordem que desejamos.
DistortImage – http://www.rubenswieringa.com/blog/distortimage
Um classe que permite fixar pontos e distorcer uma imagem consoante a nossa necessidade tudo isto em AS3.
Layout Class – http://www.senocular.com/?id=2.8
Uma colecção de 3 Classes, Layout, LayoutConstraint, LayoutManager, principalmente feita para o Flash CS, não deixa de ser interessante ver-la em funcionamento. Permite fixar um objecto sempre no centro do stage, definir width e height consoante o tamanho do stage, e mais alguns elementos importantes no layout. A nível de flex estas classes são implementadas nativamente.
Color Sampler – http://www.somerandomdude.net/blog/flash/actionscript-3-color-sampler-class-download/
Sistema que permite recolher de objectos o seu padrão RGB, hue, saturation e brightness. Muito util quando necessário trabalhar com imagens.
2D Character Rigging Classes – http://www.algorithmist.net/rigging.html
Uma classe que permite personalizar aspectos de caracteres 2d, ou seja, no exemplo de um boneco, permite personalizar a cara, braços, posição, afastamento, etc…
XML Loader Class – http://www.mediareason.com/blog/?p=20
Uma class que faze exactamente o que o proprio nome indica, carrega XML de uma maneira bem simples.
Style Collection – http://www.gskinner.com/blog/archives/2007/06/stylecollection.html
Uma class que permite criar grupos de estilos (styles) que são aplicados e automaticamente actualizados em diversos componentes. Principalmente orientado para Flash CS.
AS3 Easing – http://www.uza.lt/codex/as3-easing/
Mais uma class de animação/transição, com a diferença de permitir definir pontos de animação.
CSS Loader – http://www.rubenswieringa.com/blog/cssloader
Uma class que permite carregar ficheiros CSS de estilo para qualquer aplicação flex no seu arranque.
AutoComplete Text Field – http://asserttrue.com/articles/2006/04/09/actionscript-projects-in-flex-builder-2-0
Permite a criação de campos de texto com auto complete.
fZIP – http://wahlers.com.br/claus/blog/zip-it-up/
Uma classe que permite carregar arquivos .zip e abrir os ficheiros nele contidos mesmo antes de carregar o arquivo completo. Desenhado especialmente para projectos AIR, em alguns casos pode ser conseguido utiliza-a com projectos Flash/Flex se o arquivo zip for “injectado” com um Adler32 checksum (patch) este pode ser aberto no browser e funcionará correctamente, como podem ver no exemplo da pagina oficial.
Reflection Class – http://www.adobe.com/devnet/flash/articles/reflect_class_as3.html
Uma class que permite criar reflexos de imagens.
Reflection Manager – http://www.wietseveenstra.nl/blog/2007/05/reflection-manager-10/
Uma classe derivada da anterior, mas muito mais completa.
Flex Loading Image – http://www.munkiihouse.com/?p=135
Implementa a class image do flex, e introduz uma barra de progresso que nos permite visializar o carregamento da imagem.
Audio Visualization – http://blog.benstucki.net/?id=18
Permite criar varios estilos de analyser’s para audio, num componente bastante interessante como podem ver no seu explorer. Programado para o Flex.
FishEye – http://www.quietlyscheming.com/blog/components/fisheye-component/
Um conjunto de classes que permite criar uma apresentação/menu ao estilo do mac, embora de uma forma bem elaborada, permite o controlo absoluto da sua apresentação. Especialmente programado para o flex.
FlvWriter – http://www.zeropointnine.com/blog/simpleflvwriteras-as3-class-to-create-flvs
Uma class para aplicativos AIR que permite escrever/gravar um ficheiro flv (video).
Flex XLS Read/Write – http://adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1375018
Uma class que permite escrever e ler arquivos .xls no flex.
MP3 Player – http://msdevstudio.com/blog/2008/06/25/flex-action-script-mp3-player-equalizer/
Uma class AS3 programada para o flex, que permite a criação e controlo de um simples player de mp3 com um equalizador gráfico.
URLUtils – http://msdevstudio.com/blog/2008/05/13/flex-deep-linking-detalhes-browser/
Uma class que permite obter parametros do browser, como pagina actual, servidor, porta, caminhos relativos e absolutos…
DataGrid Colorize – http://msdevstudio.com/blog/2008/05/25/flex-datagrid-mudando-a-cor-de-uma-linhacoluna/
Permite colorir determinada linha/campo/coluna da tabela com as cores definidas pelo utilizador, permite também colorir apenas campos com determinado valor.
Feed Reader – http://msdevstudio.com/blog/2008/06/02/tutorial-package-flex-leitor-rss/
Uma class que le conteudo de um feed RSS e tranforma o seu conteudo num arrayColelction pronto a ser usado numa datagrid.
Password Generator – http://msdevstudio.com/blog/2008/06/13/flex-password-generator-criador-de-passwords/
Permite gerar Passwords/Strings aleatórias, podendo ou não usar caracteres especiais.
MP3Lite – http://www.ederlima.com.br/blog/mp3lite.
Uma class que permite a leitura de musica mp3, como ficheiro unico ou com recuso a playlist em XML, controlo de volume, info ID3, streaming, etc..
[via msdevstudio]
I’ve updated the Deface face recognition library that I created last year to take advantage of the new Vector class and some other improvements.
It should be fast enough for some limited real-time use now. For instance, the demo below typically finds my face in < 80ms once it’s aquired it. That’s only about 12fps, but for certain applications that would be sufficient. And I’m sure that the tracking can be improved a lot. There’s no real prediction now as is, nor position averaging, etc.
Allow this to use your webcam if you have one. If you don’t, you’re out of luck.
source
———————————————————————————————
http://code.google.com/p/deface/
Based on ideas from OpenCV and the well-known Viola and Jones face detection paper, but NOT associated with either. Deface uses XML encoded classifiers to visually detect and track objects (especially faces) in BitmapData. Compatible with classifiers from OpenCV.
———————————————————————————————
You can see the code in action here:
Source code for the first demo is available on the download page. See DemoCode.
I dreamed about it, they finally did it ^^.
A crazy guy named Ohtsuka Masakazu have ported the face detection part of OpenCV to AS3 and added the source code named Marilena to the Spark Project a few weeks ago (can’t believe I haven’t notice before today)
Mario Klingemann from Quasimondo.com already made some optimization (see his blog)
I made some test today with a stupid texture, starting from Mario’s webcam example and that’s just fun !!! Well yes, it’s still slow (15 fps on a good computer), but this is just the beginning as I believe that a lot of optimization can still be done, and so what anyway ? It’s flash, it’s everywhere, nothing to install, the fun is there without downloading anything. I really believe in it ! Now with this and FLARToolKit (ARToolKit port to AS3), augmented reality and computer vision is really getting into Flash for sure, and it’s going to give to the community some great opportunity !! I’m looking forward about it
Please, have a test at Mario’s example here
and take also a look at what they did at Squidder.com
Realtime Face Detection in Flash from squidder on Vimeo.
For more info, check out http://www.squidder.com/2009/02/26/realtime-face-detection-in-flash/
Libspark from Japan is a treasure trove of great flash advancements, they seem to realize the great things that can come from porting in existing solid libraries from C/C++ etc into flash and have been scoring lately including augmented reality in flash porting the ARToolkit to FLARToolkit. Recently a port of openCV for as3 called Marilena was found and it is for object detection and decent facial recognition (it is a computer vision library from intel) considering the processing power needed to do this.
Face Detection: Here is the sample included with Marilena showing facial detection on an image.
Lots of recent action has blown up on this front from Mr doob, quasimondo (optimizing the Marilena classes for better performance) and Boffwswana. Also there is a kit called deface by sshipman that is the first foray into this a year ago doing similar things but it was just a bit before it’s time and a bit slow in previous versions of flash, it performs decent now in this sample. Flash 10 performance of the AVM2 and future directions with Alchemy will lead to more interesting stuff just like this.
Mr. doob head tracking sample, be sure to check lots of other examples there
Boffswana example of head tracking Johnny Lee Wii style with only a webcam and flash, no wiimote needed since it uses facial detection to check where you are and how close you are in the screen and then moves accordingly.
This is stemming from the recent explosion of the FLARToolkit and augmented reality in flash as well as the gimmicks used by Nintendo with the wii and Johnny Lee’s great head tracking advancements. Porting great libraries to flash seems to be the phase we are entering now judging by the recent excitement around Adobe Alchemy and the LLVM along with the lead from the libspark.org contributors. We have also seen this heavily last year in ports of Box2D for 2d physics and other toolkits using established working code and porting that to flash now that is is mostly capable of handling the performance.
OpenCV (Open Computer Vision Library by Intel) is quite a powerful platform that allows you to do all this and now it is available in flash. There are other great libraries for nearly all platforms now. I have done some previous work with Aforge which is also a port of OpenCV mainly for motion detection. This was always around but not until the recent performance updates and the innovation that has come with Alchemy and the thinking that goes along with that (porting in libraries to flash from C/C++ etc), has allowed this to flourish in flash and thus the web.
The amazing new things we can do with flash by porting in existing libraries is only going to get more intense as alchemy and flash 10 are even more mainstream. It is almost as if Flash will eventually just become a web renderer and simplified front end to many great toolkits that exist in more native environments like C/C++ but with the speed and distribution access of the web with Flash. Exciting times ahead.
이번 글은 아래 pureMVC 측에서 AS3.0 예제로 제공하는 소스를 가지고 설명하겠습니다.
http://puremvc.org/pages/downloads/AS3/Demo_AS3_Flash_HelloFlash.zip
먼저 압축을 풀어 HelloFlash.fla 파일을 열면
아무것도 없는 화면에 (심지어 도큐먼트 클래스도 없는.. ) 1frame 에 몇줄의 AS 코드만 있는겄이 보이실 겁니다.
import flash.display.Stage;
import org.puremvc.as3.demos.flash.helloflash.ApplicationFacade;
// Startup the app
ApplicationFacade.getInstance().startup( this.stage );
stop();
위와 같은 코드 인데요.
물론 보실 부분은
ApplicationFacade.getInstance().startup( this.stage );
이거 한줄 입니다. ㅋ
그럼 위에서 사용하고 있는 ApplicationFacade 를 보도록 하겠습니다.
ApplicationFacade.as
이제 위에서 등록하고 호출한 StartupCommand 를 살펴보겠습니다.
StartupCommand .as
간단하게 Facade 와 Command 를 살펴보았습니다.
다음 글에서는 나머지 부분인 Mediator 와 Proxy 에 대해 살펴보겠습니다.
[출처] [02] pureMVC 알아보기 [ HelloFlash.1 ] (uiaa) |작성자 모모
pureMVC 알아보기
이번에는 잠시 3D 부분을 떠나 패턴 관련 내용을 알아보도록 하겠습니다.
먼저 알아볼 대상인 pureMVC 에 대해 설명드리자면
pureMVC는 하나의 프레임 워크라 볼 수 있습니다.
프레임워크를 사전 그대로 풀이하자면 (뼈대. 골격. 틀.) 이라는 뜻이 있는데요.
프로그램 개발시에 필요한 기반을 제공한다고 생각해 주시면 됩니다.
이런 프레임 워크는 공개된 것들만 해도 상당수가 있는데요.
플래쉬 AS 쪽에선 캔곰, pureMVC 등이 많이 사용되고 있습니다.
이 중에서 pureMVC 는 특히 여러가지 언어로 ( c, c#, php, java, objective C… ) 공개되어있는데요..
가장 기본적인 MVC 패턴만을 제공해 주는 정말 심플한 프레임웍이라 생각됩니다. (켄곰 등에 비해)
따라서 플래쉬만의 특화된 기능이나 이런것 보다는 기본에 충실한 프레임웍인것 같습니다.
pureMVC 에 대한 서론은 이쯤에서 마치겠습니다.
정말 자세한 사항이나 궁굼한 점은.
저의 사견이 들어가지 않은 제작자의 홈페이지로 가셔서 확인해 주세요^^; ㅎㅎ
pureMVC : http://www.puremvc.org/
그럼 가장 먼저 설명 드릴 디자인 패턴 인 MVC 패턴에 대해 알아보겠습니다.
사실.. 그냥 보기에도 복잡합니다 ㅡㅡ;;
크게 볼 때 M,V,C 의 각 부분이 있고 이들을 Facade 패턴이 감싸고 있어서 어디서든 원하는 데이터와 작업에
대한 접근을 가능하게 해준다.. 정도로 이해하면 될 것 같습니다.
아. 미리 설명드리지 못한 내용이 하나 남았습니다.
pureMVC 에서는 MVC 패턴을 사용하면서 해당 역활을 수행하는 서브 클래스들을 다른 명칭으로 부릅니다.
명칭은 아래와 같습니다.
MVC = 서브 클래스
Model | Proxy |
View | Mediator |
Controller | Command |
다음 글 부터는 pureMVC 측에서 제공하는 AS3.0 용 pureMVC 예제를 사용하여 설명 하도록 하겠습니다.
[출처] [01] pureMVC 알아보기 (uiaa) |작성자 모모