Brendon Smith AKA SeaCloud9 Design - tagged with flash http://life.brendonsmith.com/feed en-us http://blogs.law.harvard.edu/tech/rss Sweetcron brendonsmith@seacloud9.org AS3 Sound Synthesis III – Visualization and Envelopes @bit101 - excellent tutorials in regards to generating sound with flash! Thanks http://life.brendonsmith.com/items/view/2229/as3-sound-synthesis-iii-visualization-and-envelopes-bit101-excellent-tutorials-in-regards-to-generating-sound-with-flash-thanks ]]> Thu, 22 Jul 2010 15:45:00 -0700 http://life.brendonsmith.com/items/view/2229/as3-sound-synthesis-iii-visualization-and-envelopes-bit101-excellent-tutorials-in-regards-to-generating-sound-with-flash-thanks Powerflasher PDFbook3D http://life.brendonsmith.com/items/view/2158/powerflasher-pdfbook3d ]]> Fri, 02 Jul 2010 21:42:45 -0700 http://life.brendonsmith.com/items/view/2158/powerflasher-pdfbook3d Tweet Tank in Away3D and Hype pt. 2 http://life.brendonsmith.com/items/view/2132/tweet-tank-in-away3d-and-hype-pt-2

I have now added support to search twitter. Once you search twitter it repopulates the fish bowl with fish that once clicked will navigate to that twitter search result. I have been working on optimizing the content. Specifically the fish models are very processor intensive. I have been looking at different ways to improve this. Away3Dlite is new than the other versions and it does have many benefits. The main build has other techniques like level of detail and fogging. These help to reduce the over all processor hit. I believe in the near future some of these features will hopefully be ported over to the Away3Dlite version if not then within in the next couple of weeks I will port this over. I think utilizing fogging and level of detail will greatly reduce the overall processor hit. Processor Intensive Experiment:

You will notice that when it renders it is rendering 110+ DisplayObject3D I have also been working on Garbage Collection I have found that after doing several searches the Memory is increasing greatly. So I have added some techniques like removing the objects and then nullifying them although it doesn’t appear to be helping much. I will have to look into this again soon. I would also like to super impose a Google map on the top make it click-able and then have the camera zoom in on that particular fish which should not really be difficult at all because I can use tween lite to simply zoom the camera to the objects position. So I am not done with this and I will be revisiting these issues. Memory management can be difficult. I will also be scouring the web for flash tools that help profile and reduce memory so if anyone has any suggestions feel free to chime in. I have also been reading the 3D in Flash Book from Friends of Ed it does have a whole chapter on optimizing 3D content for the web so I will be reading that chapter soon. I have also been looking at gSkinners blog it has a considerable amount in regards to memory management. The Source Code:

package { import flash.display.Sprite; import flash.events.Event; import flash.events.MouseEvent; import flash.display.MovieClip; import flash.media.Sound; import flash.media.SoundChannel; import flash.net.URLLoader; import flash.net.URLRequest; import flash.system.System;   public class TweetTank extends Sprite { public var twitterFish:tweetFish; public var searchClipGo:searchClip = new searchClip(); public var sound:Sound; private var musicChannel; public function TweetTank() { addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true); }   private function addedToStageHandler(e:Event):void { playMusic(); twitterFish=new tweetFish; addChild(twitterFish); twitterFish._twitSearch = "Flash"; twitterFish.init(); twitterFish.visible = true; addChild(searchClipGo); searchClipGo.x = 250; searchClipGo.y = 30; searchClipGo.btnSearch.addEventListener(MouseEvent.CLICK, TweetSearch); removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler); }   public function TweetSearch(e:MouseEvent):void{ //trace(searchClipGo.txtSearch.text); try{ this.twitterFish.killAll(); this.twitterFish.xMove = null; this.twitterFish.twFishOne = null; this.twitterFish = null; twitterFish=new tweetFish; addChild(twitterFish); twitterFish._twitSearch = searchClipGo.txtSearch.text; twitterFish.init();   twitterFish.visible = true;   addChild(searchClipGo); searchClipGo.x = 250; searchClipGo.y = 30; searchClipGo.btnSearch.addEventListener(MouseEvent.CLICK, TweetSearch); System.gc(); // the GC will perform a full mark/sweep on the second call. }catch(fail:Error){ //trace(fail); } }     public function playMusic():void { sound = new Sound(); sound.load( new URLRequest( "test.mp3" ) ); musicChannel=sound.play(0, int.MAX_VALUE); try{   }catch(e:Error){ musicChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic); } musicChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic); }   public function loopMusic(e:Event):void { if (musicChannel!=null) {   playMusic(); } }   } }     package { import away3dlite.containers.ObjectContainer3D; import away3dlite.materials.*; import away3dlite.materials.WireColorMaterial; import away3dlite.primitives.Cube6; import away3dlite.templates.BasicTemplate; import away3dlite.core.base.*; import away3dlite.core.utils.*; import away3dlite.events.*; import twFish.*; import twTank.*; import RSSJSONW; import com.theflashblog.utils.Math2;   import com.adobe.utils.XMLUtil; import com.adobe.serialization.json.JSON; import com.adobe.xml.syndication.rss.Item20; import com.adobe.xml.syndication.rss.RSS20; import flash.events.IOErrorEvent; import flash.events.EventDispatcher; import flash.events.SecurityErrorEvent; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.net.URLRequestMethod; import flash.system.Security;   import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.events.Event; import flash.events.MouseEvent; import flash.geom.Vector3D; import flash.media.Sound; import flash.display.*; import flash.net.URLRequest; import flash.display.Bitmap; import flash.display.BlendMode; import flash.filters.BlurFilter; import flash.filters.GlowFilter; import flash.media.SoundChannel; import flash.utils.Timer; import flash.events.TimerEvent; import flash.system.System;   import gs.TweenLite;   import hype.extended.behavior.FunctionTracker; import hype.extended.layout.GridLayout; import hype.framework.sound.SoundAnalyzer;     public class tweetFish extends BasicTemplate { private var origin:Vector3D=new Vector3D(0,40,900); public var twFishOne:TwFish1; public var twTankC:TwTank1; public var soundAnalyzer:SoundAnalyzer; private var myX:Number=0; public var layout:GridLayout; public var Tank:ObjectContainer3D; public var xMove:FunctionTracker; public var _twitSearch:String; public var xScaleTracker:FunctionTracker; public var yScaleTracker:FunctionTracker; public var zScaleTracker:FunctionTracker; [Bindable]public var myRSS:RSSJSONW; Security.loadPolicyFile("http://twitter.com/crossdomain.xml"); Security.allowInsecureDomain("*"); Security.allowDomain("*"); public var myTimer:Timer = new Timer(1000); public var colourScheme:Array=[0x18b849,0x1858b8,0x18b81c,0x18b89c,0xb818b2,0xfd02f4,0x3102fd,0x02b3fd,0x1afd02,0xf4fd02,0xfd02f4,0x3102fd,0x02b3fd,0x1afd02,0xf4fd02]; public function tweetFish() { super(); }   public function init():void { stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent, false, 0, true); var filterA:Array=new Array ; filterA.push(new GlowFilter(0xFFFFFF, 1, 19, 19, 1, 1, false, false)); var blur:BlurFilter = new BlurFilter(); blur.blurX=900; blur.blurY=900; filterA.push(blur); soundAnalyzer = new SoundAnalyzer(); soundAnalyzer.start(); layout=new GridLayout(-900,-175,30,30,60); Tank = new ObjectContainer3D(); view.scene.addChild(Tank); Tank.addEventListener(MouseEvent3D.MOUSE_MOVE, goFish,false, 0, true); twTankC=new TwTank1(view); view.scene.addChild(twTankC); view.mouseEnabled=true; jsonInit("http://search.twitter.com/search.json?q=" + _twitSearch); camera.z=-2000; camera.x=-1600; camera.y=400; camera.lookAt( origin ); stage.addEventListener(MouseEvent.CLICK,_checkMouseEventTrail,false,0,true); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown, false, 0, true);   }   public function jsonInit(siteFeed:String):void { myRSS = new RSSJSONW();; myRSS._data = ""; myRSS._txtURL = siteFeed; myRSS.onJSON(myRSS._txtURL); myTimer.start(); myTimer.addEventListener("timer", timedFunction); } public function timedFunction(eventArgs:TimerEvent):void { if (myRSS._IsReady == "true") { myTimer.stop(); addFish(myRSS); } } //Really Helpful for tracing events! public function _checkMouseEventTrail($e:MouseEvent):void { var p:* =$e.target; while (p) {   //trace(">>", p.name,": ",p); p=p.parent; } }   public function killAll():void { xMove.stop(); xScaleTracker.stop(); yScaleTracker.stop(); zScaleTracker.stop(); xScaleTracker = null; yScaleTracker = null; zScaleTracker = null; view.scene.removeChild(twFishOne); view.scene.removeChild(twTankC); xMove = null; twTankC = null; twFishOne = null; System.gc(); trace("Killed"); }   public function addFish(myRSS:RSSJSONW):void{ //trace(myRSS._twdata.length); var numFish:Number; if(myRSS._twdata.length >= 6){ numFish = 6; }else{ numFish = myRSS._twdata.length; } for (var i:uint = 0; i<numFish; i++) { //trace(view); twFishOne=new TwFish1(view); if (i!=0) { twFishOne.x=i*randRange(-200,400); twFishOne.y=i*randRange(-200,400); twFishOne.z=i*randRange(-200,400); } var baseFrequency:uint = (90 % 64)*4; xMove=new FunctionTracker(twFishOne,"scale",dancingFish,[i,twFishOne]); xMove.start(); //trace(twFishOne.x); //var fishy:Object3D=twFishOne; //twFishOne.clipContainer.addChild(twFishOne); //twFishOne.addChild(twFishOne); view.scene.addChild(twFishOne);   twFishOne.name=i.toString();   //fishy.layer.blendMode = BlendMode.ADD; twFishOne.addEventListener(MouseEvent3D.MOUSE_DOWN, goFish,false, 0, true); System.gc();   } } protected function goFish(event:MouseEvent3D):void { //trace(myRSS._twdata[int(event.currentTarget.name)]);
var myURL:URLRequest = new URLRequest(myRSS._twdata[int(event.currentTarget.name)]); navigateToURL(myURL); } public function onMouseWheelEvent(event:MouseEvent):void { //trace(event.delta); TweenLite.to(camera,1,{z: event.delta * 500 + camera.z,onUpdate: onCameraMove}); } private function keyDown(e:KeyboardEvent):void { //trace(e); switch (e.keyCode) { case 32 : moveCamera(); break; } }   public function randRange(min:Number, max:Number):Number { // Generate a number between and including min - max var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min; return randomNum; }   private function dancingFish(i:uint, twFishOne:TwFish1):void { var baseFrequency:uint = (i % 64)*4; //trace(baseFrequency + "-Beat"); xScaleTracker=new FunctionTracker(twFishOne,"scaleX",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); yScaleTracker=new FunctionTracker(twFishOne,"scaleY",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); zScaleTracker=new FunctionTracker(twFishOne,"scaleZ",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); TweenLite.to(twFishOne, 5, {x:twFishOne.x + 50, y:twFishOne.y + 50, z:twFishOne.z + 50}); xScaleTracker.start(); yScaleTracker.start(); zScaleTracker.start(); } private function moveCamera():void { //trace("In Move Camera"); TweenLite.to( camera, 4, { x: Math2.rand(-9000, 9000), y: Math2.rand(-9000, 9000), z: 1400 + Math2.rand(-9800, 9000), delay: 2, onUpdate: onCameraMove } );   }   private function onCameraMove():void { camera.lookAt( origin ); }     override protected function onPreRender():void { Tank.rotationY++;   } } }

Download Code / Launch Experiment I also like what I have been seeing in the WebGL community. I think it would be really cool if haXe created a library for exporting to webGL/JavaScript I think this would have many benefits namely I could use my Away3D skills and export to webGL. They do currently export to Canvas but at this time I am not aware of any WebGL support within haXe. HaXe does support openGL for use in its vitual machine Neko so it seems that a library will likely be available soon.

]]>
Sun, 16 May 2010 21:09:11 -0700 http://life.brendonsmith.com/items/view/2132/tweet-tank-in-away3d-and-hype-pt-2
Away3DLite haXe + Morphing http://life.brendonsmith.com/items/view/2129/away3dlite-haxe-morphing ]]> Sat, 15 May 2010 21:30:55 -0700 http://life.brendonsmith.com/items/view/2129/away3dlite-haxe-morphing I love that idea! http://life.brendonsmith.com/items/view/2124/i-love-that-idea

Show support submit a work of Public / Weblic Art in the comments to this blog post. We should respond using the Heart as an artistic symbol much in the same way Chicago had their CowParade. The adobe community should respond virally through the use of the web as a means to communicate. So I would encourage anyone to simply create a flash, html5, after effects, processing, context free art, whatever medium you want in response to Apple’s recent changes in heart in regards to thinking different. Post the art work on the web then comment back. Show the world what you created it and how you created it. Share your code / art / and source files because that is how the community progresses. I think the Adobe community is primarily comprised of artist, designers, publishers, developers, etc.. In short I think they are the most creative people on the net. I would like to see what their unified response would look like. I think it would make for a really cool gallery. So create something and share it.

Why? Because it is really about choice. I pick the programs and place them on the machine. I use it however, I like. I do not need some foreign body that decides what software to use and how to use it. Is everyone sleeping or am I the only one that is intimidated of that concept? I don’t want too have some wizard of oz tell me what to put on my device or computer that is my decision for better or worse. I personally would like the option to have multiple operating systems on my cell phone if that is a possibility without voiding my warranty. I am the user, I am the owner, I pick what goes on and how not some governmental official or CEO. That is my concern why can’t you clarify your policy at least so can I not use the Corona SDK what if I want to use haXe? I believe that if someone owns the device the device owner should have the end all say on what goes on it and what doesn’t. Why can’t users have the choice to download and use things like Scratch? “It doesn’t make much difference how the paint is put on as long as something has been said. Technique is just a means of arriving at a statement.” -Jackson Pollock As the creators we should be able to pick whatever programming language etc and run it on the device. It is up to the consumer to choose what they want and what works out best for them on that device. Create something cool in the shape of a heart tell the community how you created it and share it.
Follow It Oh, and the share buttons aren’t there for aesthetic value.

]]>
Thu, 13 May 2010 16:39:14 -0700 http://life.brendonsmith.com/items/view/2124/i-love-that-idea
Web 2.0 Expo 2010 Highlights -> Freedom of Choice http://life.brendonsmith.com/items/view/2118/web-20-expo-2010-highlights-gt-freedom-of-choice ]]> Thu, 13 May 2010 09:15:23 -0700 http://life.brendonsmith.com/items/view/2118/web-20-expo-2010-highlights-gt-freedom-of-choice Creating graphic effects using the new #Deco scripts in #Flash Professional CS5 #as3 #cs5 http://life.brendonsmith.com/items/view/2111/creating-graphic-effects-using-the-new-deco-scripts-in-flash-professional-cs5-as3-cs5 ]]> Tue, 11 May 2010 11:14:36 -0700 http://life.brendonsmith.com/items/view/2111/creating-graphic-effects-using-the-new-deco-scripts-in-flash-professional-cs5-as3-cs5 Tweet Tank in Away3D and Hype http://life.brendonsmith.com/items/view/2110/tweet-tank-in-away3d-and-hype

Alright so I know everyone associates Twitter with birds well all the bird models in the google 3d Warehouse suck. So I decided to make a fish tank because fish are cool. I used away3dlite, hype, and twitter to create this simple 3d / hype experiment. I will give you fare warning it is kind of processor intensive and I think if I re-export my models from prefab as a compile .awd this will alleviate some of the performance issues. The memory management isn’t so bad but I would like to improve the FPS. I will say this though in comparison to the html5 / webGL TweetTank I believe this one performs better. It also doesn’t heat up my Mac book like it is going to take off for space (I have noticed that in Firefox it does heat up when using webGL although it is a pre-alpha). I was also able to add sound to this version and use away3dlite a really solid 3d library for flash. This project was pretty easy didn’t take long to create and PreFab really speed up the process. The Experiment:

PreFab is an Air application that allows Awary3d scene designers to easily import and export models for use with away3d. It is also important to note that away3d has spent a significant amount of time to optimize 3d away3d support Binary Space Partitioning. Hopefully in future versions of PreFab we can import .bsp maps that would truly be the cats meow! I was able to use PreFab to import my .dae files with ease and export them to actionscript with minor changes. It is nice to create the models as actionscirpt class files you can easily make changes to the class file directly and it didn’t take long to get them into flash! In the next version of this fish tank I will make it so you can search twitter and the fish will be populated with your results. Right now if you click on a fish it will take you to a new window with a twitter search for “Flash”. I will also look at ways to further incorporate Hype and animate the fish more smoothly. I will also implement more camera support. In the third version I would like to demonstrate google maps integration and use the map to zoom in on the specific fish. For those of you interested learning more about Away3d I suggest this Amazon book I haven’t read it yet but I look forward to it I just received it today in the mail. Away3d is easy to use and I also highly recommend looking at Hype this is a really cool framework that really opens up lots of possibilities for your creative output! The Source Code:

package { import flash.display.Sprite; import flash.events.Event; public class TweetTank extends Sprite { public var twitterFish:tweetFish=new tweetFish;   public function TweetTank() { addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler, false, 0, true); }   private function addedToStageHandler(e:Event):void {   addChild(twitterFish); twitterFish.init(); twitterFish.visible = true; }     } }   package { import away3dlite.containers.ObjectContainer3D; import away3dlite.materials.*; import away3dlite.materials.WireColorMaterial; import away3dlite.primitives.Cube6; import away3dlite.templates.BasicTemplate; import away3dlite.core.base.*; import away3dlite.core.utils.*; import away3dlite.events.*; import twFish.*; import twTank.*; import RSSJSONW; import com.theflashblog.utils.Math2;   import com.adobe.utils.XMLUtil; import com.adobe.serialization.json.JSON; import com.adobe.xml.syndication.rss.Item20; import com.adobe.xml.syndication.rss.RSS20; import flash.events.IOErrorEvent; import flash.events.EventDispatcher; import flash.events.SecurityErrorEvent; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.navigateToURL; import flash.net.URLRequestMethod; import flash.system.Security;   import flash.events.KeyboardEvent; import flash.ui.Keyboard; import flash.events.Event; import flash.events.MouseEvent; import flash.geom.Vector3D; import flash.media.Sound; import flash.display.*; import flash.net.URLRequest; import flash.display.Bitmap; import flash.display.BlendMode; import flash.filters.BlurFilter; import flash.filters.GlowFilter; import flash.media.SoundChannel; import flash.utils.Timer; import flash.events.TimerEvent;     import gs.TweenLite;   import hype.extended.behavior.FunctionTracker; import hype.extended.layout.GridLayout; import hype.framework.sound.SoundAnalyzer; import hype.framework.display.BitmapCanvas; import hype.extended.rhythm.FilterCanvasRhythm; import hype.extended.rhythm.FilterRhythm;     public class tweetFish extends BasicTemplate { private var bitmapCanvas:BitmapCanvas; private var musicChannel; private var origin:Vector3D=new Vector3D(0,40,900); private var twFishOne:TwFish1; private var bitmapCanvasBlur:BitmapCanvas; private var twTankC:TwTank1; public var soundAnalyzer:SoundAnalyzer; public var sound:Sound; private var myX:Number=0; public var layout:GridLayout; public var Tank:ObjectContainer3D; [Bindable]public var myRSS:RSSJSONW; Security.loadPolicyFile("http://twitter.com/crossdomain.xml"); Security.allowInsecureDomain(""); Security.allowDomain(""); public var myTimer:Timer = new Timer(1000); public var colourScheme:Array=[0x18b849,0x1858b8,0x18b81c,0x18b89c,0xb818b2,0xfd02f4,0x3102fd,0x02b3fd,0x1afd02,0xf4fd02,0xfd02f4,0x3102fd,0x02b3fd,0x1afd02,0xf4fd02]; public function tweetFish() { super(); }   public function init():void { stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelEvent); var filterA:Array=new Array ; filterA.push(new GlowFilter(0xFFFFFF, 1, 19, 19, 1, 1, false, false)); var blur:BlurFilter = new BlurFilter(); blur.blurX=900; blur.blurY=900; filterA.push(blur); playMusic(); soundAnalyzer = new SoundAnalyzer(); soundAnalyzer.start(); layout=new GridLayout(-900,-175,30,30,60); Tank = new ObjectContainer3D(); view.scene.addChild(Tank); Tank.addEventListener(MouseEvent3D.MOUSE_MOVE, goFish,false, 0, true); twTankC=new TwTank1(view); view.scene.addChild(twTankC); view.mouseEnabled=true; jsonInit("http://search.twitter.com/search.json?q=flash"); camera.z=-2000; camera.x=-1600; camera.y=400; camera.lookAt( origin ); stage.addEventListener(MouseEvent.CLICK,_checkMouseEventTrail,false,0,true); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown, false, 0, true);   } public function jsonInit(siteFeed:String):void { myRSS = new RSSJSONW();; myRSS._data = ""; myRSS._txtURL = siteFeed; myRSS.onJSON(myRSS._txtURL); myTimer.start(); myTimer.addEventListener("timer", timedFunction); } public function timedFunction(eventArgs:TimerEvent):void { if (myRSS._IsReady == "true") { myTimer.stop(); addFish(myRSS); } } //Really Helpful for tracing events! public function _checkMouseEventTrail($e:MouseEvent):void { var p:* =$e.target; while (p) { trace(">>", p.name,": ",p); p=p.parent; } }   public function addFish(myRSS:RSSJSONW):void{ for (var i:uint = 0; i<myRSS._twdata.length; i++) { trace(view); twFishOne=new TwFish1(view);   if (i!=0) { twFishOne.x=i*randRange(-200,400); twFishOne.y=i*randRange(-200,400); twFishOne.z=i*randRange(-200,400); } var baseFrequency:uint = (90 % 64)*4; var xMove:FunctionTracker=new FunctionTracker(twFishOne,"scale",dancingFish,[i,twFishOne]); xMove.start(); trace(twFishOne.x); var fishy:Object3D=twFishOne; //twFishOne.clipContainer.addChild(twFishOne); //twFishOne.addChild(twFishOne); view.scene.addChild(twFishOne);   twFishOne.name=i.toString();   //fishy.layer.blendMode = BlendMode.ADD; fishy.addEventListener(MouseEvent3D.MOUSE_DOWN, goFish,false, 0, true);     } }   public function playMusic():void { sound = new Sound(); sound.load( new URLRequest( "test.mp3" ) ); musicChannel=sound.play(0, int.MAX_VALUE); try{   }catch(e:Error){ musicChannel.removeEventListener(Event.SOUND_COMPLETE, loopMusic); } musicChannel.addEventListener(Event.SOUND_COMPLETE, loopMusic); }   public function loopMusic(e:Event):void { if (musicChannel!=null) {   playMusic(); } }     protected function goFish(event:MouseEvent3D):void { trace(myRSS._twdata[int(event.currentTarget.name)]);
var myURL:URLRequest = new URLRequest(myRSS._twdata[int(event.currentTarget.name)]); navigateToURL(myURL); } public function onMouseWheelEvent(event:MouseEvent):void { trace(event.delta); TweenLite.to(camera,1,{z: event.delta * 500 + camera.z,onUpdate: onCameraMove}); } private function keyDown(e:KeyboardEvent):void { trace(e); switch (e.keyCode) { case 32 : moveCamera(); break; } }   public function randRange(min:Number, max:Number):Number { // Generate a number between and including min - max var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min; return randomNum; }   private function dancingFish(i:uint, twFishOne:TwFish1):void { var baseFrequency:uint = (i % 64)*4; //trace(baseFrequency + "-Beat"); var xScaleTracker:FunctionTracker=new FunctionTracker(twFishOne,"scaleX",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); var yScaleTracker:FunctionTracker=new FunctionTracker(twFishOne,"scaleY",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); var zScaleTracker:FunctionTracker=new FunctionTracker(twFishOne,"scaleZ",soundAnalyzer.getFrequencyRange,[baseFrequency,baseFrequency+4,1,2]); TweenLite.to(twFishOne, 5, {x:twFishOne.x + 50, y:twFishOne.y + 50, z:twFishOne.z + 50}); xScaleTracker.start(); yScaleTracker.start(); zScaleTracker.start(); } private function moveCamera():void { trace("In Move Camera"); TweenLite.to( camera, 4, { x: Math2.rand(-9000, 9000), y: Math2.rand(-9000, 9000), z: 1400 + Math2.rand(-9800, 9000), delay: 2, onUpdate: onCameraMove } );   }   private function onCameraMove():void { camera.lookAt( origin ); }     override protected function onPreRender():void { Tank.rotationY++;   } } }

Download Code / Launch Experiment Cool Links: Hype Hype Blog Prefab Prefab – blog Relly Cool Hype Away3d Example Away3D Context Free Art with JavaScript

]]>
Mon, 10 May 2010 21:05:59 -0700 http://life.brendonsmith.com/items/view/2110/tweet-tank-in-away3d-and-hype
An ActionScript 3.0 Recursion Excursion | ActionScript 3 Design Patterns http://life.brendonsmith.com/items/view/2068/an-actionscript-30-recursion-excursion-actionscript-3-design-patterns ]]> Tue, 13 Apr 2010 17:05:49 -0700 http://life.brendonsmith.com/items/view/2068/an-actionscript-30-recursion-excursion-actionscript-3-design-patterns Combining the Timeline with OOP AS3 in Flash http://life.brendonsmith.com/items/view/2066/combining-the-timeline-with-oop-as3-in-flash ]]> Mon, 12 Apr 2010 22:36:27 -0700 http://life.brendonsmith.com/items/view/2066/combining-the-timeline-with-oop-as3-in-flash Is Apple Becoming the New Big Brother? http://life.brendonsmith.com/items/view/2079/is-apple-becoming-the-new-big-brother

Once upon a time their was young Steve Jobs and he fearlessly forged ahead and helped shape the landscape of today’s personal computing. To tell you the truth Macintosh was for the most part based off of the work that was done at PARC ( Palo Alto Research Center ) at the time PARC was run by Xerox. The wonderful people at Xerox worked night and day on LISA which was the first GUI (Graphical User Interface) for personal computing. Some of the brightest luminaries in Computer history worked at PARC like Alan Kay the father of OOP. This was at a time though when most people had no idea that personal computing would explode. Most of the people that were employed at PARC were of course heavily influenced by Douglas Engelbart who ran the Human Augmentation Project at SAIL ( Stanford Artificial Intelligence Laboratory ). At this time in computing people believed that AI (Artificial Intelligence) would be everything because evidently the common man was believed to simply be too stupid to use computers in everyday life. You had a few mavericks at the time that of course did not subscribe to this ideology this group developed the first mouse and many of the interface devices we still use today in the late sixties at Stanford under the guidance of Engelbart. The interface that was developed at PARC had many of the same features that Engelbart’s Human Augmentation project had created the precusor to the LISA interface and at this time Piracy really wasn’t considered a crime. At this time you also had people in the valley that were bright enough to pick up on the fact that the rate of Computing Power was exponential and it was doubling every two years this of course later became known as

]]>
Sun, 11 Apr 2010 21:33:25 -0700 http://life.brendonsmith.com/items/view/2079/is-apple-becoming-the-new-big-brother
Simple Flip3D in ActionScript3 http://life.brendonsmith.com/items/view/2080/simple-flip3d-in-actionscript3

This code will show you how to develop a simple native actionscript3d Class it shows you two different methods you could use to develop your own flip 3d effect in ActionScript3 this uses Flash Player 10. This code also only uses the built in functionality of Flash with the exception of the use of Tweener Class used in one of the way you could potentially animate it. You could also use a 3d library like Papaervision3D or Away3D and these libraries would give your more options and greater control but this is just a simple 3D flip using rotationX property of flash. This shows you how you might go about creating a Rolodex like effect in flash. I have also made the code more reusable because it is a class of its own that can be linked to a flash movie clip dragged on the stage and then called and reused easily. One of the many great features of flash is the ability to change visual objects into classes (Visual OOP) of there own rapidly! I have written code that basically once applied to a movie clip will randomly display a frame you will see this in the class you can expand it add new frames to the array etc.. What it does is randomly picks a frame displays the image and then once clicked will rotate the X property of the movie to about 84 degrees and disappear. It also shows you two different ways you could accomplish this task. One way the way I like the best is to use Tweener an animation library that has been around in the Flash community for years. Tweener frees you from the time line in other words your animation is time based instead of frame based. Time based is completely the way to go this ensures your users that they will have the same effect and performance regardless. Time based animation effects have been around in the Flash community for years actually Robert Penner wrote an excellent book Programming Macromedia Flash MX years ago I would recommend this book to anyone who is interested in learning the inner workings of easing equations for animation. His book inspired many animation libraries to be built and his equations can actually be found in many JavaScript animation libraries as well. Frame based animations tend to not always run at the speed of the Timeline FPS as a result they can lag and display a jumpy performance. If you would like a frame based approach I have included one that show you you can call a click function and then tie it to an EnterFrame event and that triggers the animation if you so please.

Call the Class from the Frame

var flipID:uint = new uint(1); var sc9MainPortImg1:sc9MainPortImg = new sc9MainPortImg(); addChild(sc9MainPortImg1); sc9MainPortImg1.x=0; sc9MainPortImg1.y=55; sc9MainPortImg1.name = "sc9Img"+flipID; sc9MainPortImg1.buttonMode = true; sc9MainPortImg1.addEventListener(MouseEvent.MOUSE_DOWN, sc9PortClick);   function sc9PortClick(e:MouseEvent){ var sc9MainPortImg1:sc9MainPortImg = new sc9MainPortImg(); addChildAt(sc9MainPortImg1,1); sc9MainPortImg1.x=0; sc9MainPortImg1.y=55; sc9MainPortImg1.name = "sc9Img"+flipID++; trace(sc9MainPortImg1.name); sc9MainPortImg1.buttonMode = true; sc9MainPortImg1.addEventListener(MouseEvent.CLICK, sc9PortClick); }

The actual Simple Flip 3D Class

package { import flash.display.MovieClip; import flash.events.Event; import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.*; import flash.display.*; import flash.filters.BitmapFilterQuality; import flash.filters.BlurFilter; import flash.net.LocalConnection; import fl.transitions.*; import caurina.transitions.Tweener; import flash.external.ExternalInterface;   public class sc9MainPortImg extends MovieClip { public var n:Number; public function sc9MainPortImg():void { randomFrame(); this.addEventListener(MouseEvent.CLICK, spinClick); }   public function randomFrame():void{ var frameArray:Array = new Array(); frameArray[0]=1; frameArray[1]=2; frameArray[2]=3; frameArray[3]=4; // Get random number created n=randRange(1,4); trace(n); trace(frameArray); // gotoAndStop Frame lable name this.gotoAndStop(frameArray[n]); }   public function spinClick(e:MouseEvent):void{ //this.addEventListener(Event.ENTER_FRAME, spin); --> Enable for Frame Based Animation Example var open_tween={rotationX:-84,alpha:0.0,time:20,transition:"easeoutelastic",delay:0}; Tweener.addTween( this, open_tween); }   public function spin(e:Event){ this.rotationX -= 2; if(this.rotationX == -84){ this.visible = false; this.removeEventListener(Event.ENTER_FRAME, spin); } }   public function randRange(min:Number, max:Number):Number { // Generate a number between and including min - max var randomNum:Number = Math.floor(Math.random()*(max-min+1))+min; return randomNum; } } }

Launch Experiment / Download Code

]]>
Sun, 11 Apr 2010 14:31:15 -0700 http://life.brendonsmith.com/items/view/2080/simple-flip3d-in-actionscript3
Adobe Could Respond to Apple’s Flash Snub http://life.brendonsmith.com/items/view/2062/adobe-could-respond-to-apples-flash-snub ]]> Sun, 11 Apr 2010 10:30:11 -0700 http://life.brendonsmith.com/items/view/2062/adobe-could-respond-to-apples-flash-snub Return of the Blue Lego --> Apple's new policy no plugin warning?? WTF. http://life.brendonsmith.com/items/view/2061/return-of-the-blue-lego-gt-apples-new-policy-no-plugin-warning-wtf ]]> Sat, 10 Apr 2010 15:26:25 -0700 http://life.brendonsmith.com/items/view/2061/return-of-the-blue-lego-gt-apples-new-policy-no-plugin-warning-wtf Apple Slaps Developers In The Face http://life.brendonsmith.com/items/view/2057/apple-slaps-developers-in-the-face ]]> Fri, 09 Apr 2010 19:56:36 -0700 http://life.brendonsmith.com/items/view/2057/apple-slaps-developers-in-the-face Bad Apple http://life.brendonsmith.com/items/view/2058/bad-apple ]]> Fri, 09 Apr 2010 19:56:05 -0700 http://life.brendonsmith.com/items/view/2058/bad-apple CasparCG - New Open BroadCast Server http://life.brendonsmith.com/items/view/2056/casparcg-new-open-broadcast-server ]]> Fri, 09 Apr 2010 19:53:24 -0700 http://life.brendonsmith.com/items/view/2056/casparcg-new-open-broadcast-server Inject JavaScript code in html wrapper from Flex/ActionScript http://life.brendonsmith.com/items/view/2032/inject-javascript-code-in-html-wrapper-from-flexactionscript ]]> Sun, 04 Apr 2010 11:08:02 -0700 http://life.brendonsmith.com/items/view/2032/inject-javascript-code-in-html-wrapper-from-flexactionscript Experimenting With The New Flex 4 Animation/Effects Framework http://life.brendonsmith.com/items/view/2026/experimenting-with-the-new-flex-4-animationeffects-framework ]]> Sat, 03 Apr 2010 16:13:16 -0700 http://life.brendonsmith.com/items/view/2026/experimenting-with-the-new-flex-4-animationeffects-framework Adobe Flash: One Web. Any Screen. http://life.brendonsmith.com/items/view/2020/adobe-flash-one-web-any-screen ]]> Fri, 02 Apr 2010 16:06:16 -0700 http://life.brendonsmith.com/items/view/2020/adobe-flash-one-web-any-screen