- Home /
ActionScript to Unity?
Hi, there. Now I have one task - porting flash game (from fb) to Unity (mobile). I have sources in AC3 that used some flash lybraries. Can I used it on Unity 5? If I convert scripts from AC3 to JS - where I can get some analogs for flash namespaces (flash.events.Event, etc)? Or can I use C++ code in Unity project (we have working analogs of flash namespaces in C++)?
Any help will be great. Thnx
Answer by another_kind · Apr 27, 2015 at 02:02 PM
I'm fairly new to Unity but I used to work with Flash and AS3 also. I'm afraid you're going to have to rewrite everything either in JS or C# using Unity Classes (I'm using C# myself as it seems most people do and it's more strict).
Unity works differently from Flash in many ways and from what I can tell, it's better suited for game development. I suggest you start by watching a few tutorials and then dive into the code reference to see what classes are available and how you can replicate the functions of your AS3 code.
rewriting isnt a problem, ofc. but where i can get some methods such as flash.events.Event ant etc.? or its impossible?
With the exception of the GUI system introduced in 4.6, Unity doesn't really use events. I haven't really used this new GUI system yet, but as far as I know it is not really suitable for anything other than triggering UI events (also see manual). Ins$$anonymous$$d, Unity relies mostly on calling specifically named functions on $$anonymous$$onoBehaviour derived classes, such as OnTriggerEnter() or OnCollisionExit().
You might want to check out Send$$anonymous$$essage() and Broadcast$$anonymous$$essage(). There is a subtle difference between the two, explained here. Note that these methods don't support bubbling and that using them is somewhat discouraged due to performance issues.
A better approach may be an Observer pattern, though no default implementation exists in Unity itself.
Answer by randytayler · Apr 27, 2015 at 02:55 PM
Seconded. How could you connect to prebuilt Flash libraries? I think you'll have to rewrite them as @another_kind said. Have you searched to see if what you're looking for already exists as Unity packages, or if somebody has built something similar for sale in the asset store?
Your answer
Follow this Question
Related Questions
Where to place main controller code? 2 Answers
Flash: read in variable from actionscript 0 Answers
New Input system not having the properties of an actionmap 0 Answers
Add Actionscript files building for Flash 1 Answer
how do an action onclick an object? 3 Answers