Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-02-2007, 10:48 AM   #1
mohitjaitly
Registered User
 
Join Date: Apr 2007
Posts: 5
Default How to convert AS 2.0 code to AS 3.0

Hi ,
Is there any way to convert AS 2.0 code to AS 3.0 code....
Can we solve the problem of the way the packages are used in As 2.0 nd 3.0..
can we use some compiler directives or any conditional compilation.
mohitjaitly is offline   Reply With Quote
Old 05-02-2007, 02:19 PM   #2
senocular
six eyes
 
senocular's Avatar
 
Join Date: Jan 2003
Location: San Francisco, CA (USA)
Posts: 7,875
Send a message via ICQ to senocular Send a message via AIM to senocular Send a message via MSN to senocular Send a message via Yahoo to senocular
Default

1) not directly, no. You'll have to do it by hand. There are some tools that can help automate much of that process, though: http://www.kirupa.com/forum/showthre...32#post2110832
2) what problem?
3) no
__________________
(6)
senocular is offline   Reply With Quote
Old 05-02-2007, 05:26 PM   #3
dr_zeus
Feathers
 
dr_zeus's Avatar
 
Join Date: Mar 2005
Location: Silicon Valley
Posts: 1,999
Default

AS2 and AS3 are not directly compatible. You cannot use an AS2 class in an AS3 project. However, the languages are similar enough that you can convert many classes with only minor changes. The biggest problem you'll face is converting code to work with the new display list architecture.
__________________
Josh Tynjala | Feathers
dr_zeus is offline   Reply With Quote
Old 05-02-2007, 06:59 PM   #4
red penguin
[^\d\D]
 
red penguin's Avatar
 
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,254
Default

A great start
__________________

komielan.com
red penguin is offline   Reply With Quote
Old 05-03-2007, 11:23 AM   #5
mohitjaitly
Registered User
 
Join Date: Apr 2007
Posts: 5
Default

Ok abt packages...
If i have a class like--
ActionScript Code:
package ca.flashdev.hello { class HelloWorld {     public function sayHello():String {         var greeting:String = "Hello World!";         return greeting;     } } }
in directory str - E:\As3FlashTest\ca\flashdev\hello
it is not compiling.....
how to set class paths for it...?

Last edited by senocular; 05-03-2007 at 02:21 PM. Reason: [AS] tags
mohitjaitly is offline   Reply With Quote
Old 05-03-2007, 02:20 PM   #6
red penguin
[^\d\D]
 
red penguin's Avatar
 
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,254
Default

Ugh. I cannot edit this post TO USE THE AS TAGS

So, I will ask kindly. PLEASE, mohitjaitly, add the 'as' tags to your post and henceforth use them in all your posts where necessary.

Thank you.

To answer your question, I think we may need clarification:
Where is the fla?
Does it reside in the dir named 'hello'?
What is the code you are using to compile?
__________________

komielan.com
red penguin is offline   Reply With Quote
Old 05-03-2007, 02:33 PM   #7
Tink
Addict
 
Tink's Avatar
 
Join Date: Nov 2001
Location: London
Posts: 2,128
Default

Although Patricks converter is a good start, on any project of a decent scale you would probably want to re-write some of the architecture to make it work better with AS 3.0.
Tink is offline   Reply With Quote
Old 05-04-2007, 09:20 AM   #8
in a stupid man suit
Registered User
 
Join Date: Dec 2006
Posts: 25
Arrow

In AS3 all classes must be declared like that:

Code:
package{
  public class MyClass{
    //...
  }
}
notice the public keyword before the class, you shouldn't omit it.
in a stupid man suit is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a string to code (dynamically) JoKerTheFirst ActionScript 2.0 7 01-11-2007 02:47 PM
Help Consolidating Code petite minotaure ActionScript 2.0 4 12-13-2006 08:46 PM
[AS1] Help with old syntax and game code Enjodako Gaming and Game Development 8 11-07-2006 11:37 PM
load .png from database and use a code that will convert it to a movieclip mAi2x ActionScript 2.0 2 11-20-2005 08:05 PM
Flash 4 code to MX help please pinkylikesflash ActionScript 2.0 5 08-24-2004 12:50 PM


All times are GMT. The time now is 11:41 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.