Reputation: 71
How do i create a ac3 class which is similar to the c++ class? I'm pretty new to ac3 so converting has been a bit hard for me. When i do this i get a nested problem and also can only be one visible external class error. Anything similar so i can add variables into product.milk, .cheese and .chocolate?
public class dairy
{
public int cheese;
public int milk;
public int chocolate
}product;
Upvotes: 0
Views: 61
Reputation: 10143
In actionscript 3 you need to have to wrap it into a package, which matches the directory structure. If no package name defined,the file should be located in the same folder as the .fla file. Note the name of the class should be exact the same (case sensitive) as the claas name defined in the file itself. In actionscript it is common to start classes with a capital.
package{
public class Dairy
{
public var cheese:int;
public var milk:int;
public var chocolate:int
}
}
Btw, the right term is actionscript 3, also AS3. There is no cs6 version of actionscript, thats only the version of the IDE.
Upvotes: 1