Matt Kenefick
Contact Me Experiments Blog Portfolio

Archive for the ‘Actionscript 3.0’ Category

F4D:AIR version 1.0 demo

Sunday, November 9th, 2008

I apologize about the lack of quality. GoogleVideo certainly compresses uploads very heavily. Here is the cast (go fullscreen): Video if below doesn’t play

Features Shown:

  • Foreground / Background color
  • Line staggering / Line opacity
  • Motion recording / playback (+options)
  • Effects
  • Stage transparency (draw directly over Photoshop)
  • Live layers preview ( hard to see due to quality )
  • Save file

Features Not Shown:

  • Line thickness
  • Catchup speed
  • Fullscreen
  • Save Transparent PNG Layers
  • Save document merged
  • Clear all layers
  • Color Shifting+Selection

There is a lot you can do here. I will release this app soon. Send in any requests. I have confirmed that I will be doing an export for Illustrator.

Next V Ideas: Color Shifting Points (pause at color, key command to start shift)

Screens:

Saving JPEGs with Flash

Thursday, November 6th, 2008

This is pretty much copy and paste. Found this one on Snipplr. I like this place a lot. It is based of reference of this tutorial: DesignReviver. ( Originally at HenryJones ).

import com.adobe.images.JPGEncoder;
 
function createJPG(mc:MovieClip, n:Number, fileName:String) {
 
	var jpgSource:BitmapData = new BitmapData (mc.width, mc.height);
		jpgSource.draw(mc);
	var jpgEncoder:JPGEncoder = new JPGEncoder(n);
	var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
 
	var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
 
	//Make sure to use the correct path to jpg_encoder_download.php
	var jpgURLRequest:URLRequest = new URLRequest ("download.php?name=" + fileName + ".jpg");
		jpgURLRequest.requestHeaders.push(header);
		jpgURLRequest.method = URLRequestMethod.POST;
		jpgURLRequest.data = jpgStream;
 
	var loader:URLLoader = new URLLoader();
	navigateToURL(jpgURLRequest, "_blank");
}
 
 
//createJPG(movieClip, quality, fileName);
createJPG(myMovieClip, 90, "myDog");

<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
	// get bytearray
	$im = $GLOBALS["HTTP_RAW_POST_DATA"];
 
	// add headers for download dialog-box
	header('Content-Type: image/jpeg');
	header("Content-Disposition: attachment; filename=".$_GET['name']);
	echo $im;
}  else echo 'An error occured.';
?>

Fractal4D coming to AIR

Thursday, November 6th, 2008

The test below was just the beginning. I am expanding it further to the web and also bringing it to AIR. Features will include the standard as well as:

  • attribute panels
  • live color monitoring
  • change background color
  • export to graphic
  • resize canvas
  • fullscreen mode
  • layering
  • glow effects
  • color sequencing
  • color selection
  • canvas rotation
  • canvas scaling

I am also working with converting it to Illustrator so you can take these vectors and make them huge. The color sequencing mentioned is a way to select the color spectrum you want it to automatically navigate through. Right now it goes through the whole rainbow, but will be able to select something like (red, blue, green, red, purple, red, black, white) and it will follow correctly.

This project is exciting. I hope to have it ready sometime next week. Watch out for it!

PORT & FlashDen

Wednesday, November 5th, 2008

Thanks to Jason over at FlashDen.net for writing up a little piece about my PORT project. It may be interesting, and very valuable, if we can collaborate on implementing certain components from the FlashDen repository into some PORT projects.

I would just like to respond to this article a little.

PORT will be released with a focus at Actionscript developers as mentioned. Depending on how things go, it may expand to other aspects of web (design, other languages, etc). My goal is to keep this service free for all users. I am not making any money from this project. I feel that the education system for our field needs to start a reform and I have not seen it happening, but one of us has to start it… Simply throwing funds at your problems will not fix them.

The service will require registration. The reason for this is because we may need your email for certain projects that require a “client interaction.” Some projects will have updates half-way through or important notifications. If you hand in work without the changes, it will be marked down. Also, it is important to record that ‘John Doe’ sent in Project A, Project B, etc so we can record your grades and give credit where credit is due. Everyone hates registration so I will make it as simple as possible (including implementation of OpenID). The PORT website will proudly be using and supporting the Silverstripe CMS system. Check it out!

More news to come! Thanks for the support so far.

AS3 “Fractals” with Color Shifting + Points

Monday, November 3rd, 2008

This is a fun one I made tonight in about 2 hours. It will shift through your standard color spectrum and is configurable. I packaged the whole thing into a small class that you can call dynamically to create different realms of “fractal” regions.

I put fractals into quotes because technically it is not all the same shape in different scales and translations… but it is similar to the effects you might see.

It starts with a standard of 3 points, but you can press the Keyboard UP key to add a point, and the DOWN key to remove one. It makes for fun experiments cause the originate at Point(0,0). CLICK the stage to get a fresh canvas. Other than that… Here you go:

EDIT 11 / 4 / 2008 ____________________________________
Key Commands:
Up Arrow: Add Point
Down Arrrow: Remove Point (minimum 2)
Left Arrow: Pause Output
Right Arrow: Relocate start point. Start Output
Letter b: Blur Filter On/Off
Letter s: Scroll Bitmap On/Off
Numpad 1: Slow down catch-up speed
Numpad 0: Speed up catch-up speed

Mouse
Click: Clear Stage
Control+Click: Drag / Reposition Graphics

Use the drag canvas in combination with Pause output to relocate yourself.
Filters are OFF by default. You must press “b” or “s” to turn them on to start.

What is coming? ________________________
- Motion tracking : record and replay
- Print to JPEG / GIF : save it!
- Change background / select colors
- Print to AI Vector action (no promises on this one)

New Source _______________________
Includes 3 class files.

- Download Source

 

Here is the code used to create this example ( without class ):

import com.kenefick.color.*
 
// Create a drawing board for these fractals...
var bData:BitmapData = new BitmapData( 800,600, false, 0x0 );
var bmp:Bitmap = new Bitmap( bData );
addChild( bmp );
 
// Setup The Fractal
var fract 	= new fractal( bData, this );
 
fractal_input.init(fract, stage);
fractal_effects.init(fract);
 
fract.newFractal( 3 /* initial points */,
				 20 /* catch-up speed */,
				 true /* use color shifting */);
fract.start();

Erasing BitmapData using Actionscript

Sunday, November 2nd, 2008

This will allow you select different eraser sizes and delete sections of a bitmap. The source does not include any packages and I will admit is minorly sloppy. I organized it into the frames, so you should be able to see it just fine.

- Download Source

Gesture Testing: V0.1

Sunday, November 2nd, 2008

I have started some gesture testing experiments. Included below is the first of all the tests. It will wait for you to stop moving your mouse, your mouse icon will change to a circle to let you know you can proceed. You then circle a shape with your mouse (making sure to stop close to where you started) and it will be identified and removed. The red blocks are not “selectable”, but the blue objects are.

height of the shadow (which would specify angle of view).

This demo certainly has some bugs to work out, but that is what experimentation is about.

Looking for judges…

Friday, October 31st, 2008

For my new PORT project. ( http://mattkenefick.com/blog/2008/10/port-my-new-project/ )

Needs to be:

  •    Well versed in AS 2.0 and AS 3.0
  •    Understands good design patterns / practices
  •    Good coding conventions
  •    Deep understanding of the words “Why” and “Why Not”
  •    Interested in helping the Flash community pro-bono
  •    Able to work with me in grading submitted projects
  •    Has creative ideas for faux-projects

If this is something you might be interested in… leave a comment or shoot me an email ( keneficksays@gmail.com ). I am hoping to launch this relatively soon and could use a hand in getting things moving.

If not, you are still free to participate!

Sound Visualization Bug in Flash

Thursday, October 30th, 2008

This is something interesting I stumbled upon. I was listening to a station on Pandora.com then I went to my experimentation site ( http://www.jureuxoris.com ). I tried looking at my Sound Visualization examples. The music would play but the sound visualization would not show up. I closed the Pandora tab and refreshed my Sound Visualization and then it worked.

Next, I went to Purevolume.com and used one of their players to see if it was other Flash players in general or just Pandora.com. Same thing happened.

It seems as though if there is another Flash player playing sound in a different tab, your sound visualization will not work. The sound will play but it will not be able to read it.

Interesting…

Working on a fix…

Point around a perimeter

Thursday, October 30th, 2008

This will find a point outside of a specified object. Good for games perhaps if you need random placement outside of something like a building or whatnot.

Actionscript 3.0

// example does not take into account width of object
// being used
var stageHeight = 400;
var stageWidth 	= 550;
 
// width priority
var w,nw,h,nh,wp = 0;
 
function setRandomPoint(e:TimerEvent = null){
	wp = Math.round(Math.random());
	if(!wp){
		// gives priority to height
		w = Math.random()*(stageWidth-mc.width);
		nw = (w>mc.x)?w+mc.width:w
		nh = Math.random()*(stageHeight);
	}else{
		// gives priority to width
		nw = Math.random()*(stageWidth);
		h = Math.random()*(stageHeight-mc.height);
		nh = (h>mc.y)?h+mc.height:h
	}
 
	point_mc.x = nw
	point_mc.y = nh
 
}
 
var timer:Timer=new Timer(200);
timer.addEventListener(TimerEvent.TIMER, setRandomPoint);
timer.start();