external swf into MovieMaterial

13 views
Skip to first unread message

metSyS

unread,
Jan 30, 2010, 8:14:08 AM1/30/10
to Away3D.dev
I have a problem. To transform Embeded swf into MovieMaterial we need
to do next :

[Embed(source="Mxml.swf")]
private var mv:Class;
private var topMaterial:MovieMaterial = new MovieMaterial(new mv(),
{interactive:true, smooth:true});

But I need to transform swf into MovieMaterial from external file, so
I thought it must be :

private var frontMaterial:MovieMaterial;
...
var loader:Loader = new Loader();
loader.load(new URLRequest("Mxml.swf"));
frontMaterial=new MovieMaterial(loader);

But it doesn't work. Need help. Thanks.

Peter Kapelyan

unread,
Jan 30, 2010, 9:08:39 AM1/30/10
to away3...@googlegroups.com
If anything, you would have to wait for your swf to load first. Also most likely you would have to use the loaders content instead:

http://www.iheartactionscript.com/loading-an-external-swf-in-as3/

So you would wait for the
onCompleteHandler

to create you movie material.

Hopefully it works for you.
-Pete
--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

metSyS

unread,
Jan 30, 2010, 9:19:13 AM1/30/10
to Away3D.dev
It's clear, but i can't understand how to transform the loaded swf
into MovieMaterial ...

Peter Kapelyan

unread,
Jan 30, 2010, 11:39:28 AM1/30/10
to away3...@googlegroups.com
Whoops, I see it is embedded, maybe try

var loaderAsMovieClip=loader as MovieClip();
frontMaterial=new MovieMaterial(loaderAsMovieClip);

Just a guess...sorry I can't try it myself right now

-Pete

metSyS

unread,
Jan 31, 2010, 6:59:48 AM1/31/10
to Away3D.dev
Nope, doesn't work=( ... any ideas????

metSyS

unread,
Jan 31, 2010, 10:57:50 AM1/31/10
to Away3D.dev
Please Help. It's very important for me to solve this problem.

Charles Wardlaw

unread,
Jan 31, 2010, 11:16:55 AM1/31/10
to away3...@googlegroups.com
> Please Help. It's very important for me to solve this problem.

http://gotoandlearn.com/play?id=85

It's in the docs that you have to apply event handlers to loader's contentLoaderInfo in order to get the events to fire properly. Once the events are done, then build your movie clip mat. If you try building it before Event.COMPLETE, it will fail.

The other thing that I don't think anybody asked is: are you testing this locally, or on a website? Flash likes to lock you out of loading local files unless you know how to flip the switch to local files and turn off network access. Dunno if that's still an issue in CS4.
~ C

metSyS

unread,
Jan 31, 2010, 12:29:54 PM1/31/10
to Away3D.dev
I set up in project properties ActionScript Compiler>additional
compiler arguments : -use-network=false. I think it must solve problem
with network. So I understand that I need after :

var loader:Loader = new Loader();
loader.load(new URLRequest("Mxml.swf"));

add event listener for listening if the downloading complete or not?
Soory for my bad english.

metSyS

unread,
Jan 31, 2010, 2:11:25 PM1/31/10
to Away3D.dev
ok one more time. In this way :

[Embed(source="Mxml.swf")]
private var mv:Class;
private var topMaterial:MovieMaterial = new MovieMaterial(new mv(),
{interactive:true, smooth:true});

I get "topMaterial" which are swf file wich embeded into my project,
and i can use it as a texture(material) for any primitive.

In this way :

var loader:Loader=new Loader();
loader.load(new URLRequest("Mxml.swf"));
addChild(loader);

I have loaded external SWF. But I can't transform it into
MovieMaterial, which I want to use as texture(material) for any
primitive.
Hope for HELP. Thanks.

metSyS

unread,
Feb 1, 2010, 7:48:45 AM2/1/10
to Away3D.dev
Some ideas? ... Really need to solve this problem.

On 30 янв, 18:39, Peter Kapelyan <flashn...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages