Converting multiple projects

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

Converting multiple projects

hosey hosey
I have attempted to convert multiple projects and wanted to ask questions/mention issues I ran into while using as3hx from SVN

Away3D 4 & Starling
1) Uses ||= in their code a lot.  I believe the best work around would be
example
temp||=new ObjectOfSometype();
haxe equivalent
temp=(temp==null)? new ObjectOfSometype() : temp;
or
if (temp==null)temp=new ObjectOfSometype() ;
?
I really like the simplicity of ||=


2) Both Away3D and Starling use com.adobe.utils.AGALMiniAssembler.as.  The main issue here is the use of regular expressions.   They are a brain fart for me.  If anyone could  translate that file, or the regular expressions therein, that would be great.

3)Away3d has a physics engine.  That engine uses an SWC.  The swc is created by the use of Alchemy and c code from bullet (http://continuousphysics.com/Bullet/)
Has anyone translated bullet into haxe/HxSL?

AlivePDF
1)Uses an object like
var a:Object={" ":123, "!", 256}
What would be the best workaround for this?

General question:
When as3 uses function as a variable would the best workaround be to use Dynamic?
example:
private function test (a:function):void{}
haxe
private function test (a:Dynamic):void{}

Thanks for any input.

Cheers
Hosey







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

Re: Converting multiple projects

Juraj Kirchheim
On Wed, Nov 2, 2011 at 8:05 PM, hosey hosey <[hidden email]> wrote:

> I have attempted to convert multiple projects and wanted to ask
> questions/mention issues I ran into while using as3hx from SVN
> Away3D 4 & Starling
> 1) Uses ||= in their code a lot.  I believe the best work around would be
> example
> temp||=new ObjectOfSometype();
> haxe equivalent
> temp=(temp==null)? new ObjectOfSometype() : temp;
> or
> if (temp==null)temp=new ObjectOfSometype() ;
> ?
> I really like the simplicity of ||=

You could write a macro, that reduces this to temp.defaultTo(someValue)

> AlivePDF
> 1)Uses an object like
> var a:Object={" ":123, "!", 256}
> What would be the best workaround for this?

That looks really weird. I assume a acts as a hash in this case? Using
a Hash might be the right thing then.

> General question:
> When as3 uses function as a variable would the best workaround be to use
> Dynamic?
> example:
> private function test (a:function):void{}
> haxe
> private function test (a:Dynamic):void{}

As long as it is possible, you should use a function type. Something
like private function test(TypeA->TypeB->ReturnType):void {}

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