nme and resolveClass/createInstance

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

nme and resolveClass/createInstance

Philippe Riou
Hi all,

Does resolveClass (and therefore createInstance) works when loading a swf with nme ? If not, what would be the best way to do it ?

Thanks,
Philippe
--

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Philippe Riou
Perhaps with hx::RegisterClass() ?

Le 01/08/2011 11:59, Philippe Riou a écrit :
Hi all,

Does resolveClass (and therefore createInstance) works when loading a swf with nme ? If not, what would be the best way to do it ?

Thanks,
Philippe
--



--

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Gamehaxe
In reply to this post by Philippe Riou
Hi,
There is no "linkage" between a swf and NME.
There is some code in gm2d to load a swf, but it only loads it
as a vector-file-format, rather than some kind of executable code.

Hugh

> Hi all,
>
> Does resolveClass (and therefore createInstance) works when loading a
> swf with nme ? If not, what would be the best way to do it ?
>
> Thanks,
> Philippe

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Philippe Riou
Yep I know but I'm in the process of doing one. All seems to be working quite well except I can't figure out clearly how the class registration works.

Phil.

Le 01/08/2011 16:31, Gamehaxe a écrit :
Hi,
There is no "linkage" between a swf and NME.
There is some code in gm2d to load a swf, but it only loads it
as a vector-file-format, rather than some kind of executable code.

Hugh

Hi all,

Does resolveClass (and therefore createInstance) works when loading a
swf with nme ? If not, what would be the best way to do it ?

Thanks,
Philippe


--

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Gamehaxe
You can't really create new "types" at runtime.  The classes need a
compile-time ID.
With NME, it create types of "gm2d.swf.MovieClip".

So, I guess it depends on what you want to do.
If there is a MovieClip "Circle", and you want to be able to go
"createInstance("Circle")" you will need to write some code to create
the correct instance of "gm2d.swf.MovieClip".  It may be possible to
write this library function to work one way on NME and one way in flash
to keep the syntax the same while doing quite different things.

If you want to do some code interpretation, you will need to create a
class with enough "hooks" to have dynamic function where appropriate.

Hugh

> Yep I know but I'm in the process of doing one. All seems to be working
> quite well except I can't figure out clearly how the class registration
> works.
>
> Phil.
>
> Le 01/08/2011 16:31, Gamehaxe a écrit :
>> Hi,
>> There is no "linkage" between a swf and NME.
>> There is some code in gm2d to load a swf, but it only loads it
>> as a vector-file-format, rather than some kind of executable code.
>>
>> Hugh
>>
>>> Hi all,
>>>
>>> Does resolveClass (and therefore createInstance) works when loading a
>>> swf with nme ? If not, what would be the best way to do it ?
>>>
>>> Thanks,
>>> Philippe
>>

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Julien CASTETS
Hey Phil :)

Maybe you could preprocess your swf in order to generate those classes at macro time.
By the way I don't know if you could do such a thing with macros, I mean be able to use format.swf.Reader (if this is what you are using) or else.

Cheers!
Julien

2011/8/1 Gamehaxe <[hidden email]>
You can't really create new "types" at runtime.  The classes need a
compile-time ID.
With NME, it create types of "gm2d.swf.MovieClip".

So, I guess it depends on what you want to do.
If there is a MovieClip "Circle", and you want to be able to go
"createInstance("Circle")" you will need to write some code to create
the correct instance of "gm2d.swf.MovieClip".  It may be possible to
write this library function to work one way on NME and one way in flash
to keep the syntax the same while doing quite different things.

If you want to do some code interpretation, you will need to create a
class with enough "hooks" to have dynamic function where appropriate.

Hugh


Yep I know but I'm in the process of doing one. All seems to be working
quite well except I can't figure out clearly how the class registration
works.

Phil.

Le 01/08/2011 16:31, Gamehaxe a écrit :
Hi,
There is no "linkage" between a swf and NME.
There is some code in gm2d to load a swf, but it only loads it
as a vector-file-format, rather than some kind of executable code.

Hugh

Hi all,

Does resolveClass (and therefore createInstance) works when loading a
swf with nme ? If not, what would be the best way to do it ?

Thanks,
Philippe


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: nme and resolveClass/createInstance

Philippe Riou
Hey Julio !

I would like to avoid as much as possible preprocessing.of data. I'm looking for a way to simulate what haXe does when the -swf option is set. I don't think it pre-processes every swf, except the root one. But maybe that's something that is done by the flashplayer plugin in real time and not by haXe.

I'll keep looking and keep you posted.

Phil.

Le 01/08/2011 22:37, Julien CASTETS a écrit :
Hey Phil :)

Maybe you could preprocess your swf in order to generate those classes at macro time.
By the way I don't know if you could do such a thing with macros, I mean be able to use format.swf.Reader (if this is what you are using) or else.

Cheers!
Julien

2011/8/1 Gamehaxe <[hidden email]>
You can't really create new "types" at runtime.  The classes need a
compile-time ID.
With NME, it create types of "gm2d.swf.MovieClip".

So, I guess it depends on what you want to do.
If there is a MovieClip "Circle", and you want to be able to go
"createInstance("Circle")" you will need to write some code to create
the correct instance of "gm2d.swf.MovieClip".  It may be possible to
write this library function to work one way on NME and one way in flash
to keep the syntax the same while doing quite different things.

If you want to do some code interpretation, you will need to create a
class with enough "hooks" to have dynamic function where appropriate.

Hugh


Yep I know but I'm in the process of doing one. All seems to be working
quite well except I can't figure out clearly how the class registration
works.

Phil.

Le 01/08/2011 16:31, Gamehaxe a écrit :
Hi,
There is no "linkage" between a swf and NME.
There is some code in gm2d to load a swf, but it only loads it
as a vector-file-format, rather than some kind of executable code.

Hugh

Hi all,

Does resolveClass (and therefore createInstance) works when loading a
swf with nme ? If not, what would be the best way to do it ?

Thanks,
Philippe


--
haXe - an open source web programming language
http://haxe.org




--

--
haXe - an open source web programming language
http://haxe.org