05
Aug
04

Using ASnative in AS2

We had a need to use ASnative in a real application today for the first time. To our surprise, the first time we compiled we received this error message:

**Error** C:\CVSA\source\view\controls\DraggableTreeRow.as:
Line 99: There is no method with the name 'ASnative'.
           if (ASnative(800, 2)(1)!=1) {

Total ActionScript Errors: 1 	 Reported Errors: 1

Turns out ASnative isn’t in toplevel.as, so it’s not recognized by the compiler as a valid function. This gave us two options: adding it to toplevel.as or calling it dynamically.

Adding it to toplevel.as makes the code less portable because all machines that compile the application need to have this modification. Instead, we opted for dynamic invocation, as in the following example.

if (["ASnative"](800, 2)(1)!=1) {
stopRowDrag();
}

Enjoy!

For more information on ASnative see this entry on the Flashcoders Wiki.

(btw, I’ll post on why I’m using it later)


6 Responses to “Using ASnative in AS2”


  1. 1 discount Microret Nov 5th, 2004 at 8:28 am

    Thank you for the coments on your website. Can you recomend a good location for me to find cheap medicines? My mama is not well right now. Can you advice? Thank you.

    Pablo Villarino

  2. 2 Skelaxin Nov 21st, 2004 at 9:12 pm

    Hey, interesting site, perhaps youd like to check out mine: Skelaxin

  3. 3 ambien Nov 24th, 2004 at 9:54 am

    Hey, interesting site, perhaps youd like to check out mine: ambien

  4. 4 Phone Answering Personalised Dec 4th, 2004 at 4:33 am

    Hi Guys

    Thanks for taking the time posting. MSN have finally launch blogs, what was with the delay?
    Phone Answering Personalised

    Cya
    Bruce

  5. 5 Caiek Feb 3rd, 2007 at 8:04 am

    So much spam (

  6. 6 Ben Feb 12th, 2007 at 5:42 am

    LOL @ all the spam

Comments are currently closed.