Advertising | Best Credit Cards | The eBay Song | Credit Card | Mortgage
Actionscript question [Archive] - PCMech Forums

PDA

View Full Version : Actionscript question


hartken
06-22-2007, 03:15 PM
Can I do something like this?

class menuItem{
private string menuName;
...
...
...
}

You know, like use private and public for class properties?

If not, what the hell was Macromedia thinking?

hartken
06-22-2007, 08:17 PM
Also will actionscript allow me to call another class I created in the class file?

Like if I have a class called "menu" defined in menu.as, and then want to call another class I created called "menuItem" made in another file called menuItem.as?

Why even make a framework if you can't do something like that?

Force Flow
06-22-2007, 09:20 PM
yes, you can use public/private for variables in classes.

Yes, you can call other classes from within classes so long as the import statement is in the main fla file.

class menu {
public mItem = new menuItem();
}

Check out this article and the other parts of the series...it's very good at explaining how to work with classes in AS:
http://www.gotoandplay.it/_articles/2003/09/as2_part2.php

hartken
06-23-2007, 09:12 AM
Thanks!