You should check out the int, uint, and Number types. The sizes are
predefined in ActionScript 3 and not system dependent (e.g. int is
always 32-bit signed).
Operator overloading is not available. You can create an 'equals'
method and use it like so:
if (obj1.equals(obj2))
...
You can create a simple class for a "structure":
public class Contact {
public var name:String;
public var address:String;
public var phone:String;
}
And afterward you can use it like so:
var contact:Contact = new Contact();
contact.name = "Joe";
contact.address = "Los Angeles";
addToAddressBook(contact); /* function call */
ActionScript 3 is a pass-by-value language. Everything is passed by
value. When you pass an object reference to a function, the reference
is passed by value -- i.e. the function receives its own copy of the
reference.
If you're thinking of C++ references, this is not it. Think "pointers" instead.
Just to be clear:
function foo(ref:Object) {
ref.prop1 = "new value";
}
var obj:Object = new Object();
obj.prop1 = "old value;
foo(obj); // modified
trace(obj.prop1); // prints "new value"
Lastly, you can convert an int to a Number by simply assigning it.
var i:int = 10;
var n:Number = i;
If you're coming straight from a C/C++ background, there's a lot
you'll need to unlearn before you start to get a hang of ActionScript
3. But it's basically in the same family of languages, so you should
have no trouble.
Manish
On Thu, Mar 12, 2009 at 7:57 PM, christophe_jacquelin
<[email protected]> wrote:
> Hello,
>
> I am a C developper and now I am developing in Action Script. I have
> questions about ActionScript
>
> - Is it possible to define a variable as a long ?
>
> - How to program the overloading of an operator like the equal between 2
> objects of a same class.
>
> - What is the equivalent of a structure ?
>
> - When I call a function with a parameter, did this parameter is modified
> when I return from this function ?
>
> - How to convert an int to a Number ?
>
> Thank you,
> Christophe,
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links
>
>
>
>