swf as texture

26 views
Skip to first unread message

le_unam

unread,
Aug 2, 2010, 5:28:19 AM8/2/10
to Away3D.dev
hey guys ... is it possible to load an swf file as texture? how to do
that?
so we take an easy plane and the texture should be an swf file. any
ideas?

Rich Elmes

unread,
Aug 2, 2010, 8:37:00 AM8/2/10
to Away3D.dev
you want to use http://away3d.com/livedocs/3.5.0_lib/away3d/materials/MovieMaterial.html
for your plane.material

also look at AnimatedBitmapMaterial

le_unam

unread,
Aug 2, 2010, 9:30:17 AM8/2/10
to Away3D.dev
hey thanks ... ehm i am able to handle a movieclip as texture
(material) but i want to take a swf file. Do you mean that i should
load the swf file into the movieclip and then use the movieclip as
material?

On 2 Aug., 14:37, Rich Elmes <asimi...@gmail.com> wrote:
> you want to usehttp://away3d.com/livedocs/3.5.0_lib/away3d/materials/MovieMaterial.html

Rich Elmes

unread,
Aug 3, 2010, 9:49:53 AM8/3/10
to Away3D.dev
exactly

load the .swf into some container, pass the container as movieclip for
the material :)

le_unam

unread,
Aug 4, 2010, 6:08:47 AM8/4/10
to Away3D.dev
what do you mean with container? what type of container? movieclip is
okay?

le_unam

unread,
Aug 5, 2010, 2:42:21 AM8/5/10
to Away3D.dev
hey guys ... now my swf-file is loaded in a movieclip, but my problem
is how to get this applied as texture. My code for this is the
following:

private var mc:MovieClip;
private var laden:Loader;
private var url:URLRequest;

mc = new MovieClip();
addChild(mc);

laden = new Loader();
url = new URLRequest("intro.swf");

laden.contentLoaderInfo.addEventListener(Event.COMPLETE, geladen);
laden.load(url);

var mbildschirm:MovieMaterial = new MovieMaterial(mc);

tv = new Cube ( { material:mweiss, width:100, height:60, depth:6, y:
50, z:100 } );
tv.cubeMaterials.front = mbildschirm;
myScene.addChild(tv);

public function geladen(e:Event):void
{
trace("Externer Film wurde geladen!");
trace(e.target.content);
mc.addChild(laden);
}


the swf file is shown in front of my scene but it is not applied on
the "tv" = (

does anybody know where my problem is? Or did i go the wrong way?

greeeetz manu

Peter Kapelyan

unread,
Aug 5, 2010, 8:58:59 AM8/5/10
to away3...@googlegroups.com
Try something like this:

laden.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadedFunc);

then:

public function swfLoadedFunc(e:Event):void
{
   var myMovieMat=new MovieMaterial(e.target.content, {interactive:true});
   my3DObject.material= myMovieMat;
}
--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

Rich Elmes

unread,
Aug 5, 2010, 9:55:35 AM8/5/10
to Away3D.dev
you want something like this :

var loader=new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoad);
loader.load(new URLRequest("intro.swf"));

private function onLoad(e:Event):void {
var material:MovieMaterial=new MovieMaterial(e.target.content);

// create your cube and add to scene etc.
}

probably the timing all screwed with your code, since it try to create
the material before the .swf had a chance to load

Rich Elmes

unread,
Aug 5, 2010, 9:57:29 AM8/5/10
to Away3D.dev
oops, didn't see this... basically same deal, wait until .swf has
loaded before creating the material

le_unam

unread,
Aug 5, 2010, 10:21:42 AM8/5/10
to Away3D.dev
hey thanks for this idea, but it says:
avm1movie@....... can not be converted into type flash.display.sprite

hmmm, any idea?

Peter Kapelyan

unread,
Aug 5, 2010, 10:46:41 AM8/5/10
to away3...@googlegroups.com
It looks like you are trying to load a different version SWF (higher version?). I forget what this error means, but I am sure that code I pasted for you works since I've used it before to test and help another user on this board.

-Pete

le_unam

unread,
Aug 5, 2010, 10:50:12 AM8/5/10
to Away3D.dev
ok thank you i will try it with creating a new swf with same
properties, so flashplayer 10 and actionscript3 and adobe cs4 ....
thank you = )

le_unam

unread,
Aug 6, 2010, 2:54:49 AM8/6/10
to Away3D.dev
thank you thats it ... works fine ... thanks = )

le_unam

unread,
Aug 6, 2010, 4:19:03 AM8/6/10
to Away3D.dev
hey sorry its me again = )

is there a chance to scale the movieclip with the swf within over the
face? so my swf is to big and i see just the edge of the movie at my
object.
Reply all
Reply to author
Forward
0 new messages