Monday, January 25, 2010

Maya Plugin wizard for Visual C++ express edition 2008 setup

1. Unzip the MayaPluginWizard2.0.zip file in the maya installation folder, eg.: C:\Program Files\Autodesk\Maya2008\devkit\pluginwizard

2. Copy the following files to the "C:\Program Files\Microsoft Visual Studio 9.0\VC\Express\VCProjects" directory:
MayaPluginWizard.vsdir
MayaPluginWizard.vsz
MayaPluginWizard.ico

2b. Edit MayaPluginWizard.vsz with a text editor, eg.: Notepad.
change line 2: Wizard=VsWizard.VsWizardEngine.9.0

2c. create a folder "MayaPlugInWizard" in "C:\Program Files\Microsoft Visual Studio 9.0\VC\Express\VCProjects"

2d. move "MayaPluginWizard.vsdir" into this new folder.

3. Copy the "MayaPluginWizard" directory to "C:\Program Files\Microsoft Visual Studio 9.0\VC\VCWizards".

4. Start Microsoft Visual Studio 8 and invoke File -> New -> Project -> Visual C++ Projects and select MayaPluginWizard.

5. Enter a name and solution name and select the OK button.

6. Fill in the information for the "Plug-in setup" screen and then select the "Plug-in type" and "Included libraries" links to also enter the required information.

7. The project will be created and then the solution can updated and built.

Simple Stereo 3d Anaglpyh example


Download FLA

import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.utils.*;

// Picture is a movie clip symbol in the Library
var loader:Picture = new Picture();
var loader2:Picture = new Picture();
var scene:Sprite = new Sprite();

// for drawing scene from left eye view
var left:Bitmap = new Bitmap();
// for drawing scene from right eye view
var right:Bitmap = new Bitmap();
// background for correct blending
var bg:Sprite = new Sprite();

var leftData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
var rightData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);

var distance:Number = 4; // left-right eye distance


init();
prepareStereo();

function prepareStereo():void
{
left.blendMode = BlendMode.SCREEN;
// right eye = green and blue channel
right.transform.colorTransform = new ColorTransform(0, 1, 1, 1);
// left eye = red channel
left.transform.colorTransform = new ColorTransform(1, 0, 0, 1);
left.bitmapData = leftData;
right.bitmapData = rightData;
setBackground();
this.addChild(right);
this.addChild(left);
// set the UI textbox and label to the top
this.setChildIndex(ui_mc, this.numChildren-1);
}
function setBackground(color:int = 0):void{
bg.graphics.beginFill(color);
bg.graphics.drawRect(-2000, -2000, 4000, 4000);
}
function init():void{
loader.x = 200;
loader.y = 200;
loader2.y = 200;
loader2.z = 300;
stage.addEventListener(MouseEvent.MOUSE_MOVE, move);
this.addEventListener(Event.ENTER_FRAME, update);
scene.addChild(bg);

scene.addChild(loader2);
scene.addChild(loader);
ui_mc.distance_txt.text = String(distance);
}
function update(e:Event):void{
// clear screen
rightData.fillRect(rightData.rect, 0xFFFFFF);
leftData.fillRect(rightData.rect, 0xFFFFFF);
distance = Number(ui_mc.distance_txt.text);
loader.x -= distance / 2; // move scene to the left for right eye
loader2.x -= distance / 2;
rightData.draw(scene);
loader.x += distance; // move scene to the right for left eye
loader2.x += distance;
leftData.draw(scene);
loader.x -= distance / 2; // move scene back to original position
loader2.x -= distance / 2;
}
function move(e:MouseEvent):void
{
loader.rotationY = (mouseY*2/stage.stageHeight - 1) * 60;
loader2.rotationY = (1-mouseY*2/stage.stageHeight) * 60;
loader.x = stage.stageWidth - mouseX;
loader2.x = mouseX;
}

Saturday, January 16, 2010

EasyPHP issues with Windows 7

Thanks to Ryan for the following post:
http://ryan.rawswift.com/2009/09/20/easyphp-on-64-bit-windows-7-how-to-fix-apache-and-mysql-problem/

summary of the above post:
issue 1 for Apache:
Apache cannot be runned: another Web server use the Web port
or port is blocked by firewall.
solution:
- Click the EasyPHP icon beside “Apache” button.
- Click “Configure” then click “EasyPHP“.
- Uncheck “Check server’s TCP port before starting” then click “Apply” button and then “Close” button.
- Click “Apache” button and then click “Start“.

issue 2 for MySQL:
Unexpected end of MySql... See log file?
solution:
- Go to “Computer“, open/view Drive C, then double click “Program Files (x86)“.
- Right click on “EasyPHP5.3.0” folder then click “Properties“.
- On “Security” tab click “Edit…” button.
- Select the user that you are currently using.
- Under “Permissions for Users” box, tick “Full control” on “Allow” column.
- And then click “OK” button to apply the changes.

Thanks, Ryan. it works for me.

Friday, January 08, 2010

Wednesday, January 06, 2010

FlashVars: sending variables into Flash from HTML/PHP

in HTML containing SWF:
...
AC_FL_RunContent(
...,
'flashVars','myVariable=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>'
); //end AC code

...
<param name="movie" value="live_stream.swf?myVariable=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>" />
<embed src="live_stream.swf?src=<?php echo((isset($_GET['myVariable'])) ? $_GET['myVariable'] : ""); ?>" ... >

in FLA/AS:
access variable thru:
this.loaderInfo.parameters["myVariable"]