Flash Dynamic Audio Coming Soon
Aug26
I have been messing with audio in Flash the last couple of days, fresh off the creative high of FITC. I plan in the next couple of days to announce some projects. Stay tuned.
I have been messing with audio in Flash the last couple of days, fresh off the creative high of FITC. I plan in the next couple of days to announce some projects. Stay tuned.
This past week I worked on a porting exercise. I have always wanted to find out how you convert Roman Numerals to Arabic numerals and vice versa. So I starting searching and found a bunch of bloated code for converting these numbers then I stumbled on this page.
So in a few hours of screwing around w/ the loops (typing this correctly took a bit) I got it ported. Porting is fun cause all you have to do is translate.
Here is the zip flie and Here is the class.
package com.joshspoon.etc.utils { public class NumberUtils { public function NumberUtils(){} public static function romanize(num:int):String { var numerals:Array = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]; var numbers:Array = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]; var lookup:Object = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1} var roman:String = ""; var i:int; for( i = 0; i < numbers.length; i++) { while(num >= numbers[i]) { roman += numerals[i]; num -= numbers[i]; } } return roman; } public static function deromanize( roman:String ):int { var numerals:Array = ["I", "V", "X", "L", "C", "D", "M"]; var numbers:Array = [1, 5, 10, 50, 100, 500, 1000]; var roman:String = roman.toUpperCase(); var arabic:int = 0; var i:int = roman.length; var compare1:int; var compare2:int; while (i--) { var letter:String; var listLetter:String; for (var j:int = 0; j < = numerals.length - 1; j++) { letter = roman.charAt(i); listLetter = numerals[j]; if(listLetter == letter) { compare1 = numbers[j]; } } for (j = 0; j <= numerals.length - 1; j++) { letter = roman.charAt(i + 1); listLetter = numerals[j]; if(listLetter == letter) { compare2 = numbers[j]; } } if (compare1 < compare2 ) arabic -= compare1; else arabic += compare1; } return arabic; } } }
So since PureMVC has updated twice and also I never talked about garbage collection of the app, I have refactored PurelyKuler to work with PureMVC 2.3. Thate are quite a few changes, some being:
super(NAME, viewComponent);// the colorContainer
}
Those are just a few.
Alright back to PurelyKuler.
I didn’t think this was going to happen with Yahoo Maps going Ajax and the maps hack they released last year (Yahoo! Maps API Flex 2 Communication Kit).
Check it out: http://developer.yahoo.com/flash/maps/
Someone asked me to give an example of the alpha masking in flash. So here is an example.
If you haven’t heard from the whole Flash community Papervision 3D 2.0 is out w/ textures, more interactive features and new coding conventions like BasicRenderEngine Class. I was working on a Coverflow thing for a client a week ago that I abandoned and just moded Doug McCune. But when I was going to do it myself I was using the Great White Trunk.
Here is what I came up with:
[as]
package
{
import caurina.transitions.Tweener;
import flash.display.*;
import flash.events.Event;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.*;
import org.papervision3d.view.Viewport3D;;
public class PV3DTest extends Sprite
{
[Embed(source="images/one.jpg")]
private var Pic:Class;
public var scene:Scene3D;
public var camera:Camera3D;
public var viewport:Viewport3D;
public var renderer:BasicRenderEngine;
private var photoContainer:Plane;
public function PV3DTest()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
init();
}
private function init():void
{
scene = new Scene3D()
camera = new Camera3D();
camera.focus = 500;
camera.zoom = 3;
renderer = new BasicRenderEngine();
viewport = new Viewport3D(stage.stageWidth, stage.stageHeight, false, false, true, true);
viewport.addEventListener(Event.ADDED_TO_STAGE, init3d);
addChild(viewport);
}
private function init3d(e:Event = null):void
{
var data:Bitmap;
var photoMat:BitmapMaterial;
data = new Pic() as Bitmap;
photoMat = new BitmapMaterial(data.bitmapData);
photoContainer = new Plane(photoMat, 220, 210, 6, 6);
camera.target = photoContainer;
//photoContainer.yaw(45);
scene.addChild(photoContainer);
renderer.renderScene(scene, camera, viewport);
addEventListener(Event.ENTER_FRAME, render);
}
private function render(evt:Event):void
{
Tweener.addTween(photoContainer, {rotationY: 45, transition:”linear”, time:.5});
Tweener.addTween(viewport, {x: 300, transition:”linear”, time:.5});
renderer.renderScene(scene, camera, viewport);
}
}
}
[/as]