8

I was just wondering is there anyway to convert Actionscript to Javascript. When I say Actionscript I mean Actionscript 3. I've used google swiffy but Actionscript 3 is hardly supported. I've also heard of Jangaroo but its not what I want. Even if its a code comparison! Thanks!

1
  • 1
    The languages are not so different, but the APIs are completely different. Commented Aug 15, 2013 at 3:03

3 Answers 3

4

Javascript and ActionScript (especially AS3) are syntactically similar languages and both are based on the ECMAScript Specification. There are some small differences in the actual code such as:

//Actionscript:
var a:String = new PlayerName();

//JavaScript:
var a = new PlayerName();

This is a demonstration that JavaScript does not have explicit variable type declarations, but this is not the real problem.

What you're asking goes much further than syntactic incompatibilities, as JS and AS work with completely different APIs. ActionScript has stages, frames and other Flash-based things which do not exist in JavaScript's environment. JavaScript - usually running in a browser - is used to manipulate documents, DOM nodes and CSS properties.

This means that unless you're just doing simple function calls and mathematics (without any dependency on the user or their environment) the things your program is doing simply cannot be transferred to another environment. For example, you cannot tell JavaScript to play() or goToAndStop() because there are no frames to play, stop or go to in a HTML document.

Unfortunately, I think what you're wondering is valid, but the question is almost certainly incorrect. If you have an application created in Flash or any other AS-enabled environment, you probably want to think about porting or re-writing it to the new context.

Sign up to request clarification or add additional context in comments.

1 Comment

Not sure about the "especially AS3" bit. AS1 was more similar to JavaScript than AS3, and AS2 at least as similar to JavaScript as AS3 is, I would say.
1

You might have a look at Falcon JS: https://github.com/apache/flex-falcon

2 Comments

Thanks, i'm sorry but im new to all of this programming stuff so I have no idea how to use it. If could explain how it will be very helpful, thanks!
That repo is empty today. Can you provide a new link?
-1

http://www.gotoandlearn.com/play.php?id=172 Just check it out the above. It might be useful.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.