This is G o o g l e's cache of http://www.flashsandy.org/forum/index.php?act=Print&client=printer&f=17&t=47 as retrieved on 3 Aug 2007 02:12:11 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?q=cache:D232Xt-e0U4J:www.flashsandy.org/forum/index.php%3Fact%3DPrint%26client%3Dprinter%26f%3D17%26t%3D47+act%3DPrint+%22index+php%22+-lofiversion+site:www.flashsandy.org&hl=en&ct=clnk&cd=54


Google is neither affiliated with the authors of this page nor responsible for its content.
These terms only appear in links pointing to this page: act print index php

Printable Version of Topic

Click here to view this topic in its original format

Sandy's Forum _ AS2 1.x versions _ TextureSkin

Posted by: Nicolas Parziale Jun 26 2006, 02:26 PM

hi!, i'm making a regular box with a texture skin, the issue is that the image appears flipped, how can a i change that, without going to the easy way and flip the original image. and, can anyone give me a little example on how to skin my box with different images for each face( if that's possibe ) or how to set the face id or something like that blink.gif

thanx !

Posted by: kiroukou Jun 26 2006, 04:47 PM

Hi,

Here is the solution to apply a different texture on box sides. I'm thinking on another solution, but I don't which one is better....

Here is the code :

CODE

import sandy.core.data.*;
import sandy.core.group.*;
import sandy.primitive.*;
import sandy.view.*;
import sandy.core.*;
import sandy.core.face.*;
import sandy.skin.*;
import sandy.util.*;
import sandy.core.transform.*;
import sandy.events.*;
import flash.display.BitmapData;

function init( Void ):Void
{    var ecran:ClipScreen = new ClipScreen( this.createEmptyMovieClip('ecran', 1), 300, 300 );
    var cam:Camera3D = new Camera3D( 700, ecran);
    World3D.getInstance().addCamera( cam );
    var bg:Group = new Group();
    createScene( bg );
    World3D.getInstance().setRootGroup( bg );
    World3D.getInstance().render();
}

function createScene( bg:Group ):Void
{
    var f:Face;
    var o:Object3D = new Box( 50, 50, 50 );
    var a:Array = o.getFaces();
    for( var i:Number = 0,j:Number = 1; i < a.length; i+=2, j++ )
    {
        var skin:Skin = new TextureSkin( BitmapData.loadBitmap(''+j) );
        f = a[i];
        f.setSkin( skin );
        f = a[i+1];
        f.setSkin( skin );
    }

    var tg:TransformGroup = new TransformGroup();
    var tg_rot:TransformGroup = new TransformGroup();
    var t:Transform3D = new Transform3D();
    t.translate( 0, 0, 500 );
    tg.setTransform( t );
    //
    var ease:Ease = new Ease();
    ease.linear();
    var rotint:RotationInterpolator = new RotationInterpolator( tg_rot, ease.create(), 500 );
    rotint.addEventListener( InterpolationEvent.onProgressEVENT, this , onRender );
    rotint.addEventListener( InterpolationEvent.onEndEVENT, this , onEnd );
    tg_rot.addChild( o );
    tg_rot.addChild( rotint );
    tg.addChild( tg_rot );
    bg.addChild( tg );
}
function onEnd( e:InterpolationEvent ):Void
{
    e.getTarget().redo();
}
function onRender( e:InterpolationEvent )
{
    var difX:Number = 150 - _xmouse;
    var difY:Number = 150 - _ymouse;
    var dist:Number = Math.sqrt( difX*difX  + difY*difY );
    RotationInterpolator(e.getTarget()).setAxisOfRotation( new Vector( -difY, difX, 0 ) );
    RotationInterpolator(e.getTarget()).setDuration( 10000 / dist );
}    

init();

Short isn't it? smile.gif

To flip the picture, I think you are able to do it by yourself playing with BitmapData object wink.gif


Attached File(s)
Attached File  texture_a_box.fla ( 109.5k ) Number of downloads: 86
Attached File  texture_a_box.swf ( 45.81k ) Number of downloads: 135

Posted by: marcus Oct 4 2006, 11:03 AM

Hi there,

Really cool effect, but I can't seem to get it to work?? I get these error messages:


**Error** Scene=Séquence 1, layer=Calque 1, frame=1:Line 45: Type mismatch.
var rotint:RotationInterpolator = new RotationInterpolator( tg_rot, ease.create(), 500 );

**Error** Scene=Séquence 1, layer=Calque 1, frame=1:Line 49: Type mismatch.
tg_rot.addChild( rotint );






I think it has something to to with the bitmap classes. I can for example add a skin to a simple object, e.g. var skin:Skin = new MixedSkin(0x0000FF, 20, 1, 10, 1). But if I try the bitmap skin, e.g. var skin:Skin = TextureSkin( "pegs" ); I get the following errors:


**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 45: The class or interface 'flash.display.BitmapData' could not be loaded.
public function TextureSkin( t:BitmapData )

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 49: The class or interface 'flash.geom.Point' could not be loaded.
_p = new Point(0, 0);

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 50: The class or interface 'flash.filters.ColorMatrixFilter' could not be loaded.
_cmf = new ColorMatrixFilter();

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 56: The class or interface 'flash.display.BitmapData' could not be loaded.
public function set texture( b:BitmapData )

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 67: The class or interface 'flash.display.BitmapData' could not be loaded.
{

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 115: The class or interface 'flash.geom.Matrix' could not be loaded.
var mat:Matrix = new Matrix( (u1 - u0)/_w, (v1 - v0)/_w, (u2 - u0)/_h, (v2 - v0)/_h, u0, v0 );

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 201: The class or interface 'flash.display.BitmapData' could not be loaded.
private var _tmp:BitmapData;

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 202: The class or interface 'flash.geom.Point' could not be loaded.
private var _p:Point;

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 203: The class or interface 'flash.filters.ColorMatrixFilter' could not be loaded.
private var _cmf:ColorMatrixFilter;

**Error** /Users/marcus/Desktop/3D Flash/FlashClassPath/sandy/skin/TextureSkin.as: Line 204: The class or interface 'flash.display.BitmapData' could not be loaded.
private var _texture:BitmapData;


Please help!?!

/ marcus

Posted by: marcus Oct 5 2006, 06:17 PM

Don't worry about it. smile.gif If I paste all the code into a new file it works. Strange though?!?

thanks anyway,

/ marcus

Posted by: sunkillah Oct 20 2006, 03:57 AM

Hi to all !

Not sure where this error come from, but i tried Marcu's solution and got the same error message. (Flash 8 AS 2). Pourtant ! ..I didn't modify the original file !

By the way .. is there a tuto for MovieSkin and a cube ?

Merci !!

Posted by: kiroukou Oct 20 2006, 05:46 AM

Hi,
It is a version problem.

CODE

    var rotint:RotationInterpolator = new RotationInterpolator( tg_rot, ease.create(), 500 );
    rotint.addEventListener( InterpolationEvent.onProgressEVENT, this , onRender );
    rotint.addEventListener( InterpolationEvent.onEndEVENT, this , onEnd );
    tg_rot.addChild( o );
    tg_rot.addChild( rotint );

should be replaced by :
CODE

    var rotint:RotationInterpolator = new RotationInterpolator( ease.create(), 500 );
    rotint.addEventListener( InterpolationEvent.onProgressEVENT, this , onRender );
    rotint.addEventListener( InterpolationEvent.onEndEVENT, this , onEnd );
    tg_rot.addChild( o );
    tg_rot.setTransform( rotint );

++ wink.gif

Posted by: Petit Nov 27 2006, 12:07 PM

QUOTE(sunkillah @ Oct 20 2006, 04:57 AM) *

By the way .. is there a tuto for MovieSkin and a cube ?


Now there is smile.gif
AS a http://www.petitpub.com/labs/media/flash/sandy/skinning2.shtml of my "Using Sandy 3D library"

Posted by: vikingo Dec 31 2006, 10:33 PM

Hi, i got this error whem I'm trying to use a bitmap skin

**Error** C:\Macromedia Flash 8\Flash 8\ASLibraries\sandy\skin\TextureSkin.as: Line 161: There is no method with the name 'getDirectionVector'.
var dot:Number = lp - ( VectorMath.dot( l.getDirectionVector(), f.createNormale() ) );

Any one can help me please?
Thanks.

Posted by: kiroukou Jan 2 2007, 04:20 PM

hi vikingo.
What version of Sandy are you using?

Thanks,
Thomas

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)