Posted by: Petit Mar 20 2007, 12:46 PM
This thread is moved here from the mailing list, so I just give you the posts in order.
QUOTE
--- Torkel Lyng wrote ------------
I'm totally new in ActionScript development and are just trying to
figure out what tools to use.
Now I've set up some Rake file, some libraries, sandy and MTASC.
I've put together this code and cant seem to make it work, if I
switch the skin with MixedSkin it work ok, but when using the
VideoSkin all is white. Anyone got any suggestions for what can be
wrong?
CODE
import sandy.core.data.*;
import sandy.core.group.*;
import sandy.core.transform.*;
import sandy.core.*;
import sandy.primitive.*;
import sandy.view.*;
import sandy.skin.*;
import sandy.events.InterpolationEvent;
import sandy.util.Ease;
import com.mydomain.UselessClass;
class com.mydomain.Controller {
static var app : Controller;
function Controller() {
var myMC : MovieClip;
try {
_root.createEmptyMovieClip('myMC', 1);
init(_root.myMC);
} catch (e : Error) {
trace(e.message);
}
}
public static function main() {
app = new Controller();
}
function init( stage : MovieClip ) : Void
{
var ecran:ClipScreen = new ClipScreen( stage, 600, 600 );
var cam:Camera3D = new Camera3D( 400, ecran);
cam.setPosition(0, 0, -300);
World3D.getInstance().addCamera( cam );
var bg:Group = new Group();
World3D.getInstance().setRootGroup( bg );
createScene( bg );
World3D.getInstance().render();
}
static function createScene( bg : Group ):Void
{
var o:Object3D = new Box( 150, 150, 150, "tri" );
var theCamFeed:Camera = Camera.get();
var myCamera:Video;
myCamera.attachVideo(theCamFeed);
/* var skin:Skin = new MixedSkin( 0x00FF00, 80, 0, 100, 1); */
var skin:VideoSkin = new VideoSkin(myCamera);
o.setSkin(skin);
var tg:TransformGroup = new TransformGroup();
var rotation:Transform3D = new Transform3D();
rotation.rot(20, 30, 0);
tg.setTransform(rotation);
tg.addChild(o);
bg.addChild(tg);
}
}
QUOTE
--- Petit wrote ------------
Well it could work.
I have changed the naming a bit to be able to think

Here is my new createScene method:
CODE
static function createScene( bg : Group ):Void
{
var o:Object3D = new Box( 150, 150, 150, "tri" );
var myCamera:Camera = Camera.get();
// myVideo is an instance of Video on stage
myVideo.attachVideo( myCamera );
//var skin:Skin = new MixedSkin( 0x00FF00, 80, 0, 100,
1);
var skin:VideoSkin = new VideoSkin(myVideo);
o.setSkin(skin);
var tg:TransformGroup = new TransformGroup();
var rotation:Transform3D = new Transform3D();
rotation.rot(20, 30, 0);
tg.setTransform(rotation);
tg.addChild(o);
bg.addChild(tg);
}
First of all the Video component is in the library.
To make it work, I dragged one instance to tue Stage ( I'm using Flash 8 )
and named it "myVideo".
I get the Camera and attach it to the Video.
You know the Camera is the source of the feed and the Video component is the display.
Now this is not exactly what we want, because the image is displayed not only on the cube,
but on the stage as well.
The solution is to drag the Video instance outside of the visible area or set its alpha value to 0
CODE
myVideo._alpha = 0; // Hide it on stage
[Edit]
And then, I'm very sorry, I didn't read your message. :-[
With MTASC I admit I'm a bit lost.
Someone else to rescue please !
QUOTE
--- Torkel Lyng wrote ------------
Is it possible add this videoobject from library dynamically using
actionscript? I dont want to use flash 8 for this really :-)
QUOTE
--- kiroukou wrote ------------
Hi,
I'm sorry but I'm not very experienced with video in flash.... SO I
can't really help you for that...
Have you tried to attach the video object into a movieclip? After
that you would be able use Movieskin instead...
Just my 2 cents this morning. If I have something more intelligent to
offer to you, I come back
QUOTE
--- cornel wrote ------------
hi
you should look at swfmill for that; i have a sample somewhere, i can
look for it if
QUOTE
--- Torkel Lyng wrote ------------
I managed to add a video object with SWFMill, but when using the
Video object for texture in VideoSkin MTASC complains about Video not
having the properties ._width and ._height. Using the MovieClip
instead work fine.
mtasc -version 8 classes/com/mydomain/Controller.as -swf assets/
libraries/main.swf -cp classes -cp ../classes/std8 -cp ../classes -
cp ../classes/std -out public/main.swf -keep -main
../classes/sandy/skin/VideoSkin.as:44: characters 25-37 : type error
Video have no field _width
Basically what I'm trying to do is have a webcam stream textured on
the cube, do I have to use VideoSkin for this or will MovieSkin also
work?
QUOTE
--- kiroukou wrote ------------
Hi,
Yes MovieSkin would work for that.
But this error with VideoSkin is a problem f MTASC I guess, since MM
compilier doesn't complain.
Otherwise, I recommend you to post your technical questions on the forum
directly. This is the support place. This list is more adapted to discuss
about the library itself and ask your general questions
Best,
Thomas
--------------- End of transfered thread --------------
Posted by: evanFlash Mar 20 2007, 07:00 PM
QUOTE(Torkel Lyng @ Mar 20 2007, 12:46 PM)

mtasc -version 8 classes/com/mydomain/Controller.as -swf assets/
libraries/main.swf -cp classes -cp ../classes/std8 -cp ../classes -
cp ../classes/std -out public/main.swf -keep -main
../classes/sandy/skin/VideoSkin.as:44: characters 25-37 : type error
Video have no field _width
this
error is only because the intrinsic class that mtasc is using for
type-checking doesn't include all the properties. All you need to do is
find the intrinsic class file Video.as (it'll be the mtasc folder
somewhere) and add :
CODE
public var _width:Number;
public var _height:Number;
the Video class has these properties, mtasc just doesn't know this, so you have to tell it :-)