2 Replies - 18181 Views - Last Post: 24 September 2005 - 12:00 AM

#1 narven   User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 06-February 05

Classes may only be defined in external...

Posted 22 September 2005 - 07:33 AM

hi all,

i'm new to classes in actionscript 2.0 and i'm trying to make a class to make multipreload movies from a list in a xml file.

but i've got this error:

"Classes may only be defined in external ActionScript 2.0 class scripts."


what on hell is that????


i've just found de problem... thanks

This post has been edited by narven: 22 September 2005 - 11:01 AM

Is This A Good Question/Topic? 0
  • +

Replies To: Classes may only be defined in external...

#2 reyco1   User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 20-March 05

Re: Classes may only be defined in external...

Posted 23 September 2005 - 10:53 PM

Hi:

you have to write your class in an external .as file and name the file exactly the same as your class. Save it in the same directory as your .fla

It is imperative that the .as file is named exactly as your class or it wont work.

In your .fla file, take the MCs you want to have the class implemented on and right click on them on the library. Choose "linkage", tick "Export for ActionScript" and "Export in First frame". In the "Identifier" textfield call it "myMC" (for example).

And, most importantly , write the name of your class in the "AS 2.0 class" textfield.

now you can OOP it. if, for example, your class was named "myClass", it would look something like this:

var flashMC:myClass= new myClass(mcInstancename);

Hope this helps!
Was This Post Helpful? 0
  • +
  • -

#3 narven   User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 29
  • Joined: 06-February 05

Re: Classes may only be defined in external...

Posted 24 September 2005 - 12:00 AM

reyco... thanks...

but... i've already found de problem... but thanks
Was This Post Helpful? 1

Page 1 of 1